Merge pull request #553 from taigaio/issue/2785/fix-user-mentions
Issue/2785/fix user mentionsstable
commit
c98b15ce10
|
@ -152,7 +152,7 @@ module.directive("tgSprintProgressbar", SprintProgressBarDirective)
|
||||||
## Created-by display directive
|
## Created-by display directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
CreatedByDisplayDirective = ($template, $compile, $translate)->
|
CreatedByDisplayDirective = ($template, $compile, $translate, $navUrls)->
|
||||||
# Display the owner information (full name and photo) and the date of
|
# Display the owner information (full name and photo) and the date of
|
||||||
# creation of an object (like USs, tasks and issues).
|
# creation of an object (like USs, tasks and issues).
|
||||||
#
|
#
|
||||||
|
@ -168,13 +168,14 @@ CreatedByDisplayDirective = ($template, $compile, $translate)->
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
render = (model) ->
|
render = (model) ->
|
||||||
owner = $scope.usersById?[model.owner] or {
|
owner = model.owner_extra_info or {
|
||||||
full_name_display: $translate.instant("COMMON.EXTERNAL_USER")
|
full_name_display: $translate.instant("COMMON.EXTERNAL_USER")
|
||||||
photo: "/images/unnamed.png"
|
photo: "/images/user-noimage.png"
|
||||||
}
|
}
|
||||||
|
|
||||||
html = template({
|
html = template({
|
||||||
owner: owner
|
owner: owner
|
||||||
|
url: if owner?.is_active then $navUrls.resolve("user-profile", {username: owner.username}) else ""
|
||||||
date: moment(model.created_date).format($translate.instant("COMMON.DATETIME"))
|
date: moment(model.created_date).format($translate.instant("COMMON.DATETIME"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -194,7 +195,8 @@ CreatedByDisplayDirective = ($template, $compile, $translate)->
|
||||||
require: "ngModel"
|
require: "ngModel"
|
||||||
}
|
}
|
||||||
|
|
||||||
module.directive("tgCreatedByDisplay", ["$tgTemplate", "$compile", "$translate", CreatedByDisplayDirective])
|
module.directive("tgCreatedByDisplay", ["$tgTemplate", "$compile", "$translate", "$tgNavUrls",
|
||||||
|
CreatedByDisplayDirective])
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
|
@ -68,7 +68,7 @@ class HistoryController extends taiga.Controller
|
||||||
return @rs.history.undeleteComment(type, objectId, activityId).then => @.loadHistory(type, objectId)
|
return @rs.history.undeleteComment(type, objectId, activityId).then => @.loadHistory(type, objectId)
|
||||||
|
|
||||||
|
|
||||||
HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $compile) ->
|
HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $compile, $navUrls) ->
|
||||||
templateChangeDiff = $template.get("common/history/history-change-diff.html", true)
|
templateChangeDiff = $template.get("common/history/history-change-diff.html", true)
|
||||||
templateChangePoints = $template.get("common/history/history-change-points.html", true)
|
templateChangePoints = $template.get("common/history/history-change-points.html", true)
|
||||||
templateChangeGeneric = $template.get("common/history/history-change-generic.html", true)
|
templateChangeGeneric = $template.get("common/history/history-change-generic.html", true)
|
||||||
|
@ -136,15 +136,6 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
|
|
||||||
return humanizedFieldNames[field] or field
|
return humanizedFieldNames[field] or field
|
||||||
|
|
||||||
getUserFullName = (userId) ->
|
|
||||||
return $scope.usersById[userId]?.full_name_display
|
|
||||||
|
|
||||||
getUserAvatar = (userId) ->
|
|
||||||
if $scope.usersById[userId]?
|
|
||||||
return $scope.usersById[userId].photo
|
|
||||||
else
|
|
||||||
return "/images/unnamed.png"
|
|
||||||
|
|
||||||
countChanges = (comment) ->
|
countChanges = (comment) ->
|
||||||
return _.keys(comment.values_diff).length
|
return _.keys(comment.values_diff).length
|
||||||
|
|
||||||
|
@ -286,8 +277,9 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
return html[0].outerHTML
|
return html[0].outerHTML
|
||||||
|
|
||||||
html = templateActivity({
|
html = templateActivity({
|
||||||
avatar: getUserAvatar(comment.user.pk)
|
avatar: comment.user.photo
|
||||||
userFullName: comment.user.name
|
userFullName: comment.user.name
|
||||||
|
userProfileUrl: if comment.user.is_active then $navUrls.resolve("user-profile", {username: comment.user.username}) else ""
|
||||||
creationDate: moment(comment.created_at).format(getPrettyDateFormat())
|
creationDate: moment(comment.created_at).format(getPrettyDateFormat())
|
||||||
comment: comment.comment_html
|
comment: comment.comment_html
|
||||||
changesText: renderChangesHelperText(comment)
|
changesText: renderChangesHelperText(comment)
|
||||||
|
@ -305,8 +297,9 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
|
|
||||||
renderChange = (change) ->
|
renderChange = (change) ->
|
||||||
return templateActivity({
|
return templateActivity({
|
||||||
avatar: getUserAvatar(change.user.pk)
|
avatar: change.user.photo
|
||||||
userFullName: change.user.name
|
userFullName: change.user.name
|
||||||
|
userProfileUrl: if change.user.is_active then $navUrls.resolve("user-profile", {username: change.user.username}) else ""
|
||||||
creationDate: moment(change.created_at).format(getPrettyDateFormat())
|
creationDate: moment(change.created_at).format(getPrettyDateFormat())
|
||||||
comment: change.comment_html
|
comment: change.comment_html
|
||||||
changes: renderChangeEntries(change)
|
changes: renderChangeEntries(change)
|
||||||
|
@ -458,4 +451,4 @@ HistoryDirective = ($log, $loading, $qqueue, $template, $confirm, $translate, $c
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgHistory", ["$log", "$tgLoading", "$tgQqueue", "$tgTemplate", "$tgConfirm", "$translate",
|
module.directive("tgHistory", ["$log", "$tgLoading", "$tgQqueue", "$tgTemplate", "$tgConfirm", "$translate",
|
||||||
"$compile", HistoryDirective])
|
"$compile", "$tgNavUrls", HistoryDirective])
|
||||||
|
|
|
@ -155,7 +155,7 @@ WikiSummaryDirective = ($log, $template, $compile, $translate) ->
|
||||||
user = $scope.usersById[wiki.last_modifier]
|
user = $scope.usersById[wiki.last_modifier]
|
||||||
|
|
||||||
if user is undefined
|
if user is undefined
|
||||||
user = {name: "unknown", imgUrl: "/images/unnamed.png"}
|
user = {name: "unknown", imgUrl: "/images/user-noimage.png"}
|
||||||
else
|
else
|
||||||
user = {name: user.full_name_display, imgUrl: user.photo}
|
user = {name: user.full_name_display, imgUrl: user.photo}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
|
@ -3,7 +3,7 @@ div.activity-item
|
||||||
div.activity-info
|
div.activity-info
|
||||||
div.profile-contact-picture
|
div.profile-contact-picture
|
||||||
a(tg-nav="user-profile:username=vm.activity.user.username", title="{{::vm.activity.user.name }}")
|
a(tg-nav="user-profile:username=vm.activity.user.username", title="{{::vm.activity.user.name }}")
|
||||||
img(ng-src="{{::vm.activity.user.photo || '/images/unnamed.png'}}", alt="{{::vm.activity.user.name}}")
|
img(ng-src="{{::vm.activity.user.photo || '/images/user-noimage.png'}}", alt="{{::vm.activity.user.name}}")
|
||||||
|
|
||||||
p(tg-compile-html="vm.activity.title")
|
p(tg-compile-html="vm.activity.title")
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
.user-avatar
|
.user-avatar
|
||||||
|
a(href!="<%- url %>", title!="<%- owner.full_name_display %>")
|
||||||
img(src!="<%- owner.photo %>", alt!="<%- owner.full_name_display %>")
|
img(src!="<%- owner.photo %>", alt!="<%- owner.full_name_display %>")
|
||||||
|
|
||||||
.created-by
|
.created-by
|
||||||
|
a(href!="<%- url %>", title!="<%- owner.full_name_display %>")
|
||||||
span.created-title(translate="COMMON.CREATED_BY", translate-values!="{ 'fullDisplayName': '<%- owner.full_name_display %>'}")
|
span.created-title(translate="COMMON.CREATED_BY", translate-values!="{ 'fullDisplayName': '<%- owner.full_name_display %>'}")
|
||||||
span.created-date
|
span.created-date
|
||||||
| <%- date %>
|
| <%- date %>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
div(class!="activity-single <%- mode %>")
|
div(class!="activity-single <%- mode %>")
|
||||||
.activity-user
|
.activity-user
|
||||||
a.avatar(href="" title!="<%- userFullName %>")
|
a.avatar(href!="<%- userProfileUrl %>", title!="<%- userFullName %>")
|
||||||
img(src!="<%- avatar %>", alt!="<%- userFullName %>")
|
img(src!="<%- avatar %>", alt!="<%- userFullName %>")
|
||||||
.activity-content
|
.activity-content
|
||||||
.activity-username
|
.activity-username
|
||||||
a.username(href="", title!="<%- userFullName %>")
|
a.username(href!="<%- userProfileUrl %>", title!="<%- userFullName %>")
|
||||||
| <%- userFullName %>
|
| <%- userFullName %>
|
||||||
span.date
|
span.date
|
||||||
| <%- creationDate %>
|
| <%- creationDate %>
|
||||||
|
|
Loading…
Reference in New Issue