summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/merge_request.rb10
-rw-r--r--app/views/projects/issues/_discussion.html.haml6
-rw-r--r--app/views/projects/merge_requests/widget/_closed.html.haml2
-rw-r--r--app/views/projects/merge_requests/widget/_locked.html.haml2
-rw-r--r--app/views/projects/merge_requests/widget/_merged.html.haml2
5 files changed, 17 insertions, 5 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index b2cb86dc1e5..c63d0c01653 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -466,6 +466,16 @@ class MergeRequest < ActiveRecord::Base
::Gitlab::GitAccess.new(user, project).can_push_to_branch?(target_branch)
end
+ def state_human_name
+ if merged?
+ "Merged"
+ elsif closed?
+ "Closed"
+ else
+ "Open"
+ end
+ end
+
def target_sha
@target_sha ||= target_project.
repository.commit(target_branch).sha
diff --git a/app/views/projects/issues/_discussion.html.haml b/app/views/projects/issues/_discussion.html.haml
index 673020a4e30..dc434cf38c4 100644
--- a/app/views/projects/issues/_discussion.html.haml
+++ b/app/views/projects/issues/_discussion.html.haml
@@ -1,7 +1,9 @@
- content_for :note_actions do
- if can?(current_user, :update_issue, @issue)
- = link_to 'Reopen Issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-reopen btn-comment js-note-target-reopen #{issue_button_visibility(@issue, false)}", title: 'Reopen Issue'
- = link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close}, status_only: true, format: 'json'), data: {no_turbolink: true}, class: "btn btn-nr btn-grouped btn-close btn-comment js-note-target-close #{issue_button_visibility(@issue, true)}", title: 'Close Issue'
+ - if @issue.closed?
+ = link_to 'Reopen Issue', issue_path(@issue, issue: {state_event: :reopen}, status_only: true), method: :put, class: 'btn btn-nr btn-grouped btn-reopen js-note-target-reopen', title: 'Reopen Issue'
+ - else
+ = link_to 'Close Issue', issue_path(@issue, issue: {state_event: :close}, status_only: true), method: :put, class: 'btn btn-nr btn-grouped btn-close js-note-target-close', title: 'Close Issue'
#notes
= render 'projects/notes/notes_with_form'
diff --git a/app/views/projects/merge_requests/widget/_closed.html.haml b/app/views/projects/merge_requests/widget/_closed.html.haml
index 46ee22ec873..f3cc0e7e8a1 100644
--- a/app/views/projects/merge_requests/widget/_closed.html.haml
+++ b/app/views/projects/merge_requests/widget/_closed.html.haml
@@ -1,4 +1,4 @@
-.mr-state-widget.mr-state-widget-closed{class: merge_request_widget_visibility(@merge_request, 'closed')}
+.mr-state-widget
= render 'projects/merge_requests/widget/heading'
.mr-widget-body
%h4
diff --git a/app/views/projects/merge_requests/widget/_locked.html.haml b/app/views/projects/merge_requests/widget/_locked.html.haml
index 55ecd69a6ce..78d0783cba0 100644
--- a/app/views/projects/merge_requests/widget/_locked.html.haml
+++ b/app/views/projects/merge_requests/widget/_locked.html.haml
@@ -1,4 +1,4 @@
-.mr-state-widget.mr-state-widget-locked{class: merge_request_widget_visibility(@merge_request, 'locked')}
+.mr-state-widget
= render 'projects/merge_requests/widget/heading'
.mr-widget-body
%h4
diff --git a/app/views/projects/merge_requests/widget/_merged.html.haml b/app/views/projects/merge_requests/widget/_merged.html.haml
index 2bb50967023..d1d602eecdc 100644
--- a/app/views/projects/merge_requests/widget/_merged.html.haml
+++ b/app/views/projects/merge_requests/widget/_merged.html.haml
@@ -1,4 +1,4 @@
-.mr-state-widget.mr-state-widget-merged{class: merge_request_widget_visibility(@merge_request, 'merged')}
+.mr-state-widget
= render 'projects/merge_requests/widget/heading'
.mr-widget-body
%h4