Merge pull request #210 from finnlabs/fix/22634-budget-link

Provide relative_root costObject link from APIv3
pull/6827/head
Oliver Günther 9 years ago
commit 1797c9f3d3
  1. 4
      frontend/app/work_packages/directives/cost-object-directive.js
  2. 6
      lib/api/v3/budgets/budget_representer.rb

@ -28,7 +28,7 @@
angular.module('openproject.workPackages.directives')
.directive('costObject', ['$timeout', function($timeout) {
.directive('costObject', ['$timeout', 'PathHelper', function($timeout, Pathhelper) {
return {
restrict: 'E',
require: '^workPackageField',
@ -40,7 +40,7 @@ angular.module('openproject.workPackages.directives')
scope.workPackage = workPackage;
scope.costObject = scope.workPackage.embedded.costObject;
if (scope.costObject) {
scope.linkToCostObject = '/cost_objects/' + scope.costObject.props.id;
scope.linkToCostObject = scope.costObject.links.staticPath.href;
}
$timeout(function() {
element.find('a').on('click', function(e) {

@ -25,6 +25,12 @@ module API
module Budgets
class BudgetRepresenter < ::API::Decorators::Single
self_link title_getter: -> (*) { represented.subject }
link :staticPath do
{
href: cost_object_path(represented.id)
}
end
property :id, render_nil: true
property :subject, render_nil: true

Loading…
Cancel
Save