Merge branch 'mr-close-btn' into 'master'
Correctly shows close button on merge requests Closes #19403 See merge request !5036
This commit is contained in:
commit
72b055d0d2
2 changed files with 8 additions and 4 deletions
|
@ -96,4 +96,8 @@ module MergeRequestsHelper
|
||||||
["#{source_path}:#{source_branch}", "#{target_path}:#{target_branch}"]
|
["#{source_path}:#{source_branch}", "#{target_path}:#{target_branch}"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def merge_request_button_visibility(merge_request, closed)
|
||||||
|
return 'hidden' if merge_request.closed? == closed || (merge_request.merged? == closed && !merge_request.closed?)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
Options
|
Options
|
||||||
.dropdown-menu.dropdown-menu-align-right.hidden-lg
|
.dropdown-menu.dropdown-menu-align-right.hidden-lg
|
||||||
%ul
|
%ul
|
||||||
%li{ class: issue_button_visibility(@merge_request, true) }
|
%li{ class: merge_request_button_visibility(@merge_request, true) }
|
||||||
= link_to 'Close', merge_request_path(@merge_request, merge_request: { state_event: :close }), method: :put, title: 'Close merge request'
|
= link_to 'Close', merge_request_path(@merge_request, merge_request: { state_event: :close }), method: :put, title: 'Close merge request'
|
||||||
%li{ class: issue_button_visibility(@merge_request, false) }
|
%li{ class: merge_request_button_visibility(@merge_request, false) }
|
||||||
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: 'reopen-mr-link', title: 'Reopen merge request'
|
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: 'reopen-mr-link', title: 'Reopen merge request'
|
||||||
%li
|
%li
|
||||||
= link_to 'Edit', edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: 'issuable-edit'
|
= link_to 'Edit', edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: 'issuable-edit'
|
||||||
= link_to 'Close', merge_request_path(@merge_request, merge_request: { state_event: :close }), method: :put, class: "hidden-xs hidden-sm btn btn-grouped btn-close #{issue_button_visibility(@merge_request, true)}", title: 'Close merge request'
|
= link_to 'Close', merge_request_path(@merge_request, merge_request: { state_event: :close }), method: :put, class: "hidden-xs hidden-sm btn btn-grouped btn-close #{merge_request_button_visibility(@merge_request, true)}", title: 'Close merge request'
|
||||||
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: "hidden-xs hidden-sm btn btn-grouped btn-reopen reopen-mr-link #{issue_button_visibility(@merge_request, false)}", title: 'Reopen merge request'
|
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: "hidden-xs hidden-sm btn btn-grouped btn-reopen reopen-mr-link #{merge_request_button_visibility(@merge_request, false)}", title: 'Reopen merge request'
|
||||||
= link_to edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: "hidden-xs hidden-sm btn btn-grouped issuable-edit" do
|
= link_to edit_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: "hidden-xs hidden-sm btn btn-grouped issuable-edit" do
|
||||||
Edit
|
Edit
|
||||||
|
|
Loading…
Reference in a new issue