Header Submenus

We are using this theme component and it fits our needs almost perfectly. Thank you!

Now are considering supporting more languages in our site. Can this component be localized, so that it follows the language of the interface?

2 Likes

Hold up, is this:

Because of this?

Relief GIFs | Tenor

Just noticed this morning on 2.9.0.beta2. I can’t tell you how much this improves the functionality of the header submenu theme component. I’m gonna spend today moving things around just because I can :smiley:

9 Likes

Any way to add an admin/staff class to a drop down, or specific menu items.
No need for admin specific links, even if inaccessible, to be exposed. This would be useful

This custom menu looks really promising for the situation I’m in.

I have the JS version of discourse being served to Google, it’s looking good but I’m thinking of using this component to replace the current hamburger menu. Google is having trouble rendering the default JS hamburger menu.

1. Does this mean the menu doesn’t need Javascript to function? Or does it work similar to the original menu?

2. Can I hide the default hamburger menu while keeping this custom one enabled? (Did this with CSS display none)

Edit: OK seems no JS is used for this menu.

1 Like

can we get a baked in setting to display only to logged in users? or at least display at a specific trust level or above so as to essentially display it to logged inn users only.

I would think the TL concept would be useful if for each header item, or list item, an additional customizable item per link for minimum trust level to display the menu/link as it can be used to display some links to everyone and other links to staff (TL4) only.

1 Like

@Cozdabuch
I have this feature built in on my dropdown-header component. Though its best to use that component instead only if you don’t have too many menu items since it adds the items directly inline with Discourse’s default header bar.

1 Like

@keegan thanks. I’ve been thinking of using that TC cause it is cleaner and I saw the customizable feature set.

I have about 5-8 links in each of 3 menus. I was worried it was too many to display well. Thoughts?

1 Like

@Cozdabuch the links inside the menus can be much more, its mainly the top level items that need to be less. If you have just 3 that should be perfectly fine.

2 Likes

How would one go about enabling this for the crawler view?

Perhaps I can add something to the crawler html .erb file?

There seems to be a bug now when Fixed mode (always show the menu, even when scrolled down) is turned on.

I’m seeing this with Discourse 2.9.0.beta8, and also just reproduced it easily using the official Discourse theme preview site. I think I first noticed it about 2 weeks ago but I’m not entirely sure when it started happening.

To reproduce:

  • Turn on Fixed mode in the theme component’s settings.
  • Click on a thread with a lot of replies.
  • (If it’s the first time you’ve read the thread, and you’re at the very top, scroll down a few replies, go back to the thread list, then click the thread again, so you’re taken back to the post you were on.)

The amount of padding needed at the top of the page is miscalculated, resulting in the top of the post, and the name of the person who wrote it, being scrolled under the header and cut off.

You have to scroll up a bit every time you click on a thread, just to see whose post you’re reading.

You see this on entering the thread:

When you should see something like this:

What’s really strange is it does not always happen, and pushing Ctrl-F5 often fixes it. But it’ll happen again a little while later.

Editing the CSS to increase the amount of padding it adds to main-outlet sort-of fixes things, but then you get a lot of blank space at the top of topic lists. It seems like the topic lists and threads need different padding, or maybe one of them is adding the padding twice or some extra padding from somewhere else?

(Edit: Sometimes the page can’t scroll up far enough to see the problem. For example, when you go to the last post in a thread and it’s a short one, there’s no way for the header to overlap the poster’s name there, even if you scroll down as far as you can manually. That may account for some situations where things appear to work. Test with a browser window that isn’t very tall for the most reliable way to reproduce the bug.)

3 Likes

Is there any way to prevent this from showing on the login screen? I can do it with the following css, but this still presents the header submenu for a second, and then hides it.

.static-login .top-menu {
	display: none;
}
.static-login .d-header-wrap {
	display: none;
}

Is there a better way to prevent this from appearing during the static-login page?

1 Like

This and other themes will not work on the crawler view; the crawler view doesn’t load most of Discourse’s JavaScript.

3 Likes

Hey Kris, this component could use an update for use with the chat and sidebar. With the fixed_mode setting turned on, the chat and sidebar do not get moved down and sit behind the d-header.

The CSS below seems to fix things up nicely, except it doesn’t play well with Category Banners as it seems to be bumping the #main-outlet down an additional 40px on category pages. Thanks!

.sidebar-wrapper, .main-chat-outlet, .chat-drawer {
    margin-top: 40px !important;
}
2 Likes

Thanks for pointing this out! I’ve just added some fixes here:

1 Like

Awesome, thank you Kris! Any idea why the #main-outlet is dropping down 40px?

#main-outlet {
   padding-top: calc(1.8em + 40px);
}

2 Likes

Ah I overlooked that — that can be removed, and will be once this PR is merged: UX: remove old main-outlet adjustment by awesomerobot · Pull Request #19 · discourse/discourse-header-submenus · GitHub

Update: that’s now merged, so the extra space will go away if you update the component.

2 Likes

Where would a guy find the icon names?

3 Likes

I believe everything listed here is available for use: Find the Perfect Icon for Your Project in Font Awesome 5 | Font Awesome

Though some icons require an additional step… for icons we don’t use in Discourse by default the icon names needs to be added to the Svg icons theme setting.

If you really want to be specific, all the icons we use in Discourse by default are listed here: discourse/svg_sprite.rb at da0d20d4a99aab40bd08bf133a425be413521d5a · discourse/discourse · GitHub

And all the icons available for use in themes (via the svg icons setting) are in this directory: discourse/vendor/assets/svg-icons at main · discourse/discourse · GitHub

Viewing the SVG files in github isn’t really helpful, because you’ll see a big white box:

but you can click the raw button and view the page source, the icon name is the symbol’s id

3 Likes

You rock, thanks so much

2 Likes

Thanks Kris, that fixed it. I have noticed a couple of other issues though. .topic-navigation needs to be pushed down 40px, and .topic-post.sticky-avatar .topic-avatar seems to be calculated incorrectly when you scroll down, and it ends up behind the d-header. Also, it’s possible to expand the composer and chat window too high and lose the controls behind the d-header as well. I think that should cover everything!

Edit: one more thing, when you visit an anchor link the heading is under the header as well.

2 Likes