Commit 477ae66b authored by Rubén Dávila's avatar Rubén Dávila Committed by Robert Speicher

Move revert link to the MR widget section plus some refactor.

parent 2ea5b37f
...@@ -123,14 +123,14 @@ module CommitsHelper ...@@ -123,14 +123,14 @@ module CommitsHelper
) )
end end
def revert_commit_link(show_modal_condition, continue_to_path) def revert_commit_link(show_modal_condition, continue_to_path, btn_class: nil)
return unless current_user return unless current_user
if show_modal_condition if show_modal_condition
link_to('Revert', '#modal-revert-commit', link_to('Revert', '#modal-revert-commit',
'data-target' => '#modal-revert-commit', 'data-target' => '#modal-revert-commit',
'data-toggle' => 'modal', 'data-toggle' => 'modal',
class: 'btn btn-grouped btn-close', class: "btn btn-close btn-#{btn_class}",
title: 'Create merge request to revert commit' title: 'Create merge request to revert commit'
) )
else else
......
...@@ -18,6 +18,3 @@ ...@@ -18,6 +18,3 @@
Edit Edit
- if @merge_request.closed? - if @merge_request.closed?
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: 'btn btn-nr btn-grouped btn-reopen reopen-mr-link', title: "Reopen merge request" = link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: 'btn btn-nr btn-grouped btn-reopen reopen-mr-link', title: "Reopen merge request"
- if @merge_request.merged? && @merge_request.merge_commit_sha.present?
= revert_commit_link(can_update_merge_request?, namespace_project_merge_request_path(@project.namespace, @project, @merge_request))
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
- if @merge_request.merge_event - if @merge_request.merge_event
by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)} by #{link_to_member(@project, @merge_request.merge_event.author, avatar: true)}
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)} #{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
- if @merge_request.merge_commit_sha.present?
= revert_commit_link(can_update_merge_request?, namespace_project_merge_request_path(@project.namespace, @project, @merge_request), btn_class: 'sm')
%div %div
- if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true') - if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true')
The changes were merged into The changes were merged into
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment