Skip to content

Option: navbar sticks on top of the window#1121

Merged
fbacall merged 3 commits into
ElixirTeSS:masterfrom
kennethrioja:ui-navbar-reduction
Jul 14, 2025
Merged

Option: navbar sticks on top of the window#1121
fbacall merged 3 commits into
ElixirTeSS:masterfrom
kennethrioja:ui-navbar-reduction

Conversation

@kennethrioja

Copy link
Copy Markdown
Contributor

Fix #1120

Summary of changes

  • tess.example.yml: you have now sticky_navbar option under feature, set to false by default, when true it allows the header to stick to the top of the window and shrink (animated) a bit while scrolling down
  • application.js and application.scss: added the .erb extension to both files to allow <% if TeSS::Config.feature['sticky_navbar'] %>
  • _header.hrml.erb: incorporated header_notice to the header class="unified-header"> to allow sticking to the top at anytime

Motivation and context

Not being able to click on the navbar when in the bottom of the window, it is frustrating and 'effortful' to scroll to the top everytime

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree
    to license it to the TeSS codebase under the
    BSD license.

@kennethrioja
kennethrioja force-pushed the ui-navbar-reduction branch from b027c4c to 0a98e8a Compare July 3, 2025 12:07
@kennethrioja kennethrioja changed the title feat(navbar): optional, can have navbar stuck on top of the window Option: navbar sticks on top of the window Jul 3, 2025
Comment on lines +376 to +383

<% if TeSS::Config.feature['sticky_navbar'] %>
/**
* Created by Kenneth Rioja on 02.07.2025
*
* Sticky Navbar
*/

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.

I would not toggle the feature this way, since it would involve rebuilding the JS/CSS if the feature is toggled.

Instead you can add a class or data attribute to the header (or body element even) in the ERB templates if the feature is enabled, and then check for that class/attribute dynamically with a JS selector.

Comment on lines +1019 to +1024

<% if TeSS::Config.feature['sticky_navbar'] %>
.navbar {
border-radius: 0;
font-size: larger;
padding-top: 20px;

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.

See other comment.

If you add an additional class to the header when the sticky navbar feature is enabled, you can just add the CSS rules to that class and they will be ignored if the feature is not enabled.

@fbacall
fbacall merged commit 688c742 into ElixirTeSS:master Jul 14, 2025
7 checks passed
@kennethrioja
kennethrioja deleted the ui-navbar-reduction branch July 14, 2025 14:57
@kennethrioja kennethrioja mentioned this pull request Oct 14, 2025
2 tasks
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.

UI – make navbar stick to top of the window

2 participants