Composant Thème Masqueur de Catégorie

Hi all, I’ve created a simple theme component. I hope this could be of use for some!

:eyeglasses: Overview

This is a theme component that allows you to hide specific categories from either the hamburger menu or category boxes.

:thinking: Why would you need this component?

If your discourse website has a lot of categories and you would like to hide some from appearing in either the menu bar or on the main page, this component can be helpful.

:framed_picture: Screenshots

Preview of Hamburger Menu: Before → After

:gear: Settings Menu:

More details on how to use this theme component and installation instructions are available at the component’s GitHub repository.

14 « J'aime »

This looks pretty cool, but what advantage does it give you over muting a category?

5 « J'aime »

Correct me if I’m wrong, but from what I understand is that when I mute a category it basically means no notifications? :thinking: When I tried muting a category it still appears in the hamburger menu and category boxes.

This theme component is more of a stylistic change. It hides desired categories visually, but still keeps notifications and all other functionality for the category intact.

2 « J'aime »

This only occurs (I think) if the user has a topic in one of those categories that is unmuted.

Your component would prevent that occurring, which could be helpful in situations where you really want to suppress the category and keep things tidy.

4 « J'aime »

Hey keegan,

this component looks exactly like something we need in the future. Our use case is very specific in which we want to hide sub-categories from one specific parent category.

In combination with the code snippet from here this might achieve exactly what we are looking for:

2 « J'aime »

Hi this seems to be broken after latest discourse update.

1 « J'aime »

@Heliosurge Thanks for letting me know, will fix this as soon as I can and will post an update here.

2 « J'aime »

Hey @Heliosurge,

The issues with the theme component are now fixed. It should be working correctly now.

3 « J'aime »

Thank you Keegan. An interesting idea as had posted a help topic as had used css prior to accomplish this.

One member @manuel had given me a great piece of css as I was using this to hide many subcategories so only Parents show in hamburger.

So as a Though maybe adding a toggle to hide just subcategories.

.hamburger-panel .category-link.subcategory {
      display:none;
}

This setting can make things very convenient if ppl have alot of subs to hide.

4 « J'aime »

@Heliosurge

Sounds very convenient! Thanks! I’ve added that now to this theme component, so you can now toggle the ability to hide subcategories in the hamburger menu and/or category-list context.

3 « J'aime »

Awesome! Thank you keep up the fantastic work.

:beers::sunglasses::+1::sparkles:

1 « J'aime »


Bonjour @keegan
Pouvons-nous masquer la catégorie dans le menu supérieur ?
Merci !

Je reçois l’erreur suivante lors de l’installation (sur 3.1.0beta3) :

Erreur : attendu ]. ┌──> /tmp/discourse_theme_526e702e5adb76bf8137c869c5f6d389/discourse-category-hider/stylesheets/mobile/categories.scss 6 │ [data-category-id=‘#{$box}’] { │ ^^^^ ╵ ╷ 1 │ [data-category-id=“str-split(, "|")”] │ ━ erreur dans la sortie interpolée ╵ mobile/categories.scss 6:26 @import /var/www/discourse/mobile.scss 1:993 root stylesheet

2 « J'aime »

oui, ce serait utile sauf que l’installation est maintenant cassée pour la dernière version de Discourse.

Je viens de publier un correctif, veuillez réessayer l’installation/la mise à jour du composant.

Je viens d’ajouter cette fonctionnalité. Vous pouvez maintenant ajouter le nom de la catégorie au paramètre de thème category_breadcrumb pour masquer certaines catégories du menu déroulant des miettes de pain de catégorie.

5 « J'aime »

Excusez-moi, mais pas d’effet


Ai-je raison ?

1 « J'aime »

Assurez-vous d’utiliser le nom de la catégorie pour celle-ci, et non son slug.

3 « J'aime »

Merci,
Succès,
Tout le monde, remarquez les majuscules ou les minuscules

4 « J'aime »

Salut

Ce composant fonctionne bien dans l’écran de catégorie standard et le fil d’Ariane, cependant :

Il ne supprime pas les catégories du menu hamburger, sauf si la barre latérale est définie sur héritée.

Y a-t-il un moyen de masquer les catégories dans la barre latérale/hamburger standard ?

J’ai essayé le paramètre « catégorie hamburger », mais je n’arrive pas à le faire fonctionner.

Merci

2 « J'aime »

Salut @martyn_thomas

Vous pouvez définir les catégories dans le menu de navigation avec les paramètres d’administration - default_navigation_menu_categories - ce paramètre vous permet de sélectionner les catégories qui seront affichées par défaut dans la section Catégories du menu de navigation. Les utilisateurs peuvent outrepasser cela et personnaliser leur propre section de menu de catégories en cliquant sur l’icône du crayon à côté de l’en-tête Catégories, tout comme vous pouvez le faire, et cela devrait généralement être encouragé.

2 « J'aime »