BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
9f31fbc9
Commit
9f31fbc9
authored
Oct 22, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5340 from Undev/feature/branches_on_commit_page_pr
Show branches list (which branches contains commit) on commit page
parents
76f8f4bc
6173d0a9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
0 deletions
+29
-0
main.js.coffee
app/assets/javascripts/main.js.coffee
+4
-0
commit_load_context.rb
app/contexts/commit_load_context.rb
+1
-0
commit_controller.rb
app/controllers/projects/commit_controller.rb
+1
-0
commits_helper.rb
app/helpers/commits_helper.rb
+11
-0
_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 @
9f31fbc9
...
...
@@ -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 @
9f31fbc9
...
...
@@ -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 @
9f31fbc9
...
...
@@ -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 @
9f31fbc9
...
...
@@ -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 @
9f31fbc9
...
...
@@ -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