From 5380ea33f1505cc6aef3adf6ad3c8021630b52ac Mon Sep 17 00:00:00 2001 From: Hagen Schink Date: Mon, 19 May 2014 14:04:43 +0200 Subject: [PATCH] Fix activity link for last forum message --- .../angular/controllers/messages-controllers.js | 2 ++ .../directives/components/authoring-directive.js | 9 +++++++-- .../angular/helpers/components/path-helper.js | 13 +++++++++++++ app/controllers/boards_controller.rb | 1 + app/views/boards/show.html.erb | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/angular/controllers/messages-controllers.js b/app/assets/javascripts/angular/controllers/messages-controllers.js index 32b49adbf4..a76a612dcc 100644 --- a/app/assets/javascripts/angular/controllers/messages-controllers.js +++ b/app/assets/javascripts/angular/controllers/messages-controllers.js @@ -33,6 +33,8 @@ angular.module('openproject.messages.controllers') $scope.messages = gon.messages; $scope.totalMessageCount = gon.total_count; $scope.isLoading = false; + $scope.projectId = gon.project_id; + $scope.activityModulEnabled = gon.activity_modul_enabled; TimezoneService.setTimezone(gon.timezone); diff --git a/app/assets/javascripts/angular/directives/components/authoring-directive.js b/app/assets/javascripts/angular/directives/components/authoring-directive.js index 2451673d6c..ce97bc4e69 100644 --- a/app/assets/javascripts/angular/directives/components/authoring-directive.js +++ b/app/assets/javascripts/angular/directives/components/authoring-directive.js @@ -33,7 +33,7 @@ angular.module('openproject.uiComponents') return { restrict: 'E', replace: true, - scope: { createdOn: '=', author: '=' }, + scope: { createdOn: '=', author: '=', project: '=', activity: '=' }, templateUrl: '/templates/components/authoring.html', link: function(scope, element, attrs) { moment.lang(I18n.locale); @@ -44,7 +44,12 @@ angular.module('openproject.uiComponents') scope.I18n = I18n; scope.authorLink = '' + scope.author.name + ''; - scope.timestamp = '' + timeago + ''; + + if (scope.activity) { + scope.timestamp = '' + timeago + ''; + } else { + scope.timestamp = '' + timeago + ''; + } } }; }]); diff --git a/app/assets/javascripts/angular/helpers/components/path-helper.js b/app/assets/javascripts/angular/helpers/components/path-helper.js index ac900d6536..19b0f380f7 100644 --- a/app/assets/javascripts/angular/helpers/components/path-helper.js +++ b/app/assets/javascripts/angular/helpers/components/path-helper.js @@ -34,6 +34,19 @@ angular.module('openproject.helpers') apiPrefixV2: '/api/v2', apiPrefixV3: '/api/v3', + activityPath: function(projectIdentifier, from) { + var link = '/activity'; + + if (projectIdentifier) { + link = PathHelper.projectPath(projectIdentifier) + link; + } + + if (from) { + link += '?from=' + from; + } + + return link; + }, assetPath: function(assetIdentifier) { return '/assets/' + assetIdentifier; }, diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 99d817116d..c5eb893bc0 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -62,6 +62,7 @@ class BoardsController < ApplicationController gon.rabl "app/views/messages/index.rabl" gon.project_id = @project.id + gon.activity_modul_enabled = @project.module_enabled?("activity"); gon.board_id = @board.id gon.sort_column = 'updated_on' gon.sort_direction = 'desc' diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 7e60d5569f..ec93fdfe06 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -80,7 +80,7 @@ See doc/COPYRIGHT.rdoc for more details. {{message.replies_count}} - +
{{message.subject}}