Slight code restructuring

pull/1551/head
Till Breuer 10 years ago
parent a6a41be12c
commit 79ba06bd4b
  1. 24
      app/assets/javascripts/angular/helpers/components/work-packages-helper.js

@ -107,19 +107,17 @@ angular.module('openproject.workPackages.helpers')
} }
}, },
formatWorkPackageProperty: function(value, propertyName) { formatWorkPackageProperty: function(value, propertyName) {
switch(propertyName) { var mappings = {
case 'dueDate': dueDate: 'date',
return this.formatValue(value, 'date'); startDate: 'date',
case 'startDate': createdAt: 'datetime',
return this.formatValue(value, 'date'); updatedAt: 'datetime'
case 'createdAt': };
return this.formatValue(value, 'datetime');
case 'updatedAt': if (propertyName === 'estimatedTime') {
return this.formatValue(value, 'datetime'); return value && value.value ? value.value + ' ' + value.units : null;
case 'estimatedTime': } else {
return value && value.value ? value.value + ' ' + value.units : null; return this.formatValue(value, mappings[propertyName]);
default:
return value;
} }
}, },

Loading…
Cancel
Save