Point work package link from table to new angular show view.

pull/3563/head
Tim Habermaas 9 years ago committed by Stefan Botzenhart
parent 3d9b7266b3
commit bc5df6e051
  1. 1
      frontend/app/templates/work_packages/work_package_column.html
  2. 10
      frontend/app/work_packages/directives/work-package-column-directive.js

@ -5,6 +5,7 @@
</progress-bar> </progress-bar>
<a ng-switch-when="link" href="{{ url }}" title="{{ displayText }}">{{ displayText }}</a> <a ng-switch-when="link" href="{{ url }}" title="{{ displayText }}">{{ displayText }}</a>
<a ng-switch-when="ref" ui-sref="{{ stateRef }}" title="{{ displayText }}">{{ displayText }}</a>
<span ng-switch-default title="{{ displayText }}">{{ displayText }}</span> <span ng-switch-default title="{{ displayText }}">{{ displayText }}</span>
</span> </span>

@ -114,14 +114,18 @@ module.exports = function(PathHelper, WorkPackagesHelper, UserService){
function displayDataAsLink(id) { function displayDataAsLink(id) {
// Example of how we can look to the provided meta data to format the column // Example of how we can look to the provided meta data to format the column
// This relies on the meta being sent from the server // This relies on the meta being sent from the server
var link_meta = scope.column.meta_data.link;
if (link_meta.model_type === 'work_package') {
scope.displayType = 'ref';
scope.stateRef = 'work-packages.show.activity({workPackageId: ' + id + '})';
} else {
scope.displayType = 'link'; scope.displayType = 'link';
scope.url = getLinkFor(id, scope.column.meta_data.link); scope.url = getLinkFor(id, link_meta);
}
} }
function getLinkFor(id, link_meta){ function getLinkFor(id, link_meta){
switch (link_meta.model_type) { switch (link_meta.model_type) {
case 'work_package':
return PathHelper.workPackagePath(id);
case 'user': case 'user':
if (scope.workPackage[scope.column.name] && scope.workPackage[scope.column.name].type == 'Group') { if (scope.workPackage[scope.column.name] && scope.workPackage[scope.column.name].type == 'Group') {
// if it's a group, we have nothing to link to // if it's a group, we have nothing to link to

Loading…
Cancel
Save