مكون سمة إخفاء الفئات

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 إعجابًا

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

5 إعجابات

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)

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 إعجابات

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)

Hi this seems to be broken after latest discourse update.

إعجاب واحد (1)

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

إعجابَين (2)

Hey @Heliosurge,

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

3 إعجابات

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 إعجابات

@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 إعجابات

Awesome! Thank you keep up the fantastic work.

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

إعجاب واحد (1)


مرحباً @keegan
هل يمكننا إخفاء الفئة في القائمة العلوية؟
شكراً لك!

أتلقى الخطأ التالي عند التثبيت (على 3.1.0beta3):

Error: expected “]”. ┌──> /tmp/discourse_theme_526e702e5adb76bf8137c869c5f6d389/discourse-category-hider/stylesheets/mobile/categories.scss 6 │ [data-category-id=‘#{$box}’] { │ ^^^^ ╵ ╷ 1 │ [data-category-id=“str-split(, "|")”] │ ━ error in interpolated output ╵ mobile/categories.scss 6:26 @import /var/www/discourse/mobile.scss 1:993 root stylesheet

إعجابَين (2)

نعم، سيكون هذا مفيدًا باستثناء أن التثبيت معطل الآن لأحدث إصدار من Discourse.

لقد قمت للتو بنشر إصلاح، يرجى محاولة التثبيت مرة أخرى/تحديث المكون.

لقد أضفت هذه الميزة للتو. يمكنك الآن إضافة اسم الفئة إلى إعداد السمة category_breadcrumb لإخفاء فئات معينة من القائمة المنسدلة لمسار الفئة.

5 إعجابات

عذرا، ولكن ليس هناك تأثير


هل أنا على حق؟

إعجاب واحد (1)

تأكد من استخدام اسم الفئة لهذا، وليس اسم الفئة المختصر.

3 إعجابات

شكرا لك،
نجاح،
الجميع، لاحظ الأحرف الكبيرة أو الصغيرة

4 إعجابات

مرحباً

تعمل هذه المكونة بشكل جيد في شاشة الفئة القياسية وشريط التنقل، ولكن:

إنها لا تزيل الفئات من قائمة الهامبرغر، إلا إذا تم تعيين الشريط الجانبي إلى الوضع القديم.

هل هناك طريقة لإخفاء الفئات في الشريط الجانبي/قائمة الهامبرغر القياسية؟

لقد جربت إعداد “قائمة هامبرغر للفئة”، لكن لا يبدو أنني تمكنت من جعلها تعمل.

شكراً

إعجابَين (2)

مرحباً @martyn_thomas

يمكنك تعيين الفئات في قائمة التنقل باستخدام إعدادات المسؤول - default_navigation_menu_categories - يسمح لك هذا الإعداد بتحديد الفئات التي سيتم عرضها ضمن قسم فئات قائمة التنقل بشكل افتراضي. يمكن للمستخدمين تجاوز هذا وتخصيص قسم قائمة الفئات الخاص بهم عن طريق النقر على أيقونة القلم بجوار رأس الفئات تمامًا كما يمكنك، ويجب تشجيع ذلك بشكل عام.

إعجابَين (2)