Completing front permissions visualization
parent
efeee84aba
commit
f30e4e08b8
|
@ -172,11 +172,13 @@ AttachmentDirective = ($log, $repo, $confirm) ->
|
||||||
<% if (isDeprecated){ %> <span class="deprecated-file">(deprecated)</span> <% } %>
|
<% if (isDeprecated){ %> <span class="deprecated-file">(deprecated)</span> <% } %>
|
||||||
<span><%- description %></span>
|
<span><%- description %></span>
|
||||||
</div>
|
</div>
|
||||||
|
<% if (modifyPermission) {%>
|
||||||
<div class="attachment-settings">
|
<div class="attachment-settings">
|
||||||
<a class="settings icon icon-edit" href="" title="Edit"></a>
|
<a class="settings icon icon-edit" href="" title="Edit"></a>
|
||||||
<a class="settings icon icon-delete" href="" title="Delete"></a>
|
<a class="settings icon icon-delete" href="" title="Delete"></a>
|
||||||
<a class="settings icon icon-drag-v" href="" title=""Drag"></a>
|
<a class="settings icon icon-drag-v" href="" title=""Drag"></a>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
""") #TODO: i18n
|
""") #TODO: i18n
|
||||||
|
|
||||||
singleAttachmentEditable = _.template("""
|
singleAttachmentEditable = _.template("""
|
||||||
|
@ -207,6 +209,7 @@ AttachmentDirective = ($log, $repo, $confirm) ->
|
||||||
$ctrl = $el.controller()
|
$ctrl = $el.controller()
|
||||||
|
|
||||||
render = (attachment, isEditable=false) ->
|
render = (attachment, isEditable=false) ->
|
||||||
|
modifyPermission = $scope.project.my_permissions.indexOf("modify_#{$attrs.ngModel}") > -1
|
||||||
ctx = {
|
ctx = {
|
||||||
id: attachment.id
|
id: attachment.id
|
||||||
name: attachment.name
|
name: attachment.name
|
||||||
|
@ -214,6 +217,7 @@ AttachmentDirective = ($log, $repo, $confirm) ->
|
||||||
size: sizeFormat(attachment.size)
|
size: sizeFormat(attachment.size)
|
||||||
description: attachment.description
|
description: attachment.description
|
||||||
isDeprecated: attachment.is_deprecated
|
isDeprecated: attachment.is_deprecated
|
||||||
|
modifyPermission: modifyPermission
|
||||||
}
|
}
|
||||||
|
|
||||||
if isEditable
|
if isEditable
|
||||||
|
|
|
@ -290,7 +290,6 @@ KanbanUserDirective = ($log) ->
|
||||||
</figure>
|
</figure>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
uniqueId = _.uniqueId("user_photo")
|
|
||||||
clickable = false
|
clickable = false
|
||||||
|
|
||||||
link = ($scope, $el, $attrs, $model) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
|
@ -312,7 +311,6 @@ KanbanUserDirective = ($log) ->
|
||||||
ctx = {name: user.full_name_display, imgurl: user.photo, clickable: clickable}
|
ctx = {name: user.full_name_display, imgurl: user.photo, clickable: clickable}
|
||||||
|
|
||||||
html = template(ctx)
|
html = template(ctx)
|
||||||
$el.off(".#{uniqueId}")
|
|
||||||
$el.html(html)
|
$el.html(html)
|
||||||
|
|
||||||
bindOnce $scope, "project", (project) ->
|
bindOnce $scope, "project", (project) ->
|
||||||
|
|
|
@ -230,16 +230,16 @@ module.directive("tgTaskboardRowSizeFixer", TaskboardRowSizeFixer)
|
||||||
TaskboardUserDirective = ($log) ->
|
TaskboardUserDirective = ($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 %>">
|
<img src="<%= imgurl %>" alt="<%- name %>">
|
||||||
<figcaption><%- name %></figcaption>
|
<figcaption><%- name %></figcaption>
|
||||||
</a>
|
</a>
|
||||||
</figure>
|
</figure>
|
||||||
""")
|
""")
|
||||||
|
|
||||||
uniqueId = _.uniqueId("user_photo")
|
clickable = false
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs, $model) ->
|
||||||
if not $attrs.tgTaskboardUserAvatar?
|
if not $attrs.tgTaskboardUserAvatar?
|
||||||
return $log.error "TaskboardUserDirective: no attr is defined"
|
return $log.error "TaskboardUserDirective: no attr is defined"
|
||||||
|
|
||||||
|
@ -253,22 +253,23 @@ TaskboardUserDirective = ($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.html(html)
|
$el.html(html)
|
||||||
|
|
||||||
$el.on "click.#{uniqueId}", "figure.avatar > a", (event) ->
|
|
||||||
if not $attrs.click?
|
|
||||||
return $log.error "TaskboardUserDirective: No click attr is defined."
|
|
||||||
|
|
||||||
$scope.$apply ->
|
bindOnce $scope, "project", (project) ->
|
||||||
$scope.$eval($attrs.click)
|
if project.my_permissions.indexOf("modify_task") > -1
|
||||||
|
clickable = true
|
||||||
|
$el.on "click", (event) =>
|
||||||
|
us = $model.$modelValue
|
||||||
|
$ctrl = $el.controller()
|
||||||
|
$ctrl.editTaskAssignedTo(us)
|
||||||
|
|
||||||
return {link: link}
|
return {link: link, require:"ngModel"}
|
||||||
|
|
||||||
|
|
||||||
module.directive("tgTaskboardUserAvatar", ["$log", TaskboardUserDirective])
|
module.directive("tgTaskboardUserAvatar", ["$log", TaskboardUserDirective])
|
||||||
|
|
|
@ -36,7 +36,7 @@ block content
|
||||||
|
|
||||||
section.us-detail-settings
|
section.us-detail-settings
|
||||||
a.button.button-gray.clickable(ng-show="!issue.is_blocked", ng-click="ctrl.block()") Block
|
a.button.button-gray.clickable(ng-show="!issue.is_blocked", ng-click="ctrl.block()") Block
|
||||||
a.button.button-red(ng-click="ctrl.delete()", href="") Delete
|
a.button.button-red(tg-check-permission, permission="delete_issue", ng-click="ctrl.delete()", href="") Delete
|
||||||
|
|
||||||
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking issue", ng-model="issue")
|
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking issue", ng-model="issue")
|
||||||
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
||||||
|
|
|
@ -9,7 +9,7 @@ block content
|
||||||
div.main.us-detail
|
div.main.us-detail
|
||||||
div.us-detail-header
|
div.us-detail-header
|
||||||
include views/components/mainTitle
|
include views/components/mainTitle
|
||||||
a.button.button-green(href="", title="Edit", tg-nav="project-issues-detail-edit:project=project.slug,ref=issue.ref") Edit
|
a.button.button-green(tg-check-permission, permission="modify_issue", href="", title="Edit", tg-nav="project-issues-detail-edit:project=project.slug,ref=issue.ref") Edit
|
||||||
|
|
||||||
section.us-story-main-data
|
section.us-story-main-data
|
||||||
div.us-title(ng-class="{blocked: issue.is_blocked}")
|
div.us-title(ng-class="{blocked: issue.is_blocked}")
|
||||||
|
@ -42,6 +42,7 @@ block content
|
||||||
span.icon.icon-issues
|
span.icon.icon-issues
|
||||||
span.tab-title Activity
|
span.tab-title Activity
|
||||||
|
|
||||||
|
- var commentModel = "issue"
|
||||||
include views/modules/comments
|
include views/modules/comments
|
||||||
include views/modules/activity
|
include views/modules/activity
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ block content
|
||||||
label.clickable.button.button-gray(for="is-iocaine", ng-class="{true:'active', false:''}[task.is_iocaine]") Iocaine
|
label.clickable.button.button-gray(for="is-iocaine", ng-class="{true:'active', false:''}[task.is_iocaine]") Iocaine
|
||||||
input(ng-model="task.is_iocaine", type="checkbox", id="is-iocaine", name="is-iocaine")
|
input(ng-model="task.is_iocaine", type="checkbox", id="is-iocaine", name="is-iocaine")
|
||||||
|
|
||||||
a.button.button-gray.clickable(ng-show="!task.is_blocked", ng-click="ctrl.block()") Block
|
a.button.button-gray.clickable(ng-show="!task.is_blocked", ng-click="ctrl.block()") Block
|
||||||
a.button.button-red(ng-click="ctrl.delete()", href="") Delete
|
a.button.button-red(tg-check-permission, permission="delete_task", ng-click="ctrl.delete()", href="") Delete
|
||||||
|
|
||||||
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking task", ng-model="task")
|
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking task", ng-model="task")
|
||||||
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
||||||
|
|
|
@ -9,7 +9,7 @@ block content
|
||||||
div.main.us-detail
|
div.main.us-detail
|
||||||
div.us-detail-header
|
div.us-detail-header
|
||||||
include views/components/mainTitle
|
include views/components/mainTitle
|
||||||
a.button.button-green(href="", title="Edit", tg-nav="project-tasks-detail-edit:project=project.slug,ref=task.ref") Edit
|
a.button.button-green(tg-check-permission, permission="modify_task", href="", title="Edit", tg-nav="project-tasks-detail-edit:project=project.slug,ref=task.ref") Edit
|
||||||
|
|
||||||
section.us-story-main-data
|
section.us-story-main-data
|
||||||
div.us-title(ng-class="{blocked: task.is_blocked}")
|
div.us-title(ng-class="{blocked: task.is_blocked}")
|
||||||
|
@ -42,6 +42,7 @@ block content
|
||||||
span.icon.icon-issues
|
span.icon.icon-issues
|
||||||
span.tab-title Activity
|
span.tab-title Activity
|
||||||
|
|
||||||
|
- var commentModel = "task"
|
||||||
include views/modules/comments
|
include views/modules/comments
|
||||||
include views/modules/activity
|
include views/modules/activity
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ block content
|
||||||
input(ng-model="us.team_requirement", type="checkbox", id="team-requirement", name="team-requirement")
|
input(ng-model="us.team_requirement", type="checkbox", id="team-requirement", name="team-requirement")
|
||||||
|
|
||||||
a.button.button-gray.clickable(ng-show="!us.is_blocked", ng-click="ctrl.block()") Block
|
a.button.button-gray.clickable(ng-show="!us.is_blocked", ng-click="ctrl.block()") Block
|
||||||
a.button.button-red(ng-click="ctrl.delete()", href="") Delete
|
a.button.button-red(tg-check-permission, permission="delete_us", ng-click="ctrl.delete()", href="") Delete
|
||||||
|
|
||||||
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking issue", ng-model="us")
|
div.lightbox.lightbox_block.hidden(tg-lb-block, title="Blocking issue", ng-model="us")
|
||||||
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
div.lightbox.lightbox_select_user.hidden(tg-lb-assignedto)
|
||||||
|
|
|
@ -9,7 +9,7 @@ block content
|
||||||
div.main.us-detail
|
div.main.us-detail
|
||||||
div.us-detail-header
|
div.us-detail-header
|
||||||
include views/components/mainTitle
|
include views/components/mainTitle
|
||||||
a.button.button-green(href="", title="Edit", tg-nav="project-userstories-detail-edit:project=project.slug,ref=us.ref") Edit
|
a.button.button-green(tg-check-permission, permission="modify_us", href="", title="Edit", tg-nav="project-userstories-detail-edit:project=project.slug,ref=us.ref") Edit
|
||||||
|
|
||||||
section.us-story-main-data
|
section.us-story-main-data
|
||||||
div.us-title(ng-class="{blocked: us.is_blocked}")
|
div.us-title(ng-class="{blocked: us.is_blocked}")
|
||||||
|
@ -43,6 +43,8 @@ block content
|
||||||
a(href="#")
|
a(href="#")
|
||||||
span.icon.icon-issues
|
span.icon.icon-issues
|
||||||
span.tab-title Activity
|
span.tab-title Activity
|
||||||
|
|
||||||
|
- var commentModel = "us"
|
||||||
include views/modules/comments
|
include views/modules/comments
|
||||||
include views/modules/activity
|
include views/modules/activity
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
div.taskboard-tagline
|
div.taskboard-tagline
|
||||||
a.taskboard-tag(ng-repeat="tag in task.tags", href="", tg-bo-title="tag", tg-colorize-tag="tag")
|
a.taskboard-tag(ng-repeat="tag in task.tags", href="", tg-bo-title="tag", tg-colorize-tag="tag")
|
||||||
div.taskboard-task-inner
|
div.taskboard-task-inner
|
||||||
div(tg-taskboard-user-avatar="task.assigned_to", click="ctrl.editTaskAssignedTo(task)")
|
div(tg-taskboard-user-avatar="task.assigned_to", ng-model="task", click="ctrl.editTaskAssignedTo(task)")
|
||||||
p.taskboard-text
|
p.taskboard-text
|
||||||
span.task-assigned Username
|
span.task-assigned Username
|
||||||
span.task-num(tg-bo-ref="task.ref")
|
span.task-num(tg-bo-ref="task.ref")
|
||||||
a.task-name(href="", title="See task details", tg-bind-html="task.subject",
|
a.task-name(href="", title="See task details", tg-bind-html="task.subject",
|
||||||
tg-nav="project-tasks-detail:project=project.slug,ref=task.ref")
|
tg-nav="project-tasks-detail:project=project.slug,ref=task.ref")
|
||||||
a.icon.icon-edit(href="", title="Edit task", ng-click="ctrl.editTask(task)")
|
a.icon.icon-edit(tg-check-permission, permission="modify_task",
|
||||||
a.icon.icon-drag-h(href="", title="Drag&Drop")
|
href="", title="Edit task", ng-click="ctrl.editTask(task)")
|
||||||
|
|
||||||
|
a.icon.icon-drag-h(tg-check-permission, permission="modify_task",
|
||||||
|
href="", title="Drag&Drop")
|
||||||
|
|
|
@ -7,13 +7,13 @@ section.attachments(tg-attachments, ng-model=attachModel, ng-if="#{attachModel}.
|
||||||
span.icon.icon-attachments
|
span.icon.icon-attachments
|
||||||
span.attachments-num 0
|
span.attachments-num 0
|
||||||
span.attachments-text attachments
|
span.attachments-text attachments
|
||||||
a.button.button-gray.add-attach(href="", title="Add new attachment")
|
a.button.button-gray.add-attach(tg-check-permission, permission="modify_"+attachModel, href="", title="Add new attachment")
|
||||||
span +new file
|
span +new file
|
||||||
input.hidden.add-attach(type="file", multiple="multiple")
|
input.hidden.add-attach(type="file", multiple="multiple")
|
||||||
|
|
||||||
div.attachment-body.sortable
|
div.attachment-body.sortable
|
||||||
div.hidden.single-attachment(ng-repeat="attach in attachments",
|
div.hidden.single-attachment(ng-repeat="attach in attachments",
|
||||||
tg-attachment="attach")
|
tg-attachment="attach", ng-model=attachModel)
|
||||||
|
|
||||||
//- See modules/common/attachments.coffee - AttachmentDirective
|
//- See modules/common/attachments.coffee - AttachmentDirective
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
//- NOTE: You must to define 'var commentModel' with the object model
|
||||||
|
|
||||||
section.us-comments
|
section.us-comments
|
||||||
div.add-comment
|
div.add-comment(tg-check-permission, permission="modify_"+commentModel)
|
||||||
textarea(placeholder="Write here a new commet", ng-model="commentModel.comment")
|
textarea(placeholder="Write here a new commet", ng-model="commentModel.comment")
|
||||||
a.button.button-green(href="", title="Comment") Comment
|
a.button.button-green(href="", title="Comment") Comment
|
||||||
div.comment-list
|
div.comment-list
|
||||||
|
|
|
@ -5,7 +5,7 @@ div.kanban-table
|
||||||
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(tg-check-permission, permission="add_us", 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(tg-check-permission, permission="add_us",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)
|
||||||
|
|
|
@ -19,9 +19,11 @@ div.taskboard-table
|
||||||
span(ng-bind="us.total_points")
|
span(ng-bind="us.total_points")
|
||||||
span points
|
span points
|
||||||
|
|
||||||
a.icon.icon-plus(href="", title="Add new task",
|
a.icon.icon-plus(tg-check-permission, permission="add_task",
|
||||||
|
href="", title="Add new task",
|
||||||
ng-click="ctrl.addNewTask('standard', us)")
|
ng-click="ctrl.addNewTask('standard', us)")
|
||||||
a.icon.icon-bulk(href="", title="Add new tasks in bulk",
|
a.icon.icon-bulk(tg-check-permission, permission="add_task",
|
||||||
|
href="", title="Add new tasks in bulk",
|
||||||
ng-click="ctrl.addNewTask('bulk', us)")
|
ng-click="ctrl.addNewTask('bulk', us)")
|
||||||
|
|
||||||
div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id",
|
div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id",
|
||||||
|
@ -34,9 +36,11 @@ div.taskboard-table
|
||||||
div.taskboard-userstory-box.task-column
|
div.taskboard-userstory-box.task-column
|
||||||
h3.us-title
|
h3.us-title
|
||||||
span Unassigned tasks
|
span Unassigned tasks
|
||||||
a.icon.icon-plus(href="", title="Add new task",
|
a.icon.icon-plus(tg-check-permission, permission="add_task",
|
||||||
|
href="", title="Add new task",
|
||||||
ng-click="ctrl.addNewTask('standard', us)")
|
ng-click="ctrl.addNewTask('standard', us)")
|
||||||
a.icon.icon-bulk(href="", title="Add new tasks in bulk",
|
a.icon.icon-bulk(tg-check-permission, permission="add_task",
|
||||||
|
href="", title="Add new tasks in bulk",
|
||||||
ng-click="ctrl.addNewTask('bulk', us)")
|
ng-click="ctrl.addNewTask('bulk', us)")
|
||||||
|
|
||||||
div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id", tg-taskboard-sortable)
|
div.taskboard-tasks-box.task-column(ng-repeat="st in taskStatusList track by st.id", tg-taskboard-sortable)
|
||||||
|
|
Loading…
Reference in New Issue