From 3635e937d5837ce1ee7bdc17bb239e1e0b64841b Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Tue, 9 Sep 2014 11:28:52 +0200 Subject: [PATCH 1/3] Fix project links in work packages table Signed-off-by: Alex Coles --- .../angular/helpers/components/work-packages-helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/helpers/components/work-packages-helper.js b/app/assets/javascripts/angular/helpers/components/work-packages-helper.js index cae81b6eea..9f812e7637 100644 --- a/app/assets/javascripts/angular/helpers/components/work-packages-helper.js +++ b/app/assets/javascripts/angular/helpers/components/work-packages-helper.js @@ -96,7 +96,7 @@ angular.module('openproject.workPackages.helpers') id = object.parent_id; break; case 'project': - id = object.project_id; + id = object.project.identifier; break; case 'subject': id = object.id; From e46d9d90f7d2609e51ec73e553d52741fe1e1c28 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Tue, 9 Sep 2014 14:58:34 +0200 Subject: [PATCH 2/3] Add project links test to workPackageColumn tests Signed-off-by: Alex Coles --- .../work-package-column-directive-test.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/karma/tests/directives/work_packages/work-package-column-directive-test.js b/karma/tests/directives/work_packages/work-package-column-directive-test.js index 6c8fc9b3e2..939ee293cd 100644 --- a/karma/tests/directives/work_packages/work-package-column-directive-test.js +++ b/karma/tests/directives/work_packages/work-package-column-directive-test.js @@ -200,11 +200,30 @@ describe('workPackageColumn Directive', function() { sheep: 10, parent: { id: 1, subject: 'Test child work package' }, parent_id: 1, - custom_values: [ { custom_field_id: 1, field_format: 'string', value: 'asdf1234'} ] + custom_values: [ { custom_field_id: 1, field_format: 'string', value: 'asdf1234'} ], + project: { + id: 29, + identifier: 'project-dream-team' + } }; scope.displayType = 'link'; }); + describe('to project', function() { + beforeEach(function() { + scope.column = { + meta_data: { data_type: 'object', link: { display: true, model_type: 'project'} }, + name: 'project' + } + compile(); + }); + + it('should have correct href', function() { + var content = element.find('a').last(); + expect(content.attr('href')).to.equal('/projects/project-dream-team'); + }); + }); + describe('to parent work package', function() { beforeEach(function() { From 693c1195bf590e44525ddcda6c054eec8552da7b Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Tue, 9 Sep 2014 15:07:19 +0200 Subject: [PATCH 3/3] Rename staticProjectPath argument for clarity Signed-off-by: Alex Coles --- .../javascripts/angular/helpers/components/path-helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/angular/helpers/components/path-helper.js b/app/assets/javascripts/angular/helpers/components/path-helper.js index d182e7369f..4dd9702766 100644 --- a/app/assets/javascripts/angular/helpers/components/path-helper.js +++ b/app/assets/javascripts/angular/helpers/components/path-helper.js @@ -252,8 +252,8 @@ angular.module('openproject.helpers') staticEditWorkPackagePath: function(workPackageId){ return PathHelper.staticWorkPackagePath(workPackageId) + '/edit'; }, - staticProjectPath: function(projectId) { - return PathHelper.staticBase + PathHelper.projectPath(projectId); + staticProjectPath: function(projectIdentifier) { + return PathHelper.staticBase + PathHelper.projectPath(projectIdentifier); }, staticVersionPath: function(versionId) { return PathHelper.staticBase + PathHelper.versionPath(versionId);