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
7411fb36
Commit
7411fb36
authored
Jan 22, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show branches/tags as labels on commit page
parent
7afa4d57
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
18 deletions
+30
-18
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+16
-2
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+14
-16
No files found.
app/helpers/commits_helper.rb
View file @
7411fb36
...
@@ -62,13 +62,27 @@ module CommitsHelper
...
@@ -62,13 +62,27 @@ module CommitsHelper
# Returns the sorted alphabetically links to branches, separated by a comma
# Returns the sorted alphabetically links to branches, separated by a comma
def
commit_branches_links
(
project
,
branches
)
def
commit_branches_links
(
project
,
branches
)
branches
.
sort
.
map
{
|
branch
|
link_to
(
branch
,
project_tree_path
(
project
,
branch
))
}.
join
(
", "
).
html_safe
branches
.
sort
.
map
do
|
branch
|
link_to
(
project_tree_path
(
project
,
branch
))
do
content_tag
:span
,
class:
'label label-gray'
do
content_tag
(
:i
,
nil
,
class:
'fa fa-code-fork'
)
+
' '
+
branch
end
end
end
.
join
(
" "
).
html_safe
end
end
# Returns the sorted links to tags, separated by a comma
# Returns the sorted links to tags, separated by a comma
def
commit_tags_links
(
project
,
tags
)
def
commit_tags_links
(
project
,
tags
)
sorted
=
VersionSorter
.
rsort
(
tags
)
sorted
=
VersionSorter
.
rsort
(
tags
)
sorted
.
map
{
|
tag
|
link_to
(
tag
,
project_commits_path
(
project
,
project
.
repository
.
find_tag
(
tag
).
name
))
}.
join
(
", "
).
html_safe
sorted
.
map
do
|
tag
|
link_to
(
project_commits_path
(
project
,
project
.
repository
.
find_tag
(
tag
).
name
))
do
content_tag
:span
,
class:
'label label-gray'
do
content_tag
(
:i
,
nil
,
class:
'fa fa-tag'
)
+
' '
+
tag
end
end
end
.
join
(
" "
).
html_safe
end
end
def
link_to_browse_code
(
project
,
commit
)
def
link_to_browse_code
(
project
,
commit
)
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
7411fb36
...
@@ -37,25 +37,23 @@
...
@@ -37,25 +37,23 @@
-
@commit
.
parents
.
each
do
|
parent
|
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
short_id
,
project_commit_path
(
@project
,
parent
)
=
link_to
parent
.
short_id
,
project_commit_path
(
@project
,
parent
)
-
if
@branches
.
any?
.commit-info-row
.commit-info-row
-
if
@branches
.
any?
%span
.cgray
Exists in
%span
%span
-
branch
=
commit_default_branch
(
@project
,
@branches
)
-
branch
=
commit_default_branch
(
@project
,
@branches
)
=
link_to
(
branch
,
project_tree_path
(
@project
,
branch
))
=
link_to
(
project_tree_path
(
@project
,
branch
))
do
-
if
@branches
.
any?
%span
.label.label-gray
and in
%i
.fa.fa-code-fork
=
link_to
(
"
#{
pluralize
(
@branches
.
count
,
"other branch"
)
}
"
,
"#"
,
class:
"js-details-expand"
)
=
branch
-
if
@branches
.
any?
||
@tags
.
any?
=
link_to
(
"#"
,
class:
"js-details-expand"
)
do
%span
.label.label-gray
\...
%span
.js-details-content.hide
%span
.js-details-content.hide
=
commit_branches_links
(
@project
,
@branches
)
-
if
@branches
.
any?
=
commit_branches_links
(
@project
,
@branches
)
-
if
@tags
.
any?
-
if
@tags
.
any?
.commit-info-row
=
commit_tags_links
(
@project
,
@tags
)
%span
.cgray
Tags:
%span
=
commit_tags_links
(
@project
,
@tags
)
.commit-box
.commit-box
%h3
.commit-title
%h3
.commit-title
...
...
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