Slightly more readable wp property formatting

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

@ -57,20 +57,22 @@ angular.module('openproject.workPackages.controllers')
var workPackageProperties = DEFAULT_WORK_PACKAGE_PROPERTIES; var workPackageProperties = DEFAULT_WORK_PACKAGE_PROPERTIES;
angular.forEach(workPackageProperties, function(property) { function getFormattedPropertyValue(property) {
var label = I18n.t('js.work_packages.properties.' + property),
value;
if (property === 'date') { if (property === 'date') {
if (workPackage.props.startDate && workPackage.props.dueDate) { 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'); WorkPackagesHelper.formatWorkPackageProperty(workPackage.props['dueDate'], 'dueDate');
} }
} else { } 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) { if (value) {
$scope.presentWorkPackageProperties[label] = value; $scope.presentWorkPackageProperties[label] = value;

Loading…
Cancel
Save