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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
de82bd8e
Commit
de82bd8e
authored
Sep 06, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed up JS to use a js-* class
fixed up Ruby based on review
parent
68e9372a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23 additions
and
19 deletions
+23
-19
app/assets/javascripts/breadcrumb.js
app/assets/javascripts/breadcrumb.js
+7
-3
app/assets/stylesheets/new_nav.scss
app/assets/stylesheets/new_nav.scss
+1
-1
app/helpers/breadcrumbs_helper.rb
app/helpers/breadcrumbs_helper.rb
+2
-4
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+2
-2
app/helpers/page_layout_helper.rb
app/helpers/page_layout_helper.rb
+4
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-2
app/helpers/wiki_helper.rb
app/helpers/wiki_helper.rb
+1
-1
app/views/layouts/nav/_breadcrumbs.html.haml
app/views/layouts/nav/_breadcrumbs.html.haml
+1
-1
features/steps/explore/projects.rb
features/steps/explore/projects.rb
+2
-2
features/steps/project/redirects.rb
features/steps/project/redirects.rb
+1
-1
No files found.
app/assets/javascripts/breadcrumb.js
View file @
de82bd8e
export
const
addTooltipToEl
=
(
el
)
=>
{
if
(
el
.
scrollWidth
>
el
.
offsetWidth
)
{
const
textEl
=
el
.
querySelector
(
'
.js-breadcrumb-item-text
'
);
if
(
textEl
&&
textEl
.
scrollWidth
>
textEl
.
offsetWidth
)
{
el
.
setAttribute
(
'
title
'
,
el
.
textContent
);
el
.
setAttribute
(
'
data-container
'
,
'
body
'
);
el
.
classList
.
add
(
'
has-tooltip
'
);
...
...
@@ -7,10 +9,12 @@ export const addTooltipToEl = (el) => {
};
export
default
()
=>
{
const
breadcrumbs
=
document
.
querySelector
(
'
.breadcrumbs-list
'
);
const
breadcrumbs
=
document
.
querySelector
(
'
.
js-
breadcrumbs-list
'
);
if
(
breadcrumbs
)
{
const
topLevelLinks
=
breadcrumbs
.
querySelectorAll
(
'
.breadcrumbs-list > li > a
'
);
const
topLevelLinks
=
[...
breadcrumbs
.
children
].
filter
(
el
=>
!
el
.
classList
.
contains
(
'
dropdown
'
))
.
map
(
el
=>
el
.
querySelector
(
'
a
'
))
.
filter
(
el
=>
el
);
const
$expander
=
$
(
'
.js-breadcrumbs-collapsed-expander
'
);
topLevelLinks
.
forEach
(
el
=>
addTooltipToEl
(
el
));
...
...
app/assets/stylesheets/new_nav.scss
View file @
de82bd8e
...
...
@@ -365,7 +365,7 @@ header.navbar-gitlab-new {
}
}
.breadcrumb-item-
project-name
{
.breadcrumb-item-
text
{
@include
str-truncated
(
128px
);
}
...
...
app/helpers/breadcrumbs_helper.rb
View file @
de82bd8e
...
...
@@ -25,15 +25,13 @@ module BreadcrumbsHelper
def
breadcrumb_list_item
(
link
)
content_tag
"li"
do
output
=
link
output
<<
icon
(
"angle-right"
,
class:
"breadcrumbs-list-angle"
)
output
link
+
icon
(
"angle-right"
,
class:
"breadcrumbs-list-angle"
)
end
end
def
add_to_breadcrumb_dropdown
(
link
,
location: :before
)
@breadcrumb_dropdown_links
||=
{}
@breadcrumb_dropdown_links
[
location
]
=
[]
unless
@breadcrumb_dropdown_links
[
location
]
@breadcrumb_dropdown_links
[
location
]
||=
[
]
@breadcrumb_dropdown_links
[
location
]
<<
link
end
end
app/helpers/groups_helper.rb
View file @
de82bd8e
...
...
@@ -36,7 +36,7 @@ module GroupsHelper
else
group_title_link
(
group
)
end
full_title
+=
' · '
.
html_safe
+
link_to
(
simple_sanitize
(
name
),
url
,
class:
'group-path'
)
if
name
full_title
+=
' · '
.
html_safe
+
link_to
(
simple_sanitize
(
name
),
url
,
class:
'group-path
breadcrumb-item-text js-breadcrumb-item-text
'
)
if
name
if
show_new_nav?
full_title
.
html_safe
...
...
@@ -84,7 +84,7 @@ module GroupsHelper
private
def
group_title_link
(
group
,
hidable:
false
,
show_avatar:
false
)
link_to
(
group_path
(
group
),
class:
"group-path
#{
'hidable'
if
hidable
}
"
)
do
link_to
(
group_path
(
group
),
class:
"group-path
breadcrumb-item-text js-breadcrumb-item-text
#{
'hidable'
if
hidable
}
"
)
do
output
=
if
(
show_new_nav?
&&
group
.
try
(
:avatar_url
)
||
(
show_new_nav?
&&
show_avatar
))
&&
!
Rails
.
env
.
test?
image_tag
(
group_icon
(
group
),
class:
"avatar-tile"
,
width:
15
,
height:
15
)
...
...
app/helpers/page_layout_helper.rb
View file @
de82bd8e
...
...
@@ -80,10 +80,12 @@ module PageLayoutHelper
@header_title
=
title
@header_title_url
=
title_url
else
return
@header_title
unless
@header_title_url
if
show_new_nav?
@header_title_url
?
breadcrumb_list_item
(
link_to
(
@header_title
,
@header_title_url
))
:
@header_title
breadcrumb_list_item
(
link_to
(
@header_title
,
@header_title_url
))
else
@header_title_url
?
link_to
(
@header_title
,
@header_title_url
)
:
@header_title
link_to
(
@header_title
,
@header_title_url
)
end
end
end
...
...
app/helpers/projects_helper.rb
View file @
de82bd8e
...
...
@@ -68,12 +68,12 @@ module ProjectsHelper
""
end
output
<<
content_tag
(
"span"
,
simple_sanitize
(
project
.
name
),
class:
"breadcrumb-item-
project-name
"
)
output
<<
content_tag
(
"span"
,
simple_sanitize
(
project
.
name
),
class:
"breadcrumb-item-
text js-breadcrumb-item-text
"
)
output
.
html_safe
end
if
show_new_nav?
namespace_link
=
breadcrumb_list_item
(
namespace_link
)
if
project
.
group
.
nil?
namespace_link
=
breadcrumb_list_item
(
namespace_link
)
unless
project
.
group
project_link
=
breadcrumb_list_item
project_link
end
...
...
app/helpers/wiki_helper.rb
View file @
de82bd8e
...
...
@@ -17,7 +17,7 @@ module WikiHelper
current_slug
=
""
page_slug_split
.
map
do
|
dir_or_page
|
current_slug
=
"
#{
current_slug
}
/
#{
dir_or_page
}
"
current_slug
=
"
#{
current_slug
}
#{
dir_or_page
}
/
"
add_to_breadcrumb_dropdown
link_to
(
WikiPage
.
unhyphenize
(
dir_or_page
).
capitalize
,
project_wiki_path
(
@project
,
current_slug
)),
location: :after
end
end
...
...
app/views/layouts/nav/_breadcrumbs.html.haml
View file @
de82bd8e
...
...
@@ -8,7 +8,7 @@
%span
.sr-only
Open sidebar
=
icon
(
'bars'
)
.breadcrumbs-links.js-title-container
%ul
.list-unstyled.breadcrumbs-list
%ul
.list-unstyled.breadcrumbs-list
.js-breadcrumbs-list
-
unless
hide_top_links
=
header_title
-
if
@breadcrumbs_extra_links
...
...
features/steps/explore/projects.rb
View file @
de82bd8e
...
...
@@ -36,13 +36,13 @@ class Spinach::Features::ExploreProjects < Spinach::FeatureSteps
end
step
'I should see project "Community" home page'
do
page
.
within
'.breadcrumbs .breadcrumb-item-
project-name
'
do
page
.
within
'.breadcrumbs .breadcrumb-item-
text
'
do
expect
(
page
).
to
have_content
'Community'
end
end
step
'I should see project "Internal" home page'
do
page
.
within
'.breadcrumbs .breadcrumb-item-
project-name
'
do
page
.
within
'.breadcrumbs .breadcrumb-item-
text
'
do
expect
(
page
).
to
have_content
'Internal'
end
end
...
...
features/steps/project/redirects.rb
View file @
de82bd8e
...
...
@@ -18,7 +18,7 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
step
'I should see project "Community" home page'
do
Gitlab
.
config
.
gitlab
.
should_receive
(
:host
).
and_return
(
"www.example.com"
)
page
.
within
'.breadcrumbs .breadcrumb-item-
project-name
'
do
page
.
within
'.breadcrumbs .breadcrumb-item-
text
'
do
expect
(
page
).
to
have_content
'Community'
end
end
...
...
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