Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
22e97dd7
Commit
22e97dd7
authored
Jun 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with MR buttons being in a group
Also removed some inline code
parent
65df6bcb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
43 deletions
+70
-43
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+4
-0
app/assets/javascripts/merged_buttons.js.coffee
app/assets/javascripts/merged_buttons.js.coffee
+30
-0
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+10
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+3
-3
app/views/projects/merge_requests/widget/_merged.html.haml
app/views/projects/merge_requests/widget/_merged.html.haml
+21
-38
app/views/projects/merge_requests/widget/_merged_buttons.haml
...views/projects/merge_requests/widget/_merged_buttons.haml
+2
-2
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
22e97dd7
...
...
@@ -53,9 +53,13 @@ class Dispatcher
new
Diff
()
shortcut_handler
=
new
ShortcutsIssuable
(
true
)
new
ZenMode
()
new
MergedButtons
()
when
'projects:merge_requests:commits'
,
'projects:merge_requests:builds'
new
MergedButtons
()
when
"projects:merge_requests:diffs"
new
Diff
()
new
ZenMode
()
new
MergedButtons
()
when
'projects:merge_requests:index'
shortcut_handler
=
new
ShortcutsNavigation
()
Issuable
.
init
()
...
...
app/assets/javascripts/merged_buttons.js.coffee
0 → 100644
View file @
22e97dd7
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
()
app/assets/stylesheets/pages/merge_requests.scss
View file @
22e97dd7
...
...
@@ -313,3 +313,13 @@
}
}
}
.merged-buttons
{
.btn
{
float
:
left
;
&
:not
(
:last-child
)
{
margin-right
:
10px
;
}
}
}
app/helpers/commits_helper.rb
View file @
22e97dd7
...
...
@@ -129,7 +129,7 @@ module CommitsHelper
tooltip
=
"Revert this
#{
commit
.
change_type_title
}
in a new merge request"
if
has_tooltip
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
}
"
elsif
can?
(
current_user
,
:fork_project
,
@project
)
continue_params
=
{
...
...
@@ -141,7 +141,7 @@ module CommitsHelper
namespace_key:
current_user
.
namespace
.
id
,
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
)
end
...
...
@@ -153,7 +153,7 @@ module CommitsHelper
tooltip
=
"Cherry-pick this
#{
commit
.
change_type_title
}
in a new merge request"
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
}
"
elsif
can?
(
current_user
,
:fork_project
,
@project
)
continue_params
=
{
...
...
app/views/projects/merge_requests/widget/_merged.html.haml
View file @
22e97dd7
...
...
@@ -6,46 +6,29 @@
-
if
@merge_request
.
merge_event
by
#{
link_to_member
(
@project
,
@merge_request
.
merge_event
.
author
,
avatar:
true
)
}
#{
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
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
The source branch has been removed.
=
render
'projects/merge_requests/widget/merged_buttons'
-
elsif
@merge_request
.
can_remove_source_branch?
(
current_user
)
.remove_source_branch_widget
%p
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
The source branch has been removed.
=
render
'projects/merge_requests/widget/merged_buttons'
-
elsif
@merge_request
.
can_remove_source_branch?
(
current_user
)
.remove_source_branch_widget
%p
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
You can remove the source branch now.
=
render
'projects/merge_requests/widget/merged_buttons'
,
source_branch_exists:
true
.remove_source_branch_widget.failed.hide
%p
Failed to remove source branch '
#{
@merge_request
.
source_branch
}
'.
.remove_source_branch_in_progress.hide
%p
=
icon
(
'spinner spin'
)
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
();
});
You can remove the source branch now.
=
render
'projects/merge_requests/widget/merged_buttons'
,
source_branch_exists:
true
.remove_source_branch_widget.failed.hide
%p
Failed to remove source branch '
#{
@merge_request
.
source_branch
}
'.
$
(
"
.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
.remove_source_branch_in_progress.hide
%p
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
=
render
'projects/merge_requests/widget/merged_buttons'
=
icon
(
'spinner spin'
)
Removing source branch '
#{
@merge_request
.
source_branch
}
'. Please wait, this page will be automatically reloaded.
-
else
%p
The changes were merged into
#{
link_to
@merge_request
.
target_branch
,
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@merge_request
.
target_branch
),
class:
"label-branch"
}
.
=
render
'projects/merge_requests/widget/merged_buttons'
app/views/projects/merge_requests/widget/_merged_buttons.haml
View file @
22e97dd7
...
...
@@ -3,9 +3,9 @@
-
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
.
btn-group
.
clearfix.merged-buttons
-
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'
)
Remove Source Branch
-
if
mr_can_be_reverted
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment