Add /users to top nav

theme-component

(Sam Saffron) #1

Location

repo: GitHub - SamSaffron/discourse-users-nav: Add users nav for Discourse (theme component)

Preview

https://theme-creator.discourse.org/theme/sam/users-top-nav

About

This theme component adds the full nav bar on both mobile and desktop on the users page:


Install guide

How to install a theme or theme component


How to add /users on Top Menu?
Users can't find a list of the other users
Add /groups to top nav
(Joe Buhlig) #2

Nice! This is much more elegant than what I quickly hacked together. :thumbsup:


(Alex Armstrong) #3

Any interest in expanding this theme (or adding a sister theme) to list Groups as well?


(Sam Saffron) #4

I think it would be another component pretty easy to do based off this component


(Alex Armstrong) #5

It is. I managed to create a separate theme component for Groups that works, basically be replacing “users” with “groups”. I won’t pretend that I understand most of it :slight_smile:

I’d like to do the same to Tags as well, which will likely require more adjustments than the above.

And I’d also like to be able to re-order the items so that they appear in this order: Categories (part of the default menu), Tags, Users, Groups.

I don’t think it would be possible to do the re-ordering unless all these were in the same component. It would also be DRYier. Is there a facility for giving options to components?


(Sam Saffron) #6

Not a worry, but please share it as a theme component here if you can, I added you to the theme_authors group!

This is doable … albeit tricky…

When var list = this._super(category, args); you have access to the list, so, for example if you always want groups to be after users.

  1. If you are adding users always insert it before groups if groups exists in the list
  2. If you are adding groups always insert at end

(Alex Armstrong) #7

I’ve made the component (such as it is) available here:

I’ll try the re-ordering business another day.


(Sam Saffron) #8

Sure, can you make a dedicated #plugin:theme topic for this, with a screenshot and so on!


(Alex Armstrong) #9

All done: Add /groups to top nav

Hopefully it won’t eat anyone’s lunch, cause I still don’t know how it does what it does :smiley:


(Pad Pors) #10

this theme gives an error for Persian locale, removing this line helps:

I18n.translations.en.js.filters.users = { title: "Users", help: "User leaderboard" };

but then the string becomes something like this:

image