Adapt to grouped WP attributes

pull/6827/head
Hagen Schink 10 years ago
parent 9bb674e7e1
commit 52ccd12899
  1. 28
      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
var openprojectCostsApp = angular.module('openproject');
openprojectCostsApp.run(['HookService', function(HookService) {
var setupCostsAttributes = function(attributes) {
var spentTimeIndex = attributes.indexOf('spentTime');
openprojectCostsApp.run(['HookService',
'ConfigurationService',
'WorkPackagesOverviewService',
function(HookService, ConfigurationService, WorkPackagesOverviewService) {
var setupCostsAttributes = function() {
var position = WorkPackagesOverviewService.getGroupedWorkPackageOverviewAttributes().length - 1;
var costsAttributes = {
overallCosts: null,
spentHours: 'spentHoursLinked',
@ -39,22 +42,17 @@ openprojectCostsApp.run(['HookService', function(HookService) {
summarizedCostEntries: 'spentUnits'
};
WorkPackagesOverviewService.removeAttribute('spentTime');
WorkPackagesOverviewService.addGroup('costs', position);
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) {
var costsActivted = params.enabledModules.indexOf('costs_module') >= 0;
if (costsActivted) {
setupCostsAttributes(params.attributes)
}
});
if (ConfigurationService.isModuleEnabled('costs_module')) {
setupCostsAttributes();
}
HookService.register('workPackageOverviewAttributes', function(params) {
var directive;

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

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

Loading…
Cancel
Save