Adapt to grouped WP attributes

pull/6827/head
Hagen Schink 10 years ago
parent 9bb674e7e1
commit 52ccd12899
  1. 26
      app/assets/javascripts/angular/openproject-costs-app.js
  2. 2
      config/locales/js-de.yml
  3. 2
      config/locales/js-en.yml

@ -29,9 +29,12 @@
// main app // main app
var openprojectCostsApp = angular.module('openproject'); var openprojectCostsApp = angular.module('openproject');
openprojectCostsApp.run(['HookService', function(HookService) { openprojectCostsApp.run(['HookService',
var setupCostsAttributes = function(attributes) { 'ConfigurationService',
var spentTimeIndex = attributes.indexOf('spentTime'); 'WorkPackagesOverviewService',
function(HookService, ConfigurationService, WorkPackagesOverviewService) {
var setupCostsAttributes = function() {
var position = WorkPackagesOverviewService.getGroupedWorkPackageOverviewAttributes().length - 1;
var costsAttributes = { var costsAttributes = {
overallCosts: null, overallCosts: null,
spentHours: 'spentHoursLinked', spentHours: 'spentHoursLinked',
@ -39,22 +42,17 @@ openprojectCostsApp.run(['HookService', function(HookService) {
summarizedCostEntries: 'spentUnits' summarizedCostEntries: 'spentUnits'
}; };
WorkPackagesOverviewService.removeAttribute('spentTime');
WorkPackagesOverviewService.addGroup('costs', position);
angular.forEach(costsAttributes, function(id, costAttribute) { angular.forEach(costsAttributes, function(id, costAttribute) {
attributes.push(id || costAttribute); WorkPackagesOverviewService.addAttributeToGroup('costs', id || costAttribute);
}); });
if (spentTimeIndex >= 0) {
attributes.splice(spentTimeIndex, 1);
}
} }
HookService.register('workPackagePluginAttributes', function(params) { if (ConfigurationService.isModuleEnabled('costs_module')) {
var costsActivted = params.enabledModules.indexOf('costs_module') >= 0; setupCostsAttributes();
if (costsActivted) {
setupCostsAttributes(params.attributes)
} }
});
HookService.register('workPackageOverviewAttributes', function(params) { HookService.register('workPackageOverviewAttributes', function(params) {
var directive; var directive;

@ -36,6 +36,8 @@
de: de:
js: js:
work_packages: work_packages:
property_groups:
costs: "Kosten"
properties: properties:
costObject: "Budget" costObject: "Budget"
spentHoursLinked: "Aufgewendete Zeit" spentHoursLinked: "Aufgewendete Zeit"

@ -36,6 +36,8 @@
en: en:
js: js:
work_packages: work_packages:
property_groups:
costs: "Costs"
properties: properties:
costObject: "Budget" costObject: "Budget"
spentHoursLinked: "Spent time" spentHoursLinked: "Spent time"

Loading…
Cancel
Save