Set proper default image for unassigned users.

Including image locally.
stable
Andrey Antukh 2014-07-24 14:57:37 +02:00
parent 431abc551d
commit 849c5a92b3
5 changed files with 22 additions and 20 deletions

View File

@ -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)

View File

@ -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("""
<figure class="avatar">
<img src="" alt="username"/>
<figcaption>--</figcaption>
<img src="<%= imgurl %>" alt="<%- name %>"/>
<figcaption><%- name %></figcaption>
</figure>
"""
""")
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 = ->

View File

@ -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}

View File

@ -127,7 +127,7 @@ ProjectMenuDirective = ($log, $compile, $rootscope) ->
<li><a href="" title="Logout">Logout</a></li>
</ul>
<a href="" title="User preferences" class="avatar">
<img src="http://thecodeplayer.com/u/uifaces/12.jpg" alt="username"/>
<img src="/images/unnamed.png" alt="username"/>
</a>
</div>
</div>

BIN
app/images/unnamed.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB