OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/assets/javascripts/angular/directives/components/work-package-column-directi...

41 lines
1.1 KiB

// TODO move to UI components
openprojectApp.directive('workPackageColumn', ['PathHelper', function(PathHelper){
return {
restrict: 'EA',
replace: true,
scope: {
workPackage: '=',
column: '='
},
templateUrl: '/templates/components/work_package_column.html',
link: function(scope, element, attributes) {
var data = scope.workPackage[scope.column.name];
var defaultText = '';
// Get display text from 'name' if it is an object
var displayText = defaultText;
switch(typeof(data)) {
case 'string':
displayText = data;
break;
case 'object':
displayText = data['name'];
break;
}
// Set type specific scope
scope.displayText = displayText;
switch (scope.column.name){
case 'subject':
scope.url = PathHelper.workPackagePath(scope.workPackage.id);
break;
case 'assigned_to':
if (scope.workPackage.assigned_to) scope.url = PathHelper.userPath(scope.workPackage.assigned_to.id);
break;
}
}
};
}]);