Skip to content

feat(ui): add burger menu toggle for collapsible sidebar with responsive and persistent behavior#767

Merged
mariobehling merged 19 commits intofossasia:enextfrom
yaxit24:727-burger
Nov 10, 2025
Merged

feat(ui): add burger menu toggle for collapsible sidebar with responsive and persistent behavior#767
mariobehling merged 19 commits intofossasia:enextfrom
yaxit24:727-burger

Conversation

@yaxit24
Copy link
Copy Markdown
Contributor

@yaxit24 yaxit24 commented Jun 27, 2025

Fixes: #727

Screen.Recording.2025-06-27.at.4.22.52.PM.mov

Summary by Sourcery

Implement a burger menu toggle to collapse and expand the left sidebar with responsive behavior and persistent state across desktop and mobile.

Enhancements:

  • Add a sidebar toggle button (burger menu) in base templates for control, common, and admin pages
  • Implement JavaScript logic to collapse/expand the sidebar with state persistence in localStorage and responsive off-canvas behavior on mobile
  • Enhance submenu interactions with accordion-style mobile behavior, click-through support, and hover-to-expand on desktop
  • Introduce SCSS styles for the minimized sidebar state, mobile transitions, and minor navbar adjustments
  • Bump jQuery to 3.7.1 and include Stripe v3 script in the common base template

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Jun 27, 2025

Reviewer's Guide

This PR adds a burger‐menu toggle to collapse and expand the left sidebar across desktop and mobile by injecting a custom toggle button into various navbar templates, overhauling the sidebar initialization and toggle logic in the main JS file (with localStorage persistence, responsive load/resize behavior, submenu hover and click enhancements), and introducing dedicated SCSS rules for minimized and mobile slide-in/out sidebar states. It also updates several template script includes and dependency versions.

Sequence diagram for sidebar toggle interaction

sequenceDiagram
    actor User
    participant BurgerMenu as Burger Menu Button
    participant JS as Sidebar JS Logic
    participant Sidebar
    participant localStorage
    User->>BurgerMenu: Clicks burger menu
    BurgerMenu->>JS: Triggers click event
    JS->>Sidebar: Toggle minimized/expanded state
    JS->>localStorage: Save sidebarMinimized state
    Sidebar-->>User: Sidebar animates (collapses/expands or slides in/out)
Loading

Class diagram for sidebar toggle JS logic

classDiagram
    class SidebarToggle {
        +applyInitialSidebarState()
        +ensureMetisMenuInitialized()
        +setupSidebarHover()
        +isMobileView()
    }
    class localStorage {
        +getItem(key)
        +setItem(key, value)
    }
    class Body {
        +addClass(className)
        +removeClass(className)
        +toggleClass(className)
    }
    SidebarToggle --|> localStorage : uses
    SidebarToggle --|> Body : manipulates
    SidebarToggle --|> Sidebar : toggles state
Loading

File-Level Changes

Change Details Files
Inserted a custom sidebar‐toggle button into header navbars
  • Added <button class="navbar-toggle-sidebar"…> at the top of navbar sections in base templates
  • Commented out or removed conflicting default collapse buttons for mobile nav
  • Repositioned and standardized mobile view links and brand markup
src/pretix/control/templates/pretixcontrol/base.html
src/pretix/eventyay_common/templates/eventyay_common/base.html
src/pretix/control/templates/pretixcontrol/admin/pages/base.html
Refactored sidebar toggle and initialization in sb-admin-2.js
  • Introduced applyInitialSidebarState and ensureMetisMenuInitialized helpers
  • Unified click handlers for custom and default toggle buttons with localStorage state
  • Enforced minimized state on load/resize for desktop and consistent hide/show on mobile
  • Enhanced submenu click logic for navigation vs. accordion behavior and added hover-expand on desktop
src/pretix/static/pretixcontrol/js/sb-admin-2.js
Added and refined SCSS for minimized and responsive sidebar
  • Imported new _sidebar.scss and defined minimized-state styles (icon-only view, hidden text, adjusted widths)
  • Added mobile media queries to slide sidebar in/out with transitions
  • Tweaked existing navbar and submenu margins and added smooth opacity transitions
src/pretix/static/pretixcontrol/scss/main.scss
src/pretix/static/bootstrap/scss/bootstrap/_navbar.scss
src/pretix/static/pretixcontrol/scss/_sidebar.scss
Updated script dependencies and template includes
  • Bumped jQuery from 2.1.1 to 3.7.1 and added Stripe JS and task_management.js
  • Moved popover JS include to the pretixcontrol path
  • Replaced settings.INSTANCE_NAME with django_settings.INSTANCE_NAME in templates
src/pretix/eventyay_common/templates/eventyay_common/base.html

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @yaxit24 - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

<ul class="nav navbar-nav navbar-top-links navbar-left flip hidden-xs">
{% if request.event %}
<li>
{% comment %} <div class="navbar-header">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please delete code, not comment, except when this change is temporary.

{{ nav.icon|safe }}
{% endif %}
<a class="navbar-brand" href="{% url 'eventyay_common:dashboard' %}">
<img src="{% static "pretixbase/img/eventyay-icon.svg" %}" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use different quote style when nesting.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@yaxit24 Please follow this.

</form>
{% else %}
<a href="{% eventurl request.event "presale:event.index" %}" title="{% trans "View event" %}" target="_blank">
<i class="fa fa-eye"></i> {% trans "View event" %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't use the obsolete {% trans %} tag.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@yaxit24 Please follow this.

}
});
}
} No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing blank line.


// Ensure the sidebar doesn't overlap with the navbar
.navbar-brand {
z-index: 1001; // Higher than sidebar
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why don't use z-index of 10 and 11? Why too high?

@yaxit24 yaxit24 requested a review from hongquan June 30, 2025 05:09
Copy link
Copy Markdown
Member

@Gagan-Ram Gagan-Ram left a comment

Choose a reason for hiding this comment

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

767.webm

Hi @yaxit24, I noticed the following issues:

  1. The burger menu gets toggled off when navigating to a new page.
  2. The alignment of the burger menu items doesn't match that of ey-talk. Specifically, the top menu item icon appears to have extra padding and is aligned further left compared to the icons of the items below it.
  3. The entire Tickets component is displaying an "Internal Server Error".
  4. The burger menu icon is not visible on the Tickets component pages.

Also, please clarify why have you changed "Main dashboard" to "Tickets dashboard" and modified its links?

Copy link
Copy Markdown
Member

@hongquan hongquan left a comment

Choose a reason for hiding this comment

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

You broke all quote styles.
The rule is to use different quote styles when nesting. Now you apply the same quote style everywhere!

</form>
{% else %}
<a href="{% eventurl request.event 'presale:event.index' %}" title="{% translate "View event" %}"
<a href="{% eventurl request.event "presale:event.index" %}" title="{% trans "View event" %}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why you change the correct quote styles to wrong ones?

@yaxit24 yaxit24 force-pushed the 727-burger branch 2 times, most recently from f8958fa to 0d7a0c1 Compare July 8, 2025 04:34
@yaxit24
Copy link
Copy Markdown
Contributor Author

yaxit24 commented Jul 8, 2025

please verify:

Screen.Recording.2025-07-08.at.10.10.01.AM.mov

@yaxit24
Copy link
Copy Markdown
Contributor Author

yaxit24 commented Jul 8, 2025

Screen.Recording.2025-07-08.at.10.13.45.AM.mov

@yaxit24 yaxit24 requested review from Gagan-Ram and hongquan July 8, 2025 05:47
Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

I dont understand the logic of the mobile view. Why should we have two burger menus in the mobile view? Please implement it in the same way as eventyay-talk. One mobile menu on the left is enough.

@yaxit24
Copy link
Copy Markdown
Contributor Author

yaxit24 commented Jul 10, 2025

Screenshot 2025-07-10 at 4 21 58 PM Thanks, implemented. I had added the functionality to both burger buttons to enhance accessibility on mobile devices, allowing them to open and close the sidebars from either side of the mobile view.

@yaxit24 yaxit24 requested a review from mariobehling July 10, 2025 11:06
Copy link
Copy Markdown
Member

@Gagan-Ram Gagan-Ram left a comment

Choose a reason for hiding this comment

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

  1. The alignment of the burger menu items doesn't match that of ey-talk. Specifically, the top menu item icon appears to have extra padding and is aligned further left compared to the icons of the items below it.
  2. If a sidebar menu item contains a sub-menu, selecting any sub-menu item will cause the entire dropdown menu to collapse.

@mariobehling mariobehling changed the title Implemented burger menu to minimize left sidebar feat(ui): add burger menu toggle for collapsible sidebar with responsive and persistent behavior Oct 6, 2025
Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

Please finalize the PR and make it against the enext branch.

@mariobehling
Copy link
Copy Markdown
Member

As there were no updates on this PR I am closing it.

@yaxit24 yaxit24 reopened this Oct 24, 2025
@yaxit24 yaxit24 changed the base branch from development to enext October 24, 2025 19:48
Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

  • The alignment of the burger menu items doesn't match that of ey-talk. Specifically, the top menu item icon appears to have extra padding and is aligned further left compared to the icons of the items below it.
  • If a sidebar menu item contains a sub-menu, selecting any sub-menu item will cause the entire dropdown menu to collapse.

In the video it still looks like these points have not been resolved.

@mariobehling mariobehling requested a review from Copilot October 24, 2025 20:49
@mariobehling mariobehling requested a review from Copilot October 31, 2025 14:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

app/eventyay/static/pretixcontrol/js/sb-admin-2.js:22

  • Unused function isTabletView.
    function isTabletView() {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


// UNIVERSAL: Window resize handler
let resizeTimeout;
$(window).on('resize', function () {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is safer to apply / unapply sidebar-minimized, sidebar-hover purely in CSS, using media queries, than JavaScript.

@mariobehling mariobehling requested a review from Copilot November 5, 2025 23:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

app/eventyay/static/pretixcontrol/js/sb-admin-2.js:31

  • Unused function isDesktopView.
    function isDesktopView() {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

overflow-x: hidden;
scroll-behavior: smooth;
overscroll-behavior: contain;
contain: strict;
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

Using contain: strict can have unintended side effects as it applies layout, style, paint, and size containment. Consider using contain: layout style paint instead to avoid potential size containment issues that could affect the sidebar's ability to respond to content changes.

Suggested change
contain: strict;
contain: layout style paint;

Copilot uses AI. Check for mistakes.
@yaxit24
Copy link
Copy Markdown
Contributor Author

yaxit24 commented Nov 6, 2025

Screen.Recording.2025-11-06.at.12.58.42.AM.mov

Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

Thanks, please address copilot reviews.

@mariobehling mariobehling requested a review from Copilot November 6, 2025 14:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

Please address comments. Thanks.

Copy link
Copy Markdown
Member

@Gagan-Ram Gagan-Ram left a comment

Choose a reason for hiding this comment

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

Works as expected.
Please address copilot suggestions.

@mariobehling mariobehling requested a review from Copilot November 7, 2025 12:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

body.sidebar-minimized:has(.sidebar:hover) #page-wrapper {
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The :has() pseudo-class has limited browser support in older browsers. While it's well-supported in modern browsers (Safari 15.4+, Chrome 105+, Firefox 121+), consider providing a fallback or ensuring this is acceptable for your target browser support matrix. Browsers that don't support :has() will not apply the margin adjustment when hovering over the minimized sidebar.

Suggested change
body.sidebar-minimized:has(.sidebar:hover) #page-wrapper {
// The :has() pseudo-class has limited browser support (Safari 15.4+, Chrome 105+, Firefox 121+).
// For older browsers, use JS to add a .sidebar-hovered class to <body> when .sidebar is hovered.
body.sidebar-minimized:has(.sidebar:hover) #page-wrapper,
body.sidebar-minimized.sidebar-hovered #page-wrapper {

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +17
toggleSidebar(); const $navbar = $('.navbar');
const $pageWrapper = $('#page-wrapper');
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

Syntax error: There's a function call toggleSidebar(); placed in the middle of variable declarations. This call should be moved after all variable declarations are complete (after line 17 or later in the initialization flow).

Suggested change
toggleSidebar(); const $navbar = $('.navbar');
const $pageWrapper = $('#page-wrapper');
const $navbar = $('.navbar');
const $pageWrapper = $('#page-wrapper');
toggleSidebar();

Copilot uses AI. Check for mistakes.
function updateCSSVariables() {
document.documentElement.style.setProperty('--navbar-height', getNavbarHeight() + 'px');
}
const $sidebarToggleButton = $('#sidebar-toggle');
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

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

The $sidebarToggleButton variable is declared after the updateCSSVariables() function definition but before it's needed. Consider moving this declaration to be with the other variable declarations at the top (lines 14-17) for better code organization and readability.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@mariobehling mariobehling left a comment

Choose a reason for hiding this comment

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

Please address the remaining open comments in this PR. Thanks

Removed  whitespaces.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mariobehling mariobehling merged commit fc800c1 into fossasia:enext Nov 10, 2025
2 checks passed
Sak1012 pushed a commit to Sak1012/eventyay that referenced this pull request Nov 10, 2025
…ive and persistent behavior (fossasia#767)

* feat(ui): add burger menu toggle for collapsible sidebar with responsive and persistent behavior

* Updated with cps-decorators

* fixed ai reviews

* Edited files: admin.py, cfp.py, event.py, mixins.py

* Reverted changes in eventyay.cfg

* Remove unnecessary newline at end of mixins.py

* updated the eventyay.cfg

* solved ai reviews, added scrolling to sidebar.

* reverted app/eventyay.cfg modifications

* Improved code quality

* Update app/eventyay/static/pretixcontrol/scss/main.scss

Removed  whitespaces.

---------

Co-authored-by: Mario Behling <mb@mariobehling.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement burger menu to minimize left sidebar

5 participants