Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: wp-895 menu bugs since bootstrap 5 #1073

Merged
merged 9 commits into from
Mar 17, 2025
20 changes: 0 additions & 20 deletions server/portal/templates/includes/cms_menu.html
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not used. The file itself stated that.1

Footnotes

  1. I had kept it around for parity with Core-CMS (Django CMS), but I know now Portal is just Django (not Django CMS).

This file was deleted.

2 changes: 1 addition & 1 deletion server/portal/templates/includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% include "includes/header_logo.html" %}

<!-- Navbar Accordian Toggle on Small Screens -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExpandTarget" aria-controls="navbarsExpandTarget" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarsExpandTarget" aria-controls="navbarsExpandTarget" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

Expand Down
17 changes: 17 additions & 0 deletions server/portal/templates/includes/nav_cms.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,22 @@
scopeElement: container,
ancestorActiveElementSelector: 'li'
});

/* Make (CMS) Bootstrap 4 toggle compatible with (Portal) Bootstrap 5 */
[ ...container.querySelectorAll('[data-toggle]')].forEach(toggle => {
const cmsUsesBootstrap4Toggle = (
toggle.dataset.toggle !== undefined &&
toggle.dataset.bsToggle === undefined
)

if ( cmsUsesBootstrap4Toggle ) {
toggle.dataset.bsToggle = toggle.dataset.toggle;
delete toggle.dataset.toggle;
console.log(
'Replaced `data-toggle` with `data-bs-toggle` in `#s-cms-nav`.',
'To not need this, update CMS Bootstrap from 4 to 5.'
)
}
});
Comment on lines +25 to +41
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});
</script>
4 changes: 2 additions & 2 deletions server/portal/templates/includes/nav_portal.raw.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
</style>
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="icon icon-user"></i>
<span>{{ user.get_username }}</span>
<span class="sr-only">Toggle Dropdown</span>
</a>
<nav class="dropdown-menu dropdown-menu-right">
<nav class="dropdown-menu dropdown-menu-end">
<a class="dropdown-item" href="{% url 'workbench:dashboard' %}">
<i class="icon icon-dashboard"></i> My Dashboard
</a>
Expand Down