Add user avatar kanban directive.
parent
a8f9bd0303
commit
d60660c4be
|
@ -271,3 +271,60 @@ KanbanDirective = ($repo, $rootscope) ->
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgKanban", ["$tgRepo", "$rootScope", KanbanDirective])
|
module.directive("tgKanban", ["$tgRepo", "$rootScope", KanbanDirective])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
## Kanban User Directive
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
KanbanUserDirective = ($log) ->
|
||||||
|
template = _.template("""
|
||||||
|
<figure class="avatar">
|
||||||
|
<a href="#" title="<%- name %>">
|
||||||
|
<img src="<%= imgurl %>" alt="<%- name %>" class="avatar">
|
||||||
|
<span class="assigned-to">
|
||||||
|
<span><%- name %></span>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</figure>
|
||||||
|
""")
|
||||||
|
|
||||||
|
uniqueId = _.uniqueId("user_photo")
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
if not $attrs.model?
|
||||||
|
return $log.error "KanbanUserDirective: no model attr is defined"
|
||||||
|
|
||||||
|
wtid = $scope.$watch $attrs.model, (v) ->
|
||||||
|
if not $scope.usersById?
|
||||||
|
$log.error "KanbanUserDirective requires userById set in scope."
|
||||||
|
wtid()
|
||||||
|
else
|
||||||
|
user = $scope.usersById[v]
|
||||||
|
render(user)
|
||||||
|
|
||||||
|
render = (user) ->
|
||||||
|
if user is undefined
|
||||||
|
ctx = {name: "Unassigned", imgurl: "http://thecodeplayer.com/u/uifaces/12.jpg"}
|
||||||
|
else
|
||||||
|
ctx = {name: user.full_name_display, imgurl: user.photo}
|
||||||
|
|
||||||
|
html = template(ctx)
|
||||||
|
$el.off(".#{uniqueId}")
|
||||||
|
$el.html(html)
|
||||||
|
$el.on "click.#{uniqueId}", "figure.avatar > a", (event) ->
|
||||||
|
if not $attrs.click?
|
||||||
|
return $log.error "KanbanUserDirective: No click attr is defined."
|
||||||
|
|
||||||
|
$scope.$apply ->
|
||||||
|
$scope.$eval($attrs.click)
|
||||||
|
|
||||||
|
return {
|
||||||
|
link: link
|
||||||
|
restrict: "AE"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
module.directive("tgKanbanUserAvatar", ["$log", KanbanUserDirective])
|
||||||
|
|
|
@ -2,14 +2,11 @@ div.kanban-tagline
|
||||||
a.taskboard-tag
|
a.taskboard-tag
|
||||||
div.kanban-task-inner
|
div.kanban-task-inner
|
||||||
p.task-text
|
p.task-text
|
||||||
span.task-num #37
|
span.task-num(tg-bo-ref="us.ref")
|
||||||
a.task-name(href="", title="task.subject").
|
a.task-name(href="", title="", tg-bo-html="us.subject")
|
||||||
Para IDE de desarrollo (al menos front end) yo recomiendo Aptana Studio.
|
|
||||||
figure.avatar
|
tg-kanban-user-avatar(model="us.assigned_to")
|
||||||
a(href="", title="UserName")
|
|
||||||
img.avatar(src="http://thecodeplayer.com/u/uifaces/12.jpg", alt="")
|
|
||||||
span.assigned-to
|
|
||||||
a(href="", title="Change assignation") Username
|
|
||||||
a.icon.icon-edit(href="", title="Edit", ng-click="ctrl.editTask(task)")
|
a.icon.icon-edit(href="", title="Edit", ng-click="ctrl.editTask(task)")
|
||||||
a.icon.icon-drag-h(href="", title="Drag&Drop")
|
a.icon.icon-drag-h(href="", title="Drag&Drop")
|
||||||
a.task-points(href="", title="task points", tg-bo-html="us.total_points") --
|
a.task-points(href="", title="task points", tg-bo-html="us.total_points") --
|
||||||
|
|
Loading…
Reference in New Issue