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

Allow theme without second topbar menu #6725

Closed
marc-farre opened this issue Dec 11, 2023 · 4 comments
Closed

Allow theme without second topbar menu #6725

marc-farre opened this issue Dec 11, 2023 · 4 comments

Comments

@marc-farre
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

  1. Create a theme without #topbar-second element, e.g. the Clean Theme.
  2. In the console, you'll have Uncaught TypeError: Cannot read properties of undefined (reading 'offsetHeight')

The problem is because of $topBarSecond[0].offsetHeight here: https://github.com/humhub/humhub/blob/master/static/js/humhub/humhub.ui.topNavigation.js#L52C42-L52C71

Describe the solution you'd like

Test if #topbar-second exists before reading it with JS.

@marc-farre
Copy link
Collaborator Author

@luke- would you accept a PR where I add tests in humhub.ui.topNavigation.js and humhub.ui.view.js?
Or should I add an empty <div id="topbar-second"></div> in the theme?

@luke-
Copy link
Contributor

luke- commented Dec 11, 2023

@marc-farre Yes, would be fine for me. So feel free to create a PR which tests if the second toolbar exists.

@marc-farre
Copy link
Collaborator Author

@luke- PR #6728

I've changed the way of calculating the topbar menus height: https://github.com/humhub/humhub/pull/6728/files#diff-b154946f00749e44d107396a9627ecd5987a0bab499487d466968f514df4bdc3R163-R168

Before: Position of the second menu from the top + height of the second menu
After: sum of the heights of all top menus (based on .topmenu class)

@luke-
Copy link
Contributor

luke- commented Dec 13, 2023

@marc-farre Looks fine for me. Thanks!

@luke- luke- closed this as completed Dec 13, 2023
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

No branches or pull requests

2 participants