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

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
How to add new button in different color
(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


What should I18n be replaced with in new versions?
(Stephen) #11

Did the repo move?

/var/www/discourse/lib/theme_store/git_importer.rb:70:in `import_public!’: Cloning into ‘/tmp/discourse_theme_15010b0404e56893c571bc878a3e85a0’… fatal: could not read Username for ‘https://github.com’: No such device or address


(Daniela) #12

Nah, try again

and be careful not to leave empty spaces before pasting the link

image


(Stephen) #13

This has worked for ages, the error is new. Because it’s updating rather than being added I can edit the name but not the repo?


(Daniela) #14

You can modify always the name.
Can you try to import the component again?


(Stephen) #15

I can, but that wasn’t the question. I’m asking because if a repo can be moved and the user has no means to edit the repo there are certain implications in terms of lost css/html edits.

The UI doesn’t display the repo path, is it available anywhere else before I go looking through the DB?


(Daniela) #16

At the moment no, but considers that the page of themes is constantly updated. Report any missing/thing-that-does-not-work on a separate topic so the team can make the appropriate checks.


(Stephen) #17

Sure, once I’m able to ascertain that it has changed I can report it. I updated three other components without issue, this one gives the error above.


(Daniela) #18

@Johani can you take a look when you have 5 minutes?


(Joe) #19

I just tried updating the component and it went ok.

Correct, it’s not possible to edit the remote repository location from the UI.

This should not happen as admins are not supposed to edit the code of a theme / theme component.

Any edits made would be lost if you update the component - even a normal update. The better option is for theme developers to use theme settings to allow admins to configure certain aspects of the theme / component.

@dax is correct, the UI does not display the remote location of the component’s repository. But if you really need it, you can export the the component and look for remote_url


(Stephen) #20

Confirmed, it was from a different repo, the error was because it has since been marked private or deleted.