From 849c5a92b3b6e36753c4b693039191c89736da5b Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 24 Jul 2014 14:57:37 +0200 Subject: [PATCH] Set proper default image for unassigned users. Including image locally. --- app/coffee/modules/admin/memberships.coffee | 2 +- app/coffee/modules/common/components.coffee | 36 +++++++++++--------- app/coffee/modules/kanban/main.coffee | 2 +- app/coffee/modules/nav.coffee | 2 +- app/images/unnamed.png | Bin 0 -> 1250 bytes 5 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 app/images/unnamed.png diff --git a/app/coffee/modules/admin/memberships.coffee b/app/coffee/modules/admin/memberships.coffee index 0662a240..ba12912f 100644 --- a/app/coffee/modules/admin/memberships.coffee +++ b/app/coffee/modules/admin/memberships.coffee @@ -236,7 +236,7 @@ MembershipsRowAvatarDirective = ($log) -> ctx = { full_name: if member.full_name then member.full_name else "" email: member.email - imgurl: if member.photo then member.photo else "http://thecodeplayer.com/u/uifaces/12.jpg" + imgurl: if member.photo then member.photo else "/image/unnamed.png" } html = template(ctx) diff --git a/app/coffee/modules/common/components.coffee b/app/coffee/modules/common/components.coffee index b67cfb4c..c8bfa64d 100644 --- a/app/coffee/modules/common/components.coffee +++ b/app/coffee/modules/common/components.coffee @@ -255,7 +255,10 @@ module.directive("tgAssignedTo", ["$rootScope", "$tgConfirm", AssignedToDirectiv ############################################################################# -## List directives (Issues List, Search) +## Common list directives +############################################################################# +## NOTE: These directives are used in issues and search and are +## completely bindonce, they only serves for visualization of data. ############################################################################# ListItemIssueStatusDirective = -> @@ -286,27 +289,26 @@ ListItemUsStatusDirective = -> ListItemAssignedtoDirective = -> - template = """ + template = _.template("""
- username -
--
+ <%- name %> +
<%- name %>
- """ + """) link = ($scope, $el, $attrs) -> - issue = $scope.$eval($attrs.tgListitemAssignedto) - if issue.assigned_to is null - $el.find("figcaption").html("Unassigned") - else - bindOnce $scope, "membersById", (membersById) -> - member = membersById[issue.assigned_to] - $el.find("figcaption").html(member.full_name) - $el.find("img").attr("src", member.photo) + bindOnce $scope, "membersById", (membersById) -> + item = $scope.$eval($attrs.tgListitemAssignedto) + ctx = {name: "Unassigned", imgurl: "/images/unnamed.png"} - return { - template: template - link:link - } + member = membersById[item.assigned_to] + if member + ctx.imgurl = member.photo + ctx.name = member.full_name + + $el.html(template(ctx)) + + return {link:link} ListItemPriorityDirective = -> diff --git a/app/coffee/modules/kanban/main.coffee b/app/coffee/modules/kanban/main.coffee index 3784edef..f48f93eb 100644 --- a/app/coffee/modules/kanban/main.coffee +++ b/app/coffee/modules/kanban/main.coffee @@ -244,7 +244,7 @@ KanbanUserDirective = ($log) -> render = (user) -> if user is undefined - ctx = {name: "Unassigned", imgurl: "http://thecodeplayer.com/u/uifaces/12.jpg"} + ctx = {name: "Unassigned", imgurl: "/images/unnamed.png"} else ctx = {name: user.full_name_display, imgurl: user.photo} diff --git a/app/coffee/modules/nav.coffee b/app/coffee/modules/nav.coffee index 735194e7..1022dacb 100644 --- a/app/coffee/modules/nav.coffee +++ b/app/coffee/modules/nav.coffee @@ -127,7 +127,7 @@ ProjectMenuDirective = ($log, $compile, $rootscope) ->
  • Logout
  • - username + username diff --git a/app/images/unnamed.png b/app/images/unnamed.png new file mode 100644 index 0000000000000000000000000000000000000000..a8bce2908cbb560e36248ae98d51de8229d68b02 GIT binary patch literal 1250 zcmeAS@N?(olHy`uVBq!ia0y~yU}ywk4mJh`hUW`z1~4!%uoOFahH!9jaMW<5bTBZm z%=C0|45^s&_U?J@nrfNjAFt1mOmCZb)SOpr^UlaSlXQ+8it-gR6Z1ONw`rq*wCmj< zuRn}IVme2Tbxrzv_e9glM?teroY&Yqp|E%6?j3idzu!Bk{$1vHx{bW_*SY(|#> z*X8D}m6DROv7BZq_~rZe-@lgJTDE?@e{yp2Jekw8E<0+7a8umZ+FYKKQ)UZXyufP(dYX6`{R2P3JL-` zT@GdJU%PhgB*86Px2{~i{Q2GU`}gdrF>PvWWZbzf+vNDSZ`48 z#MHr|0Ag%<(X~+A%*-q#I5>IBw|DQ(ZMQTtH}BP#PTw4P|Jjez+q)8yl9XNus(4<$ zeA%)81OFU82NngU4vqyze~xWfxX`h?yL+GP{=IweX2jaaUB7T)LVmG{xp{TjnhCnw zcloPLzIONchc|C@UKsWiSTP7TfNVYWVL7wssi#F%6%`+z-spS0V$q^UcS~EH4o?63 zH(;7z%I3(q^XC03dXr(2^+#!nu7xZ#UXfylwc=<&ZEb9JcJ{H?$`d<2>SllXxo6(| z`Sw<~X3HEm+*cpu?cKd>*|M6MhrJtJ3knMt`ltzC`8NO1mpm26$0ZC(3@DLZS+Oyr zt}gEP@83nS;TJPPHb%U8-#>Ng)KzQNgqTQ8eZ8wFHr(CaJubKR|H;i9mtJn+*KLhvp4r~fa2Ywtiv91{v1iYkRjXEo%loTMe)Z~A)z^d-ccrjzu!=y}iA5{vorrhV$eKbRP`~4^Q86t#HnPy!^x8SrnKAaOJYpKU$BD z9&HT^509_?^X}a{;pIPXoic0kQCqxo=gtMkH!v+{2IW(DszqTeu#b2BbF`be)oEeX z_0oE?*#AF%{FuCCiFkE=sK38|_`28s(l%WyoO56G@2k%qs(%@u^fAbBvuxpJU|?YI MboFyt=akR{0B>19-2eap literal 0 HcmV?d00001