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) {
switch(propertyName) {
case 'dueDate':
return this.formatValue(value, 'date');
case 'startDate':
return this.formatValue(value, 'date');
case 'createdAt':
return this.formatValue(value, 'datetime');
case 'updatedAt':
return this.formatValue(value, 'datetime');
case 'estimatedTime':
return value && value.value ? value.value + ' ' + value.units : null;
default:
return value;
var mappings = {
dueDate: 'date',
startDate: 'date',
createdAt: 'datetime',
updatedAt: 'datetime'
};
if (propertyName === 'estimatedTime') {
return value && value.value ? value.value + ' ' + value.units : null;
} else {
return this.formatValue(value, mappings[propertyName]);
}
},

Loading…
Cancel
Save