Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
ui_suite_dsfr
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_dsfr
Merge requests
!107
Issue
#3471802
by spryah: fix attributes and classes in sidemenu pattern markup
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3471802
by spryah: fix attributes and classes in sidemenu pattern markup
issue/ui_suite_dsfr-3471802:3471802-sidemenu_active_trail
into
1.0.x
Overview
0
Commits
2
Pipelines
4
Changes
2
Merged
Sorya
requested to merge
issue/ui_suite_dsfr-3471802:3471802-sidemenu_active_trail
into
1.0.x
9 months ago
Overview
0
Commits
2
Pipelines
4
Changes
2
Expand
Closes
#3471802
0
0
Merge request reports
Compare
1.0.x
version 6
2a780445
7 months ago
version 5
29f53526
7 months ago
version 4
712f2f09
8 months ago
version 3
1bcfbc26
8 months ago
version 2
65953d55
8 months ago
version 1
46b7b57a
9 months ago
1.0.x (base)
and
latest version
latest version
6f3761f2
2 commits,
7 months ago
version 6
2a780445
1 commit,
7 months ago
version 5
29f53526
2 commits,
7 months ago
version 4
712f2f09
1 commit,
8 months ago
version 3
1bcfbc26
1 commit,
8 months ago
version 2
65953d55
1 commit,
8 months ago
version 1
46b7b57a
1 commit,
9 months ago
2 files
+
28
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
templates/patterns/side_menu/pattern-side-menu.html.twig
+
24
−
5
Options
@@ -8,8 +8,8 @@
{# Generate a unique ID for the title of the side menu. #}
{%
set
title_id
=
title_id
|
default
(
'sidemenu__title-'
~
random
())
%}
{%
set
html_id
=
html_id
|
default
(
'sidemenu-'
~
random
())
%}
<nav
{{
attributes.addClass
(
'fr-sidemenu'
)
}}
role=
"navigation"
aria-labelledby=
"
{{
title_id
}}
"
id=
"
{{
html_id
|
clean_id
}}
"
>
<div
class=
"fr-sidemenu__inner"
>
<button
class=
"fr-sidemenu__btn"
aria-controls=
"fr-sidemenu-wrapper-
{{
html_id
|
clean_id
}}
"
aria-expanded=
"false"
>
{{
'In this section'
|
t
}}
</button>
@@ -24,15 +24,34 @@
{%
if
items
%}
<ul
class=
"fr-sidemenu__list"
>
{%
for
item
in
items
%}
<li
class=
"fr-sidemenu__item"
>
{%
set
item_attributes
=
item.attributes
|
default
(
{}
)
%}
{%
set
item_attributes
=
create_attribute
(
item_attributes
)
%}
<li
{{
item_attributes.addClass
(
'fr-sidemenu__item'
)
}}
>
{%
set
link_attributes
=
item.link_attributes
|
default
(
{}
)
%}
{%
set
link_attributes
=
create_attribute
(
link_attributes
)
%}
{%
if
item.below
%}
{%
set
item_id
=
'fr-sidemenu-item-'
~
loop.index
~
'-'
~
random
()
%}
<button
class=
"fr-sidemenu__btn"
aria-expanded=
"false"
aria-controls=
"
{{
item_id
}}
"
{%
if
item.in_active_trail
%}
aria-current=
"page"
{%
endif
%}
>
{{
item.title
}}
</button>
{%
set
link_attributes
=
link_attributes.setAttribute
(
'aria-controls'
,
item_id
)
%}
{%
set
link_attributes
=
link_attributes.setAttribute
(
'aria-expanded'
,
(
item.is_expanded
)
?
'true'
:
'false'
)
%}
{%
if
item.in_active_trail
%}
{%
set
link_attributes
=
link_attributes.setAttribute
(
'aria-current'
,
'true'
)
%}
{%
endif
%}
<button
{{
link_attributes.addClass
(
'fr-sidemenu__btn'
)
}}
>
{{
item.title
}}
</button>
<div
class=
"fr-collapse"
id=
"
{{
item_id
}}
"
>
{{
_self.menu_links
(
item.below
,
attributes
)
}}
{{
_self.menu_links
(
item.below
,
attributes
,
menu_level
+
1
)
}}
</div>
{%
else
%}
<a
class=
"fr-sidemenu__link"
href=
"
{{
item.url
}}
"
>
{{
item.title
}}
</a>
{%
set
link_attributes
=
link_attributes.setAttribute
(
'href'
,
item.url
)
%}
{%
if
item.in_active_trail
%}
{%
set
link_attributes
=
link_attributes.setAttribute
(
'aria-current'
,
'page'
)
%}
{%
endif
%}
<a
{{
link_attributes.addClass
(
'fr-sidemenu__link'
)
}}
>
{{
item.title
}}
</a>
{%
endif
%}
</li>
{%
endfor
%}
Loading