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
722e3935
Commit
722e3935
authored
May 09, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Create Merge Request buttons to commits page and push event.
parent
8f75ab21
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
21 deletions
+41
-21
CHANGELOG
CHANGELOG
+1
-0
app/helpers/compare_helper.rb
app/helpers/compare_helper.rb
+12
-12
app/views/events/event/_push.html.haml
app/views/events/event/_push.html.haml
+13
-1
app/views/projects/commits/show.html.haml
app/views/projects/commits/show.html.haml
+11
-5
app/views/projects/compare/_form.html.haml
app/views/projects/compare/_form.html.haml
+4
-3
No files found.
CHANGELOG
View file @
722e3935
...
...
@@ -49,6 +49,7 @@ v 7.11.0 (unreleased)
- Add footnotes support to Markdown (Guillaume Delbergue)
- Add current_sign_in_at to UserFull REST api.
- Make Sidekiq MemoryKiller shutdown signal configurable
- Add "Create Merge Request" buttons to commits page and push event.
v 7.10.2
- Fix CI links on MR page
...
...
app/helpers/compare_helper.rb
View file @
722e3935
module
CompareHelper
def
c
ompare_to_mr_button?
@
project
.
merge_requests_enabled
&&
params
[
:from
]
.
present?
&&
params
[
:to
]
.
present?
&&
@repository
.
branch_names
.
include?
(
params
[
:from
]
)
&&
@repository
.
branch_names
.
include?
(
params
[
:to
]
)
&&
params
[
:from
]
!=
params
[
:to
]
&&
def
c
reate_mr_button?
(
from
=
params
[
:from
],
to
=
params
[
:to
],
project
=
@project
)
project
.
merge_requests_enabled
&&
from
.
present?
&&
to
.
present?
&&
project
.
repository
.
branch_names
.
include?
(
from
)
&&
project
.
repository
.
branch_names
.
include?
(
to
)
&&
from
!=
to
&&
!
@refs_are_same
end
def
c
ompare_mr_path
def
c
reate_mr_path
(
from
=
params
[
:from
],
to
=
params
[
:to
],
project
=
@project
)
new_namespace_project_merge_request_path
(
@
project
.
namespace
,
@
project
,
project
.
namespace
,
project
,
merge_request:
{
source_branch:
params
[
:to
]
,
target_branch:
params
[
:from
]
source_branch:
to
,
target_branch:
from
}
)
end
...
...
app/views/events/event/_push.html.haml
View file @
722e3935
...
...
@@ -17,15 +17,27 @@
-
few_commits
.
each
do
|
commit
|
=
render
"events/commit"
,
commit:
commit
,
project:
project
-
create_mr
=
current_user
==
event
.
author
&&
event
.
new_ref?
&&
create_mr_button?
(
event
.
project
.
default_branch
,
event
.
ref_name
,
event
.
project
)
-
if
event
.
commits_count
>
1
%li
.commits-stat
-
if
event
.
commits_count
>
2
%span
... and
#{
event
.
commits_count
-
2
}
more commits.
-
if
event
.
md_ref?
-
from
=
event
.
commit_from
-
from_label
=
truncate_sha
(
from
)
-
else
-
from
=
event
.
project
.
default_branch
-
from_label
=
from
=
link_to
namespace_project_compare_path
(
event
.
project
.
namespace
,
event
.
project
,
from:
from
,
to:
event
.
commit_to
)
do
%strong
Compare
→
#{
from_label
}
...
#{
truncate_sha
(
event
.
commit_to
)
}
Compare
#{
from_label
}
...
#{
truncate_sha
(
event
.
commit_to
)
}
-
if
create_mr
or
=
link_to
create_mr_path
(
event
.
project
.
default_branch
,
event
.
ref_name
,
event
.
project
)
do
create a merge request
-
elsif
create_mr
%li
.commits-stat
=
link_to
create_mr_path
(
event
.
project
.
default_branch
,
event
.
ref_name
,
event
.
project
)
do
Create Merge Request
app/views/projects/commits/show.html.haml
View file @
722e3935
...
...
@@ -8,11 +8,17 @@
.tree-ref-holder
=
render
'shared/ref_switcher'
,
destination:
'commits'
-
if
current_user
&&
current_user
.
private_token
.commits-feed-holder.hidden-xs.hidden-sm
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@ref
,
{
format: :atom
,
private_token:
current_user
.
private_token
}),
title:
"Feed"
,
class:
'btn'
do
%i
.fa.fa-rss
Commits feed
.commits-feed-holder.hidden-xs.hidden-sm
-
if
create_mr_button?
(
@repository
.
root_ref
,
@ref
)
=
link_to
create_mr_path
(
@repository
.
root_ref
,
@ref
),
class:
'btn btn-success'
do
=
icon
(
'plus'
)
Create Merge Request
-
if
current_user
&&
current_user
.
private_token
=
link_to
namespace_project_commits_path
(
@project
.
namespace
,
@project
,
@ref
,
{
format: :atom
,
private_token:
current_user
.
private_token
}),
title:
"Feed"
,
class:
'prepend-left-10 btn'
do
=
icon
(
"rss"
)
Commits Feed
%ul
.breadcrumb.repo-breadcrumb
=
commits_breadcrumbs
...
...
app/views/projects/compare/_form.html.haml
View file @
722e3935
...
...
@@ -13,9 +13,10 @@
=
text_field_tag
:to
,
params
[
:to
],
class:
"form-control"
=
button_tag
"Compare"
,
class:
"btn btn-create commits-compare-btn"
-
if
compare_to_mr_button?
=
link_to
compare_mr_path
,
class:
'prepend-left-10 btn'
do
%strong
Make a merge request
-
if
create_mr_button?
=
link_to
create_mr_path
,
class:
'prepend-left-10 btn'
do
=
icon
(
"plus"
)
Create Merge Request
:javascript
...
...
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