Fix activity link for last forum message

pull/1293/head
Hagen Schink 11 years ago
parent dffa156943
commit 5380ea33f1
  1. 2
      app/assets/javascripts/angular/controllers/messages-controllers.js
  2. 7
      app/assets/javascripts/angular/directives/components/authoring-directive.js
  3. 13
      app/assets/javascripts/angular/helpers/components/path-helper.js
  4. 1
      app/controllers/boards_controller.rb
  5. 2
      app/views/boards/show.html.erb

@ -33,6 +33,8 @@ angular.module('openproject.messages.controllers')
$scope.messages = gon.messages; $scope.messages = gon.messages;
$scope.totalMessageCount = gon.total_count; $scope.totalMessageCount = gon.total_count;
$scope.isLoading = false; $scope.isLoading = false;
$scope.projectId = gon.project_id;
$scope.activityModulEnabled = gon.activity_modul_enabled;
TimezoneService.setTimezone(gon.timezone); TimezoneService.setTimezone(gon.timezone);

@ -33,7 +33,7 @@ angular.module('openproject.uiComponents')
return { return {
restrict: 'E', restrict: 'E',
replace: true, replace: true,
scope: { createdOn: '=', author: '=' }, scope: { createdOn: '=', author: '=', project: '=', activity: '=' },
templateUrl: '/templates/components/authoring.html', templateUrl: '/templates/components/authoring.html',
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
moment.lang(I18n.locale); moment.lang(I18n.locale);
@ -44,7 +44,12 @@ angular.module('openproject.uiComponents')
scope.I18n = I18n; scope.I18n = I18n;
scope.authorLink = '<a href="'+ PathHelper.userPath(scope.author.id) + '">' + scope.author.name + '</a>'; scope.authorLink = '<a href="'+ PathHelper.userPath(scope.author.id) + '">' + scope.author.name + '</a>';
if (scope.activity) {
scope.timestamp = '<a title="' + time + '" href="' + PathHelper.activityPath(scope.project, createdOn.format('YYYY-MM-DD')) + '">' + timeago + '</a>';
} else {
scope.timestamp = '<span class="timestamp" title="' + time + '">' + timeago + '</span>'; scope.timestamp = '<span class="timestamp" title="' + time + '">' + timeago + '</span>';
} }
}
}; };
}]); }]);

@ -34,6 +34,19 @@ angular.module('openproject.helpers')
apiPrefixV2: '/api/v2', apiPrefixV2: '/api/v2',
apiPrefixV3: '/api/v3', 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) { assetPath: function(assetIdentifier) {
return '/assets/' + assetIdentifier; return '/assets/' + assetIdentifier;
}, },

@ -62,6 +62,7 @@ class BoardsController < ApplicationController
gon.rabl "app/views/messages/index.rabl" gon.rabl "app/views/messages/index.rabl"
gon.project_id = @project.id gon.project_id = @project.id
gon.activity_modul_enabled = @project.module_enabled?("activity");
gon.board_id = @board.id gon.board_id = @board.id
gon.sort_column = 'updated_on' gon.sort_column = 'updated_on'
gon.sort_direction = 'desc' gon.sort_direction = 'desc'

@ -80,7 +80,7 @@ See doc/COPYRIGHT.rdoc for more details.
<td class="replies">{{message.replies_count}}</td> <td class="replies">{{message.replies_count}}</td>
<td class="last_message"> <td class="last_message">
<span ng-if="message.last_reply !== undefined"> <span ng-if="message.last_reply !== undefined">
<authoring created-on="message.last_reply.created_on" author="message.last_reply.author"></authoring> <authoring created-on="message.last_reply.created_on" author="message.last_reply.author" project="projectId" activity="activityModulEnabled"></authoring>
<br /> <br />
<a ng-href="{{PathHelper.messagePath(message.last_reply.id)}}">{{message.subject}}</a> <a ng-href="{{PathHelper.messagePath(message.last_reply.id)}}">{{message.subject}}</a>
</span> </span>

Loading…
Cancel
Save