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/helpers/work-packages-table-helper.js

35 lines
848 B

angular.module('openproject.workPackages.helpers')
.factory('WorkPackagesTableHelper', [function() {
var WorkPackagesTableHelper = {
/* builds rows from work packages, see IssuesHelper */
getRows: function(workPackages) {
var rows = [], ancestors = [];
angular.forEach(workPackages, function(workPackage, i) {
while(ancestors.length > 0 && workPackage.parent_id !== ancestors.last().object.id) {
ancestors.pop();
}
var row = {
level: ancestors.length,
group: 0,
groupName: '',
parent: ancestors.last(),
ancestors: ancestors.slice(0),
object: workPackage
};
rows.push(row);
if (!workPackage['leaf?']) ancestors.push(row);
});
return rows;
}
};
return WorkPackagesTableHelper;
}]);