Adding kanban layout permissions check
parent
86aa54997d
commit
8a5bd7164f
|
@ -281,7 +281,7 @@ module.directive("tgKanbanWipLimit", KanbanWipLimitDirective)
|
|||
KanbanUserDirective = ($log) ->
|
||||
template = _.template("""
|
||||
<figure class="avatar">
|
||||
<a href="#" title="<%- name %>">
|
||||
<a href="#" title="<%- name %>" <% if (!clickable) {%>class="not-clickable"<% } %>>
|
||||
<img src="<%= imgurl %>" alt="<%- name %>" class="avatar">
|
||||
<span class="assigned-to">
|
||||
<span><%- name %></span>
|
||||
|
@ -291,8 +291,9 @@ KanbanUserDirective = ($log) ->
|
|||
""")
|
||||
|
||||
uniqueId = _.uniqueId("user_photo")
|
||||
clickable = false
|
||||
|
||||
link = ($scope, $el, $attrs) ->
|
||||
link = ($scope, $el, $attrs, $model) ->
|
||||
if not $attrs.tgKanbanUserAvatar
|
||||
return $log.error "KanbanUserDirective: no attr is defined"
|
||||
|
||||
|
@ -306,21 +307,23 @@ KanbanUserDirective = ($log) ->
|
|||
|
||||
render = (user) ->
|
||||
if user is undefined
|
||||
ctx = {name: "Unassigned", imgurl: "/images/unnamed.png"}
|
||||
ctx = {name: "Unassigned", imgurl: "/images/unnamed.png", clickable: clickable}
|
||||
else
|
||||
ctx = {name: user.full_name_display, imgurl: user.photo}
|
||||
ctx = {name: user.full_name_display, imgurl: user.photo, clickable: clickable}
|
||||
|
||||
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)
|
||||
bindOnce $scope, "project", (project) ->
|
||||
if project.my_permissions.indexOf("modify_us") > -1
|
||||
clickable = true
|
||||
$el.on "click", (event) =>
|
||||
us = $model.$modelValue
|
||||
$ctrl = $el.controller()
|
||||
$ctrl.changeUsAssignedTo(us)
|
||||
|
||||
return {link: link}
|
||||
return {link: link, require:"ngModel"}
|
||||
|
||||
|
||||
module.directive("tgKanbanUserAvatar", ["$log", KanbanUserDirective])
|
||||
|
|
|
@ -15,8 +15,8 @@ block content
|
|||
// a.button.button-trans(href="", title="Filter")
|
||||
// span.icon.icon-filter
|
||||
// span Filters
|
||||
a.button.button-gray(href="", title="Filter")
|
||||
span Show Statistics
|
||||
//a.button.button-gray(href="", title="Filter")
|
||||
// span Show Statistics
|
||||
//-include views/components/large-summary
|
||||
//-include views/modules/burndown
|
||||
//-include views/modules/list-filters-kanban
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
div.kanban-tagline
|
||||
a.taskboard-tag(ng-repeat="tag in us.tags", href="", tg-bo-title="tag", tg-colorize-tag="tag")
|
||||
div.kanban-task-inner
|
||||
div(tg-kanban-user-avatar="us.assigned_to", click="ctrl.changeUsAssignedTo(us)")
|
||||
div(tg-kanban-user-avatar="us.assigned_to", ng-model="us")
|
||||
div.task-text
|
||||
span.task-assigned Username
|
||||
span.task-num(tg-bo-ref="us.ref")
|
||||
|
@ -10,5 +10,5 @@ div.kanban-task-inner
|
|||
p.task-points
|
||||
span(tg-bind-html="us.total_points") --
|
||||
span points
|
||||
a.icon.icon-edit(href="", title="Edit", ng-click="ctrl.editUserStory(us)")
|
||||
a.icon.icon-drag-h(href="", title="Drag&Drop")
|
||||
a.icon.icon-edit(tg-check-permission, permission="modify_us", href="", title="Edit", ng-click="ctrl.editUserStory(us)")
|
||||
a.icon.icon-drag-h(tg-check-permission, permission="modify_us", href="", title="Drag&Drop")
|
||||
|
|
|
@ -4,8 +4,8 @@ div.kanban-table
|
|||
h2.task-colum_name(ng-repeat="s in usStatusList track by s.id",
|
||||
ng-style="{'border-top-color':s.color}")
|
||||
span(tg-bo-bind="s.name")
|
||||
a.icon.icon-plus(href="", title="Add New task", ng-click="ctrl.addNewUs('standard', s.id)")
|
||||
a.icon.icon-bulk(href="", title="Add New bulk", ng-click="ctrl.addNewUs('bulk', s.id)")
|
||||
a.icon.icon-plus(tg-check-permission, permission="add_us", href="", title="Add New task", ng-click="ctrl.addNewUs('standard', s.id)")
|
||||
a.icon.icon-bulk(tg-check-permission, permission="add_us",href="", title="Add New bulk", ng-click="ctrl.addNewUs('bulk', s.id)")
|
||||
|
||||
div.kanban-table-body
|
||||
div.kanban-table-inner(tg-kanban-row-size-fixer)
|
||||
|
|
Loading…
Reference in New Issue