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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
4dc83505
Commit
4dc83505
authored
Feb 07, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuser revert commit modal in MR detail page.
parent
ef591b87
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
25 deletions
+14
-25
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+8
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+0
-21
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+1
-1
app/views/projects/commit/_revert.html.haml
app/views/projects/commit/_revert.html.haml
+1
-1
app/views/projects/commit/show.html.haml
app/views/projects/commit/show.html.haml
+1
-1
app/views/projects/merge_requests/show/_mr_title.html.haml
app/views/projects/merge_requests/show/_mr_title.html.haml
+3
-1
No files found.
app/assets/stylesheets/pages/merge_requests.scss
View file @
4dc83505
...
...
@@ -237,3 +237,11 @@
}
}
}
// Revert Merge Request modal
#modal-revert-commit
{
.js-create-merge-request-container
{
line-height
:
$line-height-base
;
}
}
app/controllers/projects/merge_requests_controller.rb
View file @
4dc83505
...
...
@@ -192,27 +192,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
end
def
revert
url_params
=
{
merge_request:
{
source_branch:
@merge_request
.
revert_branch_name
,
target_branch:
@merge_request
.
target_branch
,
source_project_id:
@merge_request
.
target_project_id
,
target_project_id:
@merge_request
.
target_project_id
,
description:
@merge_request
.
revert_description
}
}
if
@merge_request
.
target_branch_exists?
&&
@merge_request
.
merge_commit_sha
.
present?
@repository
.
revert_merge
(
current_user
,
@merge_request
.
merge_commit_sha
,
@merge_request
.
revert_branch_name
,
@merge_request
.
target_branch
,
@merge_request
.
revert_title
)
redirect_to
new_namespace_project_merge_request_url
(
@project
.
namespace
,
@project
,
url_params
)
else
redirect_to
namespace_project_merge_request_url
(
@project
.
namespace
,
@project
,
@merge_request
),
alert:
'Merge Request cannot be reverted because target branch was deleted.'
end
end
def
branch_from
#This is always source
@source_project
=
@merge_request
.
nil?
?
@project
:
@merge_request
.
source_project
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
4dc83505
...
...
@@ -17,7 +17,7 @@
=
icon
(
'files-o'
)
Browse Files
-
if
can_collaborate_with_project?
=
link_to
'#modal-revert-commit'
,
{
'data-target'
=>
'#modal-revert-commit'
,
'data-toggle'
=>
'modal'
,
class:
'btn btn-grouped'
}
do
=
link_to
'#modal-revert-commit'
,
{
'data-target'
=>
'#modal-revert-commit'
,
'data-toggle'
=>
'modal'
,
class:
'btn btn-grouped
btn-close
'
}
do
Revert
-
else
-
continue_params
=
{
to:
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
),
...
...
app/views/projects/commit/_revert.html.haml
View file @
4dc83505
...
...
@@ -5,7 +5,7 @@
%a
.close
{
href:
"#"
,
"data-dismiss"
=>
"modal"
}
×
%h3
.page-title
Revert commit
.modal-body
=
form_tag
revert_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
.
id
),
method: :post
,
remote:
false
,
class:
'form-horizontal js-create-dir-form js-requires-input'
do
=
form_tag
revert_namespace_project_commit_path
(
@project
.
namespace
,
@project
,
commit_
id
),
method: :post
,
remote:
false
,
class:
'form-horizontal js-create-dir-form js-requires-input'
do
.form-group.branch
=
label_tag
'target_branch'
,
'Target branch'
,
class:
'control-label'
.col-sm-10
...
...
app/views/projects/commit/show.html.haml
View file @
4dc83505
...
...
@@ -13,4 +13,4 @@
diff_refs:
@diff_refs
=
render
"projects/notes/notes_with_form"
-
if
can_collaborate_with_project?
=
render
"projects/commit/revert"
=
render
"projects/commit/revert"
,
commit_id:
@commit
.
id
app/views/projects/merge_requests/show/_mr_title.html.haml
View file @
4dc83505
...
...
@@ -19,4 +19,6 @@
-
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"
-
if
@merge_request
.
merged?
&&
@merge_request
.
merge_commit_sha
.
present?
=
link_to
'Revert'
,
revert_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
),
method: :post
,
class:
"btn btn-grouped btn-close"
,
title:
"Revert merge request"
=
render
"projects/commit/revert"
,
commit_id:
@merge_request
.
merge_commit_sha
=
link_to
'#modal-revert-commit'
,
{
'data-target'
=>
'#modal-revert-commit'
,
'data-toggle'
=>
'modal'
,
class:
'btn btn-grouped btn-close'
}
do
Revert
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