Commit 93a496d2 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'mr-buttons-update' into 'master'

Fixed issue with MR buttons being in a group

## What does this MR do?

Fixes design issue with the buttons in the merge request widget

## Screenshots (if relevant)

![Screen_Shot_2016-06-09_at_14.13.32](/uploads/44ac4175f5a97a8d7baf97be6eebc684/Screen_Shot_2016-06-09_at_14.13.32.png)


See merge request !4562
parents 2f459a03 22e97dd7
...@@ -53,9 +53,13 @@ class Dispatcher ...@@ -53,9 +53,13 @@ class Dispatcher
new Diff() new Diff()
shortcut_handler = new ShortcutsIssuable(true) shortcut_handler = new ShortcutsIssuable(true)
new ZenMode() new ZenMode()
new MergedButtons()
when 'projects:merge_requests:commits', 'projects:merge_requests:builds'
new MergedButtons()
when "projects:merge_requests:diffs" when "projects:merge_requests:diffs"
new Diff() new Diff()
new ZenMode() new ZenMode()
new MergedButtons()
when 'projects:merge_requests:index' when 'projects:merge_requests:index'
shortcut_handler = new ShortcutsNavigation() shortcut_handler = new ShortcutsNavigation()
Issuable.init() Issuable.init()
......
class @MergedButtons
constructor: ->
@$removeBranchWidget = $('.remove_source_branch_widget')
@$removeBranchProgress = $('.remove_source_branch_in_progress')
@$removeBranchFailed = $('.remove_source_branch_widget.failed')
@cleanEventListeners()
@initEventListeners()
cleanEventListeners: ->
$(document).off 'click', '.remove_source_branch'
$(document).off 'ajax:success', '.remove_source_branch'
$(document).off 'ajax:error', '.remove_source_branch'
initEventListeners: ->
$(document).on 'click', '.remove_source_branch', @removeSourceBranch
$(document).on 'ajax:success', '.remove_source_branch', @removeBranchSuccess
$(document).on 'ajax:error', '.remove_source_branch', @removeBranchError
removeSourceBranch: =>
@$removeBranchWidget.hide()
@$removeBranchProgress.show()
removeBranchSuccess: ->
location.reload()
removeBranchError: ->
@$removeBranchWidget.hide()
@$removeBranchProgress.hide()
@$removeBranchFailed.show()
...@@ -313,3 +313,13 @@ ...@@ -313,3 +313,13 @@
} }
} }
} }
.merged-buttons {
.btn {
float: left;
&:not(:last-child) {
margin-right: 10px;
}
}
}
...@@ -129,7 +129,7 @@ module CommitsHelper ...@@ -129,7 +129,7 @@ module CommitsHelper
tooltip = "Revert this #{commit.change_type_title} in a new merge request" if has_tooltip tooltip = "Revert this #{commit.change_type_title} in a new merge request" if has_tooltip
if can_collaborate_with_project? if can_collaborate_with_project?
btn_class = "btn btn-grouped btn-close btn-#{btn_class}" unless btn_class.nil? btn_class = "btn btn-warning btn-#{btn_class}" unless btn_class.nil?
link_to 'Revert', '#modal-revert-commit', 'data-toggle' => 'modal', 'data-container' => 'body', title: (tooltip if has_tooltip), class: "#{btn_class} #{'has-tooltip' if has_tooltip}" link_to 'Revert', '#modal-revert-commit', 'data-toggle' => 'modal', 'data-container' => 'body', title: (tooltip if has_tooltip), class: "#{btn_class} #{'has-tooltip' if has_tooltip}"
elsif can?(current_user, :fork_project, @project) elsif can?(current_user, :fork_project, @project)
continue_params = { continue_params = {
...@@ -141,7 +141,7 @@ module CommitsHelper ...@@ -141,7 +141,7 @@ module CommitsHelper
namespace_key: current_user.namespace.id, namespace_key: current_user.namespace.id,
continue: continue_params) continue: continue_params)
btn_class = "btn btn-grouped btn-close" unless btn_class.nil? btn_class = "btn btn-grouped btn-warning" unless btn_class.nil?
link_to 'Revert', fork_path, class: btn_class, method: :post, 'data-toggle' => 'tooltip', 'data-container' => 'body', title: (tooltip if has_tooltip) link_to 'Revert', fork_path, class: btn_class, method: :post, 'data-toggle' => 'tooltip', 'data-container' => 'body', title: (tooltip if has_tooltip)
end end
...@@ -153,7 +153,7 @@ module CommitsHelper ...@@ -153,7 +153,7 @@ module CommitsHelper
tooltip = "Cherry-pick this #{commit.change_type_title} in a new merge request" tooltip = "Cherry-pick this #{commit.change_type_title} in a new merge request"
if can_collaborate_with_project? if can_collaborate_with_project?
btn_class = "btn btn-default btn-grouped btn-#{btn_class}" unless btn_class.nil? btn_class = "btn btn-default btn-#{btn_class}" unless btn_class.nil?
link_to 'Cherry-pick', '#modal-cherry-pick-commit', 'data-toggle' => 'modal', 'data-container' => 'body', title: (tooltip if has_tooltip), class: "#{btn_class} #{'has-tooltip' if has_tooltip}" link_to 'Cherry-pick', '#modal-cherry-pick-commit', 'data-toggle' => 'modal', 'data-container' => 'body', title: (tooltip if has_tooltip), class: "#{btn_class} #{'has-tooltip' if has_tooltip}"
elsif can?(current_user, :fork_project, @project) elsif can?(current_user, :fork_project, @project)
continue_params = { continue_params = {
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
- 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)}
%div
- if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true') - if !@merge_request.source_branch_exists? || (params[:delete_source] == 'true')
%p %p
The changes were merged into The changes were merged into
...@@ -28,22 +27,6 @@ ...@@ -28,22 +27,6 @@
%p %p
= icon('spinner spin') = icon('spinner spin')
Removing source branch '#{@merge_request.source_branch}'. Please wait, this page will be automatically reloaded. Removing source branch '#{@merge_request.source_branch}'. Please wait, this page will be automatically reloaded.
:javascript
$('.remove_source_branch').on('click', function() {
$('.remove_source_branch_widget').hide();
$('.remove_source_branch_in_progress').show();
});
$(".remove_source_branch").on("ajax:success", function (e, data, status, xhr) {
location.reload();
});
$(".remove_source_branch").on("ajax:error", function (e, data, status, xhr) {
$('.remove_source_branch_widget').hide();
$('.remove_source_branch_in_progress').hide();
$('.remove_source_branch_widget.failed').show();
});
- else - else
%p %p
The changes were merged into The changes were merged into
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
- mr_can_be_cherry_picked = @merge_request.can_be_cherry_picked? - mr_can_be_cherry_picked = @merge_request.can_be_cherry_picked?
- if can_remove_source_branch || mr_can_be_reverted || mr_can_be_cherry_picked - if can_remove_source_branch || mr_can_be_reverted || mr_can_be_cherry_picked
.btn-group .clearfix.merged-buttons
- if can_remove_source_branch - if can_remove_source_branch
= link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @merge_request.source_branch), remote: true, method: :delete, class: "btn btn-default btn-grouped btn-sm remove_source_branch" do = link_to namespace_project_branch_path(@merge_request.source_project.namespace, @merge_request.source_project, @merge_request.source_branch), remote: true, method: :delete, class: "btn btn-default btn-sm remove_source_branch" do
= icon('trash-o') = icon('trash-o')
Remove Source Branch Remove Source Branch
- if mr_can_be_reverted - if mr_can_be_reverted
......
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