Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ui_suite_bootstrap
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ui_suite_bootstrap
Commits
770a7738
Commit
770a7738
authored
1 year ago
by
Florent Torregrosa
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3403816
by Grimreaper: Fix navbar text items.
parent
d071a48c
No related branches found
No related tags found
1 merge request
!193
Resolve #3403816 "Simplify dark options"
Pipeline
#194790
passed
1 year ago
Stage: build
Stage: validate
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/patterns/navbar_nav/pattern-navbar-nav.html.twig
+28
-9
28 additions, 9 deletions
templates/patterns/navbar_nav/pattern-navbar-nav.html.twig
with
28 additions
and
9 deletions
templates/patterns/navbar_nav/pattern-navbar-nav.html.twig
+
28
−
9
View file @
770a7738
...
...
@@ -3,10 +3,28 @@
{%
endif
%}
{%
set
attributes
=
attributes.addClass
(
'navbar-nav'
)
%}
{%
set
list_opened
=
false
%}
{%
if
items
%}
<ul
{{
attributes
}}
>
{%
for
item
in
items
%}
{#
When finding a text item. it should be outside the list. So handle text
items by opening/closing lists around if needed.
#}
{%
set
item_is_link
=
false
%}
{%
if
item.below
or
item.url
%}
{%
set
item_is_link
=
true
%}
{%
endif
%}
{%
if
item_is_link
and
not
list_opened
%}
{%
set
list_opened
=
true
%}
<ul
{{
attributes
}}
>
{%
elseif
not
item_is_link
and
list_opened
%}
{%
set
list_opened
=
false
%}
</ul>
{%
endif
%}
{%
set
item_attributes
=
item.attributes
|
default
(
create_attribute
())
%}
{%
set
link_attributes
=
item.link_attributes
|
default
(
create_attribute
())
%}
{%
if
item.below
%}
{{
pattern
(
'dropdown'
,
{
...
...
@@ -20,15 +38,16 @@
}
),
'button_attributes'
:
link_attributes
}
,
'dropdown'
)
}}
{%
else
%}
<li
{{
item.attributes.addClass
(
'nav-item'
)
}}
>
{%
if
item.url
%}
<a
{{
link_attributes.setAttribute
(
'href'
,
item.url
)
.
addClass
(
'nav-link'
)
}}
>
{{
item.title
}}
</a>
{%
else
%}
<span
{{
link_attributes
}}
>
{{
item.title
}}
</span>
{%
endif
%}
{%
elseif
item.url
%}
<li
{{
item_attributes.addClass
(
'nav-item'
)
}}
>
<a
{{
link_attributes.setAttribute
(
'href'
,
item.url
)
.
addClass
(
'nav-link'
)
}}
>
{{
item.title
}}
</a>
</li>
{%
else
%}
<span
{{
link_attributes.addClass
(
'navbar-text'
)
}}
>
{{
item.title
}}
</span>
{%
endif
%}
{%
if
loop.last
and
list_opened
%}
</ul>
{%
endif
%}
{%
endfor
%}
</ul>
{%
endif
%}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment