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
Tatuya Kamada
gitlab-ce
Commits
6173d0a9
Commit
6173d0a9
authored
Oct 15, 2013
by
Andrey Kumanyaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show branches list (which branches contains commit) on commit page
parent
57173040
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
0 deletions
+29
-0
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+4
-0
app/contexts/commit_load_context.rb
app/contexts/commit_load_context.rb
+1
-0
app/controllers/projects/commit_controller.rb
app/controllers/projects/commit_controller.rb
+1
-0
app/helpers/commits_helper.rb
app/helpers/commits_helper.rb
+11
-0
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+12
-0
No files found.
app/assets/javascripts/main.js.coffee
View file @
6173d0a9
...
...
@@ -123,6 +123,10 @@ $ ->
$
(
@
).
next
(
'table'
).
show
()
$
(
@
).
remove
()
$
(
".content"
).
on
"click"
,
".js-details-expand"
,
->
$
(
@
).
next
(
'.js-details-contain'
).
removeClass
(
"hide"
)
$
(
@
).
remove
()
((
$
)
->
_chosen
=
$
.
fn
.
chosen
$
.
fn
.
extend
chosen
:
(
options
)
->
...
...
app/contexts/commit_load_context.rb
View file @
6173d0a9
...
...
@@ -18,6 +18,7 @@ class CommitLoadContext < BaseContext
result
[
:note
]
=
project
.
build_commit_note
(
commit
)
result
[
:line_notes
]
=
line_notes
result
[
:notes_count
]
=
project
.
notes
.
for_commit_id
(
commit
.
id
).
count
result
[
:branches
]
=
project
.
repository
.
branch_names_contains
(
commit
.
id
)
begin
result
[
:suppress_diff
]
=
true
if
commit
.
diff_suppress?
&&
!
params
[
:force_show_diff
]
...
...
app/controllers/projects/commit_controller.rb
View file @
6173d0a9
...
...
@@ -22,6 +22,7 @@ class Projects::CommitController < Projects::ApplicationController
@note
=
result
[
:note
]
@line_notes
=
result
[
:line_notes
]
@branches
=
result
[
:branches
]
@notes_count
=
result
[
:notes_count
]
@target_type
=
:commit
@target_id
=
@commit
.
id
...
...
app/helpers/commits_helper.rb
View file @
6173d0a9
...
...
@@ -94,6 +94,17 @@ module CommitsHelper
crumbs
.
html_safe
end
# Return Project default branch, if it present in array
# Else - first branch in array (mb last actual branch)
def
commit_default_branch
(
project
,
branches
)
branches
.
include?
(
project
.
default_branch
)
?
branches
.
delete
(
project
.
default_branch
)
:
branches
.
pop
end
# Returns the sorted alphabetically links to branches, separated by a comma
def
commit_branches_links
(
project
,
branches
)
branches
.
sort
.
map
{
|
branch
|
link_to
(
branch
,
project_tree_path
(
project
,
branch
))
}.
join
(
", "
).
html_safe
end
protected
# Private: Returns a link to a person. If the person has a matching user and
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
6173d0a9
...
...
@@ -39,6 +39,18 @@
-
@commit
.
parents
.
each
do
|
parent
|
=
link_to
parent
.
id
[
0
...
10
],
project_commit_path
(
@project
,
parent
)
.commit-info-row
%span
.cgray
Exists in
%span
-
branch
=
commit_default_branch
(
@project
,
@branches
)
=
link_to
(
branch
,
project_tree_path
(
@project
,
branch
))
-
if
@branches
.
any?
and in
=
link_to
(
"
#{
pluralize
(
@branches
.
count
,
"other branch"
)
}
"
,
"#"
,
class:
"js-details-expand"
)
%span
.js-details-contain.hide
=
commit_branches_links
(
@project
,
@branches
)
.commit-box
%h3
.commit-title
=
gfm
escape_once
(
@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