mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-72642 navigation: Fix duplicated ID in more menu items
This commit is contained in:
parent
1d700796ca
commit
8e4a7c6b90
@ -64,6 +64,7 @@ class more_menu implements renderable, templatable {
|
||||
} else {
|
||||
$data['nodearray'] = (array) $this->content;
|
||||
}
|
||||
$data['moremenuid'] = uniqid();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
@ -41,11 +41,12 @@
|
||||
"action": "/admin/search.php"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"moremenuid": "614c104dbacfa"
|
||||
}
|
||||
}}
|
||||
<nav class="moremenu">
|
||||
<ul id="moremenu-{{ uniqid }}-{{navbarstyle}}" role="menubar" class="nav more-nav {{navbarstyle}}">
|
||||
<ul id="moremenu-{{moremenuid}}-{{navbarstyle}}" role="menubar" class="nav more-nav {{navbarstyle}}">
|
||||
{{#nodecollection}}
|
||||
{{#children}}
|
||||
{{> core/moremenu_children}}
|
||||
@ -55,16 +56,16 @@
|
||||
{{> core/moremenu_children}}
|
||||
{{/nodearray}}
|
||||
<li role="none" class="nav-item dropdown dropdownmoremenu d-none" data-region="morebutton">
|
||||
<a class="dropdown-toggle nav-link" href="#" id="moremenu-dropdown{{ uniqid }}" role="menuitem" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" tabindex="-1">
|
||||
<a class="dropdown-toggle nav-link" href="#" id="moremenu-dropdown-{{moremenuid}}" role="menuitem" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" tabindex="-1">
|
||||
{{#str}}moremenu, core{{/str}}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-right" data-region="moredropdown" aria-labelledby="moremenu-dropdown{{ uniqid }}" role="menu">
|
||||
<ul class="dropdown-menu dropdown-menu-right" data-region="moredropdown" aria-labelledby="moremenu-dropdown-{{moremenuid}}" role="menu">
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
{{#js}}
|
||||
require(['core/moremenu'], function(moremenu) {
|
||||
moremenu(document.querySelector('#moremenu-{{ uniqid }}-{{navbarstyle}}'));
|
||||
moremenu(document.querySelector('#moremenu-{{moremenuid}}-{{navbarstyle}}'));
|
||||
});
|
||||
{{/js}}
|
||||
|
@ -23,7 +23,7 @@
|
||||
{
|
||||
"divider": "",
|
||||
"haschildren": "",
|
||||
"uniqid": "Unique string",
|
||||
"moremenuid": "614c104dbacfa",
|
||||
"text": "Moodle community",
|
||||
"children": "",
|
||||
"title": "Moodle community",
|
||||
@ -32,10 +32,10 @@
|
||||
}}
|
||||
{{#haschildren}}
|
||||
<li class="dropdown nav-item" role="none" data-forceintomoremenu="{{#forceintomoremenu}}true{{/forceintomoremenu}}{{^forceintomoremenu}}false{{/forceintomoremenu}}">
|
||||
<a class="dropdown-toggle nav-link" id="drop-down-{{uniqid}}" role="menuitem" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" aria-controls="drop-down-menu-{{uniqid}}" tabindex="-1">
|
||||
<a class="dropdown-toggle nav-link" id="drop-down-{{moremenuid}}" role="menuitem" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" aria-controls="drop-down-menu-{{moremenuid}}" tabindex="-1">
|
||||
{{{text}}}
|
||||
</a>
|
||||
<div class="dropdown-menu" role="menu" id="drop-down-menu-{{uniqid}}" aria-labelledby="drop-down-{{uniqid}}">
|
||||
<div class="dropdown-menu" role="menu" id="drop-down-menu-{{moremenuid}}" aria-labelledby="drop-down-{{moremenuid}}">
|
||||
{{#children}}
|
||||
{{^divider}}
|
||||
<a class="dropdown-item" role="menuitem" href="{{{url}}}">{{{text}}}</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user