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
7029e630
Commit
7029e630
authored
Oct 29, 2021
by
Michael Le
Committed by
David O'Regan
Nov 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace dropdown with collapse; remove unused code
parent
16e7f7a2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
34 deletions
+13
-34
app/assets/javascripts/breadcrumb.js
app/assets/javascripts/breadcrumb.js
+2
-12
app/helpers/breadcrumbs_helper.rb
app/helpers/breadcrumbs_helper.rb
+4
-4
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+1
-1
app/helpers/wiki_helper.rb
app/helpers/wiki_helper.rb
+3
-3
app/views/layouts/nav/breadcrumbs/_collapsed_dropdown.html.haml
...ews/layouts/nav/breadcrumbs/_collapsed_dropdown.html.haml
+0
-11
app/views/layouts/nav/breadcrumbs/_collapsed_inline_list.html.haml
.../layouts/nav/breadcrumbs/_collapsed_inline_list.html.haml
+3
-3
No files found.
app/assets/javascripts/breadcrumb.js
View file @
7029e630
import
$
from
'
jquery
'
;
import
{
hide
}
from
'
~/tooltips
'
;
export
const
addTooltipToEl
=
(
el
)
=>
{
const
textEl
=
el
.
querySelector
(
'
.js-breadcrumb-item-text
'
);
...
...
@@ -19,20 +18,11 @@ export default () => {
.
filter
((
el
)
=>
!
el
.
classList
.
contains
(
'
dropdown
'
))
.
map
((
el
)
=>
el
.
querySelector
(
'
a
'
))
.
filter
((
el
)
=>
el
);
const
$expander
=
$
(
'
.js-breadcrumbs-collapsed-expander
'
);
const
$expanderInline
=
$
(
'
.js-breadcrumbs-collapsed-expander.inline-list
'
);
const
$expanderBtn
=
$
(
'
.js-breadcrumbs-collapsed-expander
'
);
topLevelLinks
.
forEach
((
el
)
=>
addTooltipToEl
(
el
));
$expander
.
closest
(
'
.dropdown
'
).
on
(
'
show.bs.dropdown hide.bs.dropdown
'
,
(
e
)
=>
{
const
$el
=
$
(
'
.js-breadcrumbs-collapsed-expander
'
,
e
.
currentTarget
);
$el
.
toggleClass
(
'
open
'
);
hide
(
$el
);
});
$expanderInline
.
on
(
'
click
'
,
()
=>
{
$expanderBtn
.
on
(
'
click
'
,
()
=>
{
const
detailItems
=
$
(
'
.breadcrumbs-detail-item
'
);
const
hiddenClass
=
'
gl-display-none!
'
;
...
...
app/helpers/breadcrumbs_helper.rb
View file @
7029e630
...
...
@@ -27,10 +27,10 @@ module BreadcrumbsHelper
end
end
def
add_to_breadcrumb_
dropdown
(
link
,
location: :before
)
@breadcrumb_
dropdown
_links
||=
{}
@breadcrumb_
dropdown
_links
[
location
]
||=
[]
@breadcrumb_
dropdown
_links
[
location
]
<<
link
def
add_to_breadcrumb_
collapsed_links
(
link
,
location: :before
)
@breadcrumb_
collapsed
_links
||=
{}
@breadcrumb_
collapsed
_links
[
location
]
||=
[]
@breadcrumb_
collapsed
_links
[
location
]
<<
link
end
def
push_to_schema_breadcrumb
(
text
,
link
)
...
...
app/helpers/groups_helper.rb
View file @
7029e630
...
...
@@ -39,7 +39,7 @@ module GroupsHelper
sorted_ancestors
(
group
).
with_route
.
reverse_each
.
with_index
do
|
parent
,
index
|
if
index
>
0
add_to_breadcrumb_
dropdown
(
group_title_link
(
parent
,
hidable:
false
,
show_avatar:
false
,
for_dropdown:
false
),
location: :before
)
add_to_breadcrumb_
collapsed_links
(
group_title_link
(
parent
),
location: :before
)
else
full_title
<<
breadcrumb_list_item
(
group_title_link
(
parent
,
hidable:
false
))
end
...
...
app/helpers/wiki_helper.rb
View file @
7029e630
...
...
@@ -9,7 +9,7 @@ module WikiHelper
if
page
.
persisted?
titles
<<
page
.
human_title
breadcrumb_title
(
page
.
human_title
)
wiki_breadcrumb_
dropdown
_links
(
page
.
slug
)
wiki_breadcrumb_
collapsed
_links
(
page
.
slug
)
end
titles
<<
action
if
action
...
...
@@ -39,14 +39,14 @@ module WikiHelper
.
join
(
' / '
)
end
def
wiki_breadcrumb_
dropdown
_links
(
page_slug
)
def
wiki_breadcrumb_
collapsed
_links
(
page_slug
)
page_slug_split
=
page_slug
.
split
(
'/'
)
page_slug_split
.
pop
(
1
)
current_slug
=
""
page_slug_split
.
map
do
|
dir_or_page
|
current_slug
=
"
#{
current_slug
}#{
dir_or_page
}
/"
add_to_breadcrumb_
dropdown
link_to
(
WikiPage
.
unhyphenize
(
dir_or_page
).
capitalize
,
wiki_page_path
(
@wiki
,
current_slug
)),
location: :after
add_to_breadcrumb_
collapsed_links
link_to
(
WikiPage
.
unhyphenize
(
dir_or_page
).
capitalize
,
wiki_page_path
(
@wiki
,
current_slug
)),
location: :after
end
end
...
...
app/views/layouts/nav/breadcrumbs/_collapsed_dropdown.html.haml
deleted
100644 → 0
View file @
16e7f7a2
-
dropdown_location
=
local_assigns
.
fetch
(
:location
,
nil
)
-
button_tooltip
=
local_assigns
.
fetch
(
:title
,
_
(
"Show parent pages"
))
-
if
defined?
(
@breadcrumb_dropdown_links
)
&&
@breadcrumb_dropdown_links
.
key?
(
dropdown_location
)
%li
.dropdown
%button
.text-expander.has-tooltip.js-breadcrumbs-collapsed-expander
{
type:
"button"
,
data:
{
toggle:
"dropdown"
,
container:
"body"
},
"aria-label"
:
button_tooltip
,
title:
button_tooltip
}
=
sprite_icon
(
"ellipsis_h"
,
size:
12
)
=
sprite_icon
(
"angle-right"
,
size:
8
,
css_class:
"breadcrumbs-list-angle"
)
.dropdown-menu
%ul
-
@breadcrumb_dropdown_links
[
dropdown_location
].
each_with_index
do
|
link
,
index
|
%li
{
style:
"text-indent: #{[index * 16, 60].min}px;"
}=
link
app/views/layouts/nav/breadcrumbs/_collapsed_inline_list.html.haml
View file @
7029e630
-
dropdown_location
=
local_assigns
.
fetch
(
:location
,
nil
)
-
button_tooltip
=
local_assigns
.
fetch
(
:title
,
_
(
"Show all breadcrumbs"
))
-
if
defined?
(
@breadcrumb_
dropdown_links
)
&&
@breadcrumb_dropdown
_links
.
key?
(
dropdown_location
)
-
if
defined?
(
@breadcrumb_
collapsed_links
)
&&
@breadcrumb_collapsed
_links
.
key?
(
dropdown_location
)
%li
.expander
%button
.text-expander.has-tooltip.js-breadcrumbs-collapsed-expander
.inline-list
{
type:
"button"
,
data:
{
container:
"body"
},
"aria-label"
:
button_tooltip
,
title:
button_tooltip
}
%button
.text-expander.has-tooltip.js-breadcrumbs-collapsed-expander
{
type:
"button"
,
data:
{
container:
"body"
},
"aria-label"
:
button_tooltip
,
title:
button_tooltip
}
=
sprite_icon
(
"ellipsis_h"
,
size:
12
)
=
sprite_icon
(
"angle-right"
,
size:
8
,
css_class:
"breadcrumbs-list-angle"
)
-
@breadcrumb_
dropdown
_links
[
dropdown_location
].
each_with_index
do
|
link
,
index
|
-
@breadcrumb_
collapsed
_links
[
dropdown_location
].
each_with_index
do
|
link
,
index
|
%li
{
:class
=>
"gl-display-none! breadcrumbs-detail-item"
}
=
link
=
sprite_icon
(
"angle-right"
,
size:
8
,
css_class:
"breadcrumbs-list-angle"
)
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