Hide resolve button when not allowed
This commit is contained in:
parent
d76d051b22
commit
3b06987c34
2 changed files with 48 additions and 23 deletions
|
@ -1,4 +1,8 @@
|
|||
%resolve-all{ ":namespace" => "'#{discussion.project.namespace.path}/#{discussion.project.path}'", ":discussion-id" => "'#{discussion.id}'", "inline-template" => true, "v-cloak" => true }
|
||||
%button.btn.btn-default{ type: "button", "@click" => "resolve", ":disabled" => "loading" }
|
||||
= icon("spinner spin", "v-show" => "loading")
|
||||
{{ buttonText }}
|
||||
- if discussion.can_resolve?(current_user)
|
||||
%resolve-all{ ":namespace" => "'#{discussion.project.namespace.path}/#{discussion.project.path}'",
|
||||
":discussion-id" => "'#{discussion.id}'",
|
||||
"inline-template" => true,
|
||||
"v-cloak" => true }
|
||||
%button.btn.btn-default{ type: "button", "@click" => "resolve", ":disabled" => "loading" }
|
||||
= icon("spinner spin", "v-show" => "loading")
|
||||
{{ buttonText }}
|
||||
|
|
|
@ -16,25 +16,46 @@
|
|||
commented
|
||||
%a{ href: "##{dom_id(note)}" }
|
||||
= time_ago_with_tooltip(note.created_at, placement: 'bottom', html_class: 'note-created-ago')
|
||||
.note-actions
|
||||
- access = note_max_access_for_user(note)
|
||||
- if access and not note.system
|
||||
%span.note-role.hidden-xs= access
|
||||
- if !note.system && note.new_diff_note? && current_user
|
||||
%resolve-btn{ ":namespace" => "'#{note.project.namespace.path}/#{note.project.path}'", ":discussion-id" => "'#{note.discussion_id}'", ":note-id" => note.id, ":resolved" => "false", "inline-template" => true, "v-ref:note_#{note.id}" => true }
|
||||
.note-action-button
|
||||
= icon("spin spinner", "v-show" => "loading")
|
||||
%button.line-resolve-btn{ type: "button", ":class" => "{ 'is-active': isResolved }", ":aria-label" => "buttonText", "@click" => "resolve", ":title" => "buttonText", "v-show" => "!loading", "v-el:button" => true }
|
||||
= icon("check")
|
||||
- if current_user and not note.system
|
||||
= link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do
|
||||
= icon('spinner spin')
|
||||
= icon('smile-o')
|
||||
- if note_editable
|
||||
= link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
|
||||
= icon('pencil')
|
||||
= link_to namespace_project_note_path(note.project.namespace, note.project, note), title: 'Remove comment', method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: 'note-action-button hidden-xs js-note-delete danger' do
|
||||
= icon('trash-o')
|
||||
- unless note.system?
|
||||
.note-actions
|
||||
- access = note_max_access_for_user(note)
|
||||
- if access
|
||||
%span.note-role.hidden-xs= access
|
||||
|
||||
- if note.resolvable?
|
||||
- if can?(current_user, :resolve_note, note)
|
||||
%resolve-btn{ ":namespace" => "'#{note.project.namespace.path}/#{note.project.path}'",
|
||||
":discussion-id" => "'#{note.discussion_id}'",
|
||||
":note-id" => note.id,
|
||||
":resolved" => note.resolved?,
|
||||
"inline-template" => true,
|
||||
"v-ref:note_#{note.id}" => true }
|
||||
|
||||
.note-action-button
|
||||
= icon("spin spinner", "v-show" => "loading")
|
||||
%button.line-resolve-btn{ type: "button",
|
||||
":class" => "{ 'is-active': isResolved }",
|
||||
":aria-label" => "buttonText",
|
||||
"@click" => "resolve",
|
||||
":title" => "buttonText",
|
||||
"v-show" => "!loading",
|
||||
"v-el:button" => true }
|
||||
|
||||
= icon("check")
|
||||
- else
|
||||
-# TODO: Just render status
|
||||
|
||||
- if current_user
|
||||
- if note.emoji_awardable?
|
||||
= link_to '#', title: 'Award Emoji', class: 'note-action-button note-emoji-button js-add-award js-note-emoji', data: { position: 'right' } do
|
||||
= icon('spinner spin')
|
||||
= icon('smile-o')
|
||||
|
||||
- if note_editable
|
||||
= link_to '#', title: 'Edit comment', class: 'note-action-button js-note-edit' do
|
||||
= icon('pencil')
|
||||
= link_to namespace_project_note_path(note.project.namespace, note.project, note), title: 'Remove comment', method: :delete, data: { confirm: 'Are you sure you want to remove this comment?' }, remote: true, class: 'note-action-button hidden-xs js-note-delete danger' do
|
||||
= icon('trash-o')
|
||||
.note-body{class: note_editable ? 'js-task-list-container' : ''}
|
||||
.note-text.md
|
||||
= preserve do
|
||||
|
|
Loading…
Reference in a new issue