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
Kazuhiko Shiozaki
gitlab-ce
Commits
e6018569
Commit
e6018569
authored
Nov 01, 2012
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'breadcrumbs' helper for Commit breadcrumb links
Closes #1731
parent
b1be377f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+25
-0
app/views/commits/show.html.haml
app/views/commits/show.html.haml
+1
-8
No files found.
app/helpers/tree_helper.rb
View file @
e6018569
...
...
@@ -67,4 +67,29 @@ module TreeHelper
can?
(
current_user
,
:push_code
,
@project
)
end
end
# Breadcrumb links for a Project and, if applicable, a tree path
def
breadcrumbs
return
unless
@project
&&
@ref
# Add the root project link and the arrow icon
crumbs
=
content_tag
(
:li
)
do
content_tag
(
:span
,
nil
,
class:
'arrow'
)
+
link_to
(
@project
.
name
,
project_commits_path
(
@project
,
@ref
))
end
if
@path
parts
=
@path
.
split
(
'/'
)
parts
.
each_with_index
do
|
part
,
i
|
crumbs
+=
content_tag
(
:span
,
'/'
,
class:
'divider'
)
crumbs
+=
content_tag
(
:li
)
do
# The text is just the individual part, but the link needs all the parts before it
link_to
part
,
project_commits_path
(
@project
,
tree_join
(
@ref
,
parts
[
0
..
i
].
join
(
'/'
)))
end
end
end
crumbs
.
html_safe
end
end
app/views/commits/show.html.haml
View file @
e6018569
...
...
@@ -2,14 +2,7 @@
-
if
@path
.
present?
%ul
.breadcrumb
%li
%span
.arrow
=
link_to
project_commits_path
(
@project
)
do
=
@project
.
name
%span
.divider
\/
%li
%a
{
href:
"#"
}=
@path
.
split
(
"/"
).
join
(
" / "
)
=
breadcrumbs
%div
{
id:
dom_id
(
@project
)}
#commits_list
=
render
"commits"
...
...
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