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