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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f8114954
Commit
f8114954
authored
Nov 27, 2013
by
Jacob Carlborg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add button for removing source branch for merged MR's.
parent
8fb9dccd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
6 deletions
+47
-6
app/assets/javascripts/merge_requests.js.coffee
app/assets/javascripts/merge_requests.js.coffee
+12
-0
app/assets/stylesheets/sections/merge_requests.scss
app/assets/stylesheets/sections/merge_requests.scss
+1
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+15
-5
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-0
app/views/projects/merge_requests/show/_remove_source_branch.html.haml
...jects/merge_requests/show/_remove_source_branch.html.haml
+18
-0
No files found.
app/assets/javascripts/merge_requests.js.coffee
View file @
f8114954
...
...
@@ -57,6 +57,18 @@ class MergeRequest
$
(
'.automerge_widget.can_be_merged'
).
hide
()
$
(
'.merge-in-progress'
).
show
()
this
.
$
(
'.remove_source_branch'
).
on
'click'
,
->
$
(
'.remove_source_branch_widget'
).
hide
()
$
(
'.remove_source_branch_in_progress'
).
show
()
this
.
$
(
".remove_source_branch"
).
on
"ajax:success"
,
(
e
,
data
,
status
,
xhr
)
->
location
.
reload
()
this
.
$
(
".remove_source_branch"
).
on
"ajax:error"
,
(
e
,
data
,
status
,
xhr
)
=>
this
.
$
(
'.remove_source_branch_widget'
).
hide
()
this
.
$
(
'.remove_source_branch_in_progress'
).
hide
()
this
.
$
(
'.remove_source_branch_widget.failed'
).
show
()
activateTab
:
(
action
)
->
this
.
$
(
'.nav-tabs li'
).
removeClass
'active'
this
.
$
(
'.tab-content'
).
hide
()
...
...
app/assets/stylesheets/sections/merge_requests.scss
View file @
f8114954
...
...
@@ -53,7 +53,7 @@
}
}
.merge-in-progress
{
.merge-in-progress
,
.remove_source_branch_in_progress
{
@extend
.padded
;
@extend
.append-bottom-10
;
}
...
...
app/controllers/projects/merge_requests_controller.rb
View file @
f8114954
...
...
@@ -199,6 +199,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@commits
=
@merge_request
.
commits
@allowed_to_merge
=
allowed_to_merge?
@allowed_to_remove_source_branch
=
allowed_to_remove_source_branch?
@source_branch
=
@merge_request
.
source_project
.
repository
.
find_branch
(
@merge_request
.
source_branch
).
try
(
:name
)
@show_merge_controls
=
@merge_request
.
opened?
&&
@commits
.
any?
&&
@allowed_to_merge
@target_type
=
:merge_request
...
...
@@ -206,6 +208,19 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def
allowed_to_merge?
allowed_to_push_code?
(
project
)
end
def
invalid_mr
# Render special view for MR with removed source or target branch
render
'invalid'
end
def
allowed_to_remove_source_branch?
allowed_to_push_code?
(
@merge_request
.
source_project
)
end
def
allowed_to_push_code?
(
project
)
action
=
if
project
.
protected_branch?
(
@merge_request
.
target_branch
)
:push_code_to_protected_branches
else
...
...
@@ -214,9 +229,4 @@ class Projects::MergeRequestsController < Projects::ApplicationController
can?
(
current_user
,
action
,
@project
)
end
def
invalid_mr
# Render special view for MR with removed source or target branch
render
'invalid'
end
end
app/views/projects/merge_requests/_show.html.haml
View file @
f8114954
...
...
@@ -7,6 +7,7 @@
=
render
"projects/merge_requests/show/mr_accept"
-
else
=
render
"projects/merge_requests/show/no_accept"
=
render
"projects/merge_requests/show/remove_source_branch"
-
if
@merge_request
.
source_project
.
gitlab_ci?
=
render
"projects/merge_requests/show/mr_ci"
=
render
"projects/merge_requests/show/commits"
...
...
app/views/projects/merge_requests/show/_remove_source_branch.html.haml
0 → 100644
View file @
f8114954
-
if
@source_branch
.
blank?
.alert.alert-info
Source branch has been removed
-
elsif
@allowed_to_remove_source_branch
&&
@merge_request
.
merged?
.remove_source_branch_widget
.alert.alert-info
=
link_to
project_branch_path
(
@merge_request
.
source_project
,
@source_branch
),
remote:
true
,
method: :delete
,
class:
"btn remove_source_branch"
do
%i
.icon-remove
Remove Source Branch
.remove_source_branch_widget.failed.hide
.alert.alert-error
Failed to remove source branch '
#{
@merge_request
.
source_branch
}
'
.remove_source_branch_in_progress.hide
%span
.cgray
%i
.icon-refresh.icon-spin
Removing source branch '
#{
@merge_request
.
source_branch
}
'. Please wait. Page will be automatically reloaded.
\ No newline at end of file
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