Slightly more readable wp property formatting

pull/1551/head
Till Breuer 10 years ago
parent 79ba06bd4b
commit b8ba32e8cf
  1. 14
      app/assets/javascripts/angular/work_packages/controllers/work-package-details-controller.js

@ -57,21 +57,23 @@ angular.module('openproject.workPackages.controllers')
var workPackageProperties = DEFAULT_WORK_PACKAGE_PROPERTIES;
angular.forEach(workPackageProperties, function(property) {
var label = I18n.t('js.work_packages.properties.' + property),
value;
function getFormattedPropertyValue(property) {
if (property === 'date') {
if (workPackage.props.startDate && workPackage.props.dueDate) {
value = WorkPackagesHelper.formatWorkPackageProperty(workPackage.props['startDate'], 'startDate') +
return WorkPackagesHelper.formatWorkPackageProperty(workPackage.props['startDate'], 'startDate') +
' - ' +
WorkPackagesHelper.formatWorkPackageProperty(workPackage.props['dueDate'], 'dueDate');
}
} else {
value = WorkPackagesHelper.formatWorkPackageProperty(workPackage.props[property], property);
return WorkPackagesHelper.formatWorkPackageProperty(workPackage.props[property], property);
}
}
angular.forEach(workPackageProperties, function(property) {
var label = I18n.t('js.work_packages.properties.' + property),
value = getFormattedPropertyValue(property);
if (value) {
$scope.presentWorkPackageProperties[label] = value;
} else {

Loading…
Cancel
Save