Commit 39fe9b644f200d4eeee30d4bc43486d177fd9b03

Authored by Dmitriy Zaporozhets
1 parent 8de19b25

Add close issue to note actions bar

app/views/issues/show.html.haml
@@ -6,15 +6,16 @@ @@ -6,15 +6,16 @@
6 = @issue.created_at.stamp("Aug 21, 2011") 6 = @issue.created_at.stamp("Aug 21, 2011")
7 7
8 %span.pull-right 8 %span.pull-right
9 - - if can?(current_user, :admin_project, @project) || @issue.author == current_user 9 + - if can?(current_user, :modify_issue, @issue)
10 - if @issue.closed? 10 - if @issue.closed?
11 = link_to 'Reopen', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn grouped reopen_issue" 11 = link_to 'Reopen', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn grouped reopen_issue"
12 - else 12 - else
13 = link_to 'Close', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn grouped close_issue", title: "Close Issue" 13 = link_to 'Close', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn grouped close_issue", title: "Close Issue"
14 - - if can?(current_user, :admin_project, @project) || @issue.author == current_user 14 +
  15 + - if can?(current_user, :admin_issue, @issue)
15 = link_to edit_project_issue_path(@project, @issue), class: "btn grouped" do 16 = link_to edit_project_issue_path(@project, @issue), class: "btn grouped" do
16 %i.icon-edit 17 %i.icon-edit
17 - Edit 18 + Edit
18 19
19 .pull-right 20 .pull-right
20 .span3#votes= render 'votes/votes_block', votable: @issue 21 .span3#votes= render 'votes/votes_block', votable: @issue
@@ -55,5 +56,11 @@ @@ -55,5 +56,11 @@
55 = preserve do 56 = preserve do
56 = markdown @issue.description 57 = markdown @issue.description
57 58
  59 +- content_for :note_actions do
  60 + - if can?(current_user, :modify_issue, @issue)
  61 + - if @issue.closed?
  62 + = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn grouped reopen_issue"
  63 + - else
  64 + = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn grouped close_issue", title: "Close Issue"
58 65
59 .voting_notes#notes= render "notes/notes_with_form" 66 .voting_notes#notes= render "notes/notes_with_form"
app/views/notes/_form.html.haml
@@ -22,6 +22,8 @@ @@ -22,6 +22,8 @@
22 .note-form-actions 22 .note-form-actions
23 .buttons 23 .buttons
24 = f.submit 'Add Comment', class: "btn comment-btn grouped js-comment-button" 24 = f.submit 'Add Comment', class: "btn comment-btn grouped js-comment-button"
  25 + = yield(:note_actions)
  26 +
25 %a.btn.grouped.js-close-discussion-note-form Cancel 27 %a.btn.grouped.js-close-discussion-note-form Cancel
26 28
27 .note-form-option 29 .note-form-option