Link to project in notification

stable
Daniel García 2018-11-23 14:41:19 +01:00 committed by Alex Hermida
parent 9a53ac378c
commit d9d12cdc4b
2 changed files with 19 additions and 8 deletions

View File

@ -32,5 +32,9 @@ section.notifications-list
) )
.entry-content .entry-content
p(tg-compile-html="notification.get('title_html')") p(tg-compile-html="notification.get('title_html')")
span.entry-project {{::notification.getIn(['data', 'project', 'name'])}} p
a.entry-project(
href=""
ng-click="vm.setAsRead(notification, notification.get('projectUrl'))"
) {{::notification.getIn(['data', 'project', 'name'])}}
.entry-date {{::notification.get('created') | momentFromNow}} .entry-date {{::notification.get('created') | momentFromNow}}

View File

@ -21,10 +21,11 @@ taiga = @.taiga
class NotificationsService extends taiga.Service class NotificationsService extends taiga.Service
@.$inject = [ @.$inject = [
"tgResources", "tgResources"
"tgUserTimelinePaginationSequenceService", "tgUserTimelinePaginationSequenceService"
"$translate", "$translate"
"$tgNavUrls" "$tgNavUrls"
"$tgSections"
] ]
_notificationTypes = [ _notificationTypes = [
@ -86,10 +87,11 @@ class NotificationsService extends taiga.Service
} }
constructor: ( constructor: (
@rs, @rs
@userTimelinePaginationSequenceService, @userTimelinePaginationSequenceService
@translate, @translate
@navUrls @navUrls
@tgSections
) -> ) ->
getNotificationsList: (userId, onlyUnread) -> getNotificationsList: (userId, onlyUnread) ->
@ -123,8 +125,13 @@ class NotificationsService extends taiga.Service
type = @._getType(notification) type = @._getType(notification)
title = @._getTitle(notification, event_type, type) title = @._getTitle(notification, event_type, type)
notification = notification.set('title_html', title) notification = notification.set('title_html', title)
projectSlug = notification.getIn(['data', 'project', 'slug'])
projectSectionPath = @tgSections.getPath(projectSlug)
projectUrl = @navUrls.resolve("project-#{projectSectionPath}", { project: projectSlug })
notification = notification.set('projectUrl', projectUrl)
notification = notification.set('obj', @._getNotificationObject(notification)) notification = notification.set('obj', @._getNotificationObject(notification))
return notification return notification