잠금 배지 아이콘 숨기기

:information_source: 요약 보안 카테고리 및 채팅 채널의 잠금 배지 아이콘을 숨깁니다
:hammer_and_wrench: 저장소 https://github.com/Lillinator/hide-lock-badge-icon
:question: 설치 가이드 테마 또는 테마 컴포넌트 설치 방법

이 테마 컴포넌트 설치

개요

이 간단한 테마 컴포넌트는 드롭다운 카테고리 선택기, 헤더 브레드크럼, 내비게이션 사이드바 메뉴, 검색 결과 및 해당 카테고리 채팅 채널에서 보안 카테고리의 잠금 배지 아이콘을 숨길 수 있게 해줍니다.

일부 사용자는 잠금 아이콘이 카테고리가 잠겨 있어 접근할 수 없다는 의미라고 오해할 수 있습니다. Discourse에서는 접근 권한이 있는 내용만 볼 수 있으므로, 잠금 아이콘은 단순히 해당 카테고리가 다른 사용자에게 제한되어 있음을 나타내는 지표입니다. 또한, 잠금 아이콘은 닫힌 토픽을 나타내는 데에도 사용됩니다(이 컴포넌트는 이러한 아이콘은 숨기지 않습니다). 따라서 일부 관리자는 카테고리 잠금 아이콘을 완전히 숨기는 것을 원할 수 있으며, 이 컴포넌트는 바로 그 기능을 수행합니다.

설정

설정 항목은 하나입니다. 스태프(관리자)를 위한 토글 옵션으로, 잠금 아이콘을 보는 것이 스태프 멤버에게 유용한 지표가 될 수 있기 때문입니다.

스크린샷

컴포넌트 효과

컴포넌트 비활성화 시:

컴포넌트 활성화 시:


Lilly의 다른 Discourse 관련 콘텐츠 보기
16개의 좋아요

Nice! I’ve hacked a solution together for this a few times on various sites - brilliant to have it as a configurable theme component. You’ve got a knack for churning out some really useful customisations!!

Just checking - is it possible to use a Category selector instead of specifying each slug and ID? I would have thought that would be more durable for those like me who occasionally rename / move categories. Also, it might help with managing subcategories.

BTW at the mo, how should we input subcats?

2개의 좋아요

Thank you Nathan! I appreciate that :slight_smile:

The lock icons are actually a bit tricky to hide in some places, that’s why the category ID is also required. I’m trying to figure out doing it also for search results but singling out select categories in the results seems near impossible. :upside_down_face:

2개의 좋아요

oh good point. Can separate the slugs with a forward slash like category-slug/subcategory-slug (ie: boats/motorboats;8) and just use the subcategory ID. But a subcategory will inherit the parent category if you are hiding the lock icon there.

I will add this to the OP.

Yea I actually started developing it this way but I was getting results that were not what I expected. I will continue to work this method out because it is preferred for the reasons you describe. Thanks for the great feedback Nathan, I appreciate it. :slight_smile:

2개의 좋아요

I have updated the component for some of the field descriptions with corrections and more information about subcategories, and also edited the OP with the correct instructions for using subcategories.

3개의 좋아요

Excellent theme component that was created in response to a question I had on another topic here. Can’t thank you enough for putting in the time to help us non-CSS experts manage their forum more effectively.

2개의 좋아요

Ooh, thanks for this. I find all of those icons to be more distracting than informative — especially because they can mean so many different things in terms of actual access.

1개의 좋아요

I have updated this component with the following:

  • setting for toggling display of lock icons for Staff
  • leaving categories field blank default hides lock icon for all secured categories
  • now hides lock in search results and search menu panel
  • lock is hidden in the navigation sidebar menu category selector modal

4개의 좋아요

Nice!!! I love the extension to the navigation sidebar and search.

Have you had any further thoughts on having it as a category selector? To my ignorant mind, both the slug and the ID should be relatively straightforward to obtain from the category object.

1개의 좋아요

heh, yea I worked on this a bit and got close but I was having trouble with the javascript to get the category slug from the ID. I know it’s possible and which methods in the existing library to use and the basic framework, I just need to spend some more time on it and debug. I have it so I can get most of it with the category selector, but in some places it requires the slug. I’m sure someone more proficient in javascript would be able to do it faster. LolaBot (GPT) was no help at all and kept creating nebulous arrays from thin air. lol

When I have some downtime, finishing it is on my Todo list. Also, now I have some more javascript gurus at my disposal. hehe

3개의 좋아요

:clinking_glasses:

Another feature request

Would this TC be a good place for an alternative lock icon for categories?

I believe that :unlock: makes quite a bit more sense for categories and subcategories in Discourse. :lock: seems a much better fit for closed topics.

BTW this has definitely hit the rule of threes (including yourself!). AND co-CEO love:

This is possible and I toyed with it when I was doing the component. When I replaced it with the unlocked padlock the difference in appearance wasn’t that noticeable because the icons are so small (the locked and unlocked ones don’t look much different at that size). I may revisit this. Even the key didn’t look great at that size. TBH.

2개의 좋아요

I think the Category Icons theme component already has that feature if that’s any use?

4개의 좋아요

It didn’t work on the sidebar last time I looked - that was probably fixed ages ago! But it works well now - thanks!

Perhaps the best path of all would be to combine the two TCs into one, as they both pertain to icons associated with categories, and this is an area of overlap.

1개의 좋아요

Would you be open to adding compatibility with this excellent (but unofficial) Theme Component?

Or maybe it should go the other way around and that should be made compatible with this one. What do you think?

2개의 좋아요

Happy for anyone to put a pull request in including this? It looks like a useful addition.

2개의 좋아요

I’m open to whatever works. I don’t have time at the moment to work on this, but I know we have a general plan to make the hide lock badge component official, we just haven’t gotten to it just yet. I’m also wanting to improve it a bit - the category setting in particular isn’t intuitive enough; I really dislike those kind of delimited text input fields with separators. Probably could use a bit of a code refresh and update given some of our core changes. Feel free to fork and hack! PRs always welcome. I think this was one of the first theme components I built.

2개의 좋아요

I’ve noticed a wee bug in this:

When I apply this to a Category, it also affects all subcategories of that Category (unhelpfully); this prevents it from being useful in my context of having restricted private subcategories.

2개의 좋아요

And here is a PR to address it:

https://github.com/Lillinator/hide-lock-badge-icon/pull/3

1개의 좋아요

Merged. thanks for doing that Nathan! :hugs:

1개의 좋아요