Bug 40612: Eliminate duplicate element id in OPAC language menus

This patch updates the include file used to display the OPAC language
menu in the header and footer. The include already makes use of a
"context" variable which tells it whether it's in the header or footer.
We can use the same logic to give unique ids for each instance.

To test, apply the patch and rebuild the OPAC CSS.

- Go to Administration -> System preferences -> OpacLangSelectorMode and
  set it to "both top and footer."
- Go to the OPAC and inspect the HTML for each language menu. The one in
  the header should have the id "header_langmenu." The one in the footer
  should have "footer_langmenu."

Sponsored-by: Athens County Public Libraries
Signed-off-by: Ludovic Julien <ludovic.julien@inLibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 46ed6fbc04)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Owen Leonard 2025-08-07 15:51:44 +00:00 committed by Paul Derscheid
parent 1591869c08
commit 5856ae4897
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 10 additions and 8 deletions

View File

@ -312,7 +312,7 @@ th {
margin: .2rem .2rem .2rem 0;
}
#header_langmenu {
.langmenu {
flex-shrink: 1;
}

View File

@ -1,10 +1,12 @@
<div id="header_langmenu">
[% IF ( context == "footer" ) -%]
[% SET li_class = 'nav-item dropup' %]
[% SET menu_id = 'footer_langmenu' %]
[% ELSE %]
[% SET li_class = 'nav-item dropdown' %]
[% SET menu_id = 'header_langmenu' %]
[% END %]
<div id="[% menu_id | html %]" class="langmenu">
<ul class="navbar-nav">
[% IF ( context == "footer" ) -%]
[% SET li_class = 'nav-item dropup' %]
[% ELSE %]
[% SET li_class = 'nav-item dropdown' %]
[% END %]
<li class="[% li_class | html %]">
<a href="#" title="Switch languages" class="nav-link dropdown-toggle" id="langmenu" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"
><i class="fa fa-flag fa-fw fa-icon-[% context | html %]" aria-hidden="true"></i> <span class="langlabel">Languages</span> <b class="caret"></b
@ -64,4 +66,4 @@
</ul>
<!-- /.navbar-nav -->
</div>
<!-- /#header_langmenu -->
<!-- /#[menu_id] -->