|
|
|
@ -26,7 +26,13 @@ |
|
|
|
|
// See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
|
//++
|
|
|
|
|
|
|
|
|
|
module.exports = function($timeout, WorkPackageService, ApiNotificationsService, PathHelper, MAX_AUTOCOMPLETER_ADDITION_ITERATIONS) { |
|
|
|
|
module.exports = function( |
|
|
|
|
$timeout, |
|
|
|
|
WorkPackageService, |
|
|
|
|
ApiNotificationsService, |
|
|
|
|
PathHelper, |
|
|
|
|
MAX_AUTOCOMPLETER_ADDITION_ITERATIONS |
|
|
|
|
) { |
|
|
|
|
function CommonRelationsHandler(workPackage, |
|
|
|
|
relations, |
|
|
|
|
relationsId) { |
|
|
|
@ -34,7 +40,7 @@ module.exports = function($timeout, WorkPackageService, ApiNotificationsService, |
|
|
|
|
this.relations = relations; |
|
|
|
|
this.relationsId = relationsId; |
|
|
|
|
|
|
|
|
|
this.type = "relation"; |
|
|
|
|
this.type = 'relation'; |
|
|
|
|
this.isSingletonRelation = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -56,7 +62,10 @@ module.exports = function($timeout, WorkPackageService, ApiNotificationsService, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
addRelation: function(scope) { |
|
|
|
|
WorkPackageService.addWorkPackageRelation(this.workPackage, scope.relationToAddId, this.relationsId).then(function(relation) { |
|
|
|
|
WorkPackageService.addWorkPackageRelation(this.workPackage, |
|
|
|
|
scope.relationToAddId, |
|
|
|
|
this.relationsId) |
|
|
|
|
.then(function() { |
|
|
|
|
scope.relationToAddId = ''; |
|
|
|
|
scope.updateFocus(-1); |
|
|
|
|
scope.$emit('workPackageRefreshRequired'); |
|
|
|
@ -89,7 +98,7 @@ module.exports = function($timeout, WorkPackageService, ApiNotificationsService, |
|
|
|
|
getRelatedWorkPackage: function(workPackage, relation) { |
|
|
|
|
var self = workPackage.links.self.href; |
|
|
|
|
|
|
|
|
|
if (relation.links.relatedTo.href == self) { |
|
|
|
|
if (relation.links.relatedTo.href === self) { |
|
|
|
|
return relation.links.relatedFrom.fetch(); |
|
|
|
|
} else { |
|
|
|
|
return relation.links.relatedTo.fetch(); |
|
|
|
|