Show all relations (except parent/child)

pull/1631/head
Hagen Schink 10 years ago
parent 0c4a8f9c8f
commit 7552d84b7a
  1. 4
      app/assets/javascripts/angular/helpers/components/work-packages-helper.js
  2. 8
      app/assets/javascripts/angular/work_packages/controllers/work-package-details-controller.js
  3. 38
      public/templates/work_packages/tabs/relations.html

@ -137,7 +137,7 @@ angular.module('openproject.workPackages.helpers')
return id;
},
getRelatedTos: function(workPackage) {
getRelationOfType: function(workPackage, type) {
var self = workPackage.links.self.href;
var relations = workPackage.embedded.relations;
var result = [];
@ -146,7 +146,7 @@ angular.module('openproject.workPackages.helpers')
for (var x = 0; x < relations.length; x++) {
var relation = relations[x];
if (relation.props._type == "Relation::Relates") {
if (relation.props._type == type) {
if (relation.links.relatedTo.href == self) {
result.push(relation.links.relatedFrom.fetch());
} else {

@ -166,7 +166,13 @@ angular.module('openproject.workPackages.controllers')
$scope.attachments = workPackage.embedded.attachments;
// relations
$scope.relatedTo = WorkPackagesHelper.getRelatedTos(workPackage);
$scope.relatedTo = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Relates");
$scope.duplicates = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Duplicates");
$scope.duplicated = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Duplicated");
$scope.blocks = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Blocks");
$scope.blocked = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Blocked");
$scope.precedes = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Precedes");
$scope.follows = WorkPackagesHelper.getRelationOfType(workPackage, "Relation::Follows");
// Author
$scope.author = workPackage.embedded.author;

@ -12,10 +12,46 @@
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="RelatedTo"
<work-package-relation title="Related To"
relations="relatedTo"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="Duplicates"
relations="duplicates"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="Duplicated by"
relations="duplicated"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="Blocks"
relations="blocks"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="Block by"
relations="blocked"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="Precedes"
relations="precedes"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
<work-package-relation title="Follows"
relations="follows"
button-title="Add Relation"
button-icon="<i class='icon-hierarchy icon-add'></i>">
</work-package-relation>
</div>
</div>

Loading…
Cancel
Save