사이드바 메뉴 순서 변경

:information_source: 요약 기본 및 사용자 정의 사이드바 메뉴 섹션의 순서를 변경할 수 있습니다
:eyeglasses: 미리보기 https://discourse.theme-creator.io/theme/Lilly/discourse-sidebar-menu-reorder
:hammer_and_wrench: 저장소 https://github.com/Lillinator/sidebar-menu-reorder
:question: 설치 가이드 테마 또는 테마 컴포넌트 설치 방법

이 테마 컴포넌트 설치

:bulb: 소개

사이드바 메뉴 섹션, 특히 전역 사용자 정의 섹션의 순서를 변경하고 싶어하는 Discourse 관리자 요청을 여러 번 확인했습니다. 현재 CSS를 통해 이를 수행하는 것은 대부분의 사용자에게 직관적이지 않고 복잡하며, 관리 및 수정이 어려운 경우가 많습니다. 이에 따라 관리자 UI에서 이 작업을 훨씬 쉽게 수행할 수 있도록 테마 컴포넌트를 제작했습니다.

:woman_technologist:t2: 개요

이 Discourse 테마 컴포넌트는 관리자가 관리자 사용자 인터페이스에서 포럼의 사이드바 메뉴 섹션 순서를 변경할 수 있게 해줍니다. 이는 기본 섹션과 전역으로 표시되는 모든 사용자 정의 섹션을 포함합니다.

이 컴포넌트는 데스크톱 및 모바일 사이드바 뷰, 그리고 헤더 드롭다운 모드 모두에서 작동합니다(다만, 사이드바 모드를 위해 최적화되었습니다).


:wrench: 설치 및 설정

  • Discourse 테마 사용 입문 가이드에 따라 이 테마 컴포넌트를 설치합니다.
  • community 섹션은 사이드바의 기본 상단 섹션을 의미하며, Topics 헤더와 More 드롭다운 하위 메뉴를 포함합니다. community 섹션 위에 기본 또는 사용자 정의 섹션을 1~2개 이상 올리는 것은 권장되지 않습니다.
  • 설정에서 기본 섹션을 삭제하지 마세요. 삭제하면 순서가 어긋날 수 있습니다(언제든 다시 추가하거나 설정을 초기화할 수 있습니다).
  • 이 컴포넌트를 설정하는 가장 좋은 방법은 컴포넌트 관리자 화면(순서 변경 목록 설정 포함)을 하나의 브라우저 창에서, 그리고 테스트 사용자로 포럼 사이드바 뷰를 옆에 있는 다른 창에서 확인하는 것입니다. 목록에서 메뉴 섹션 순서를 변경할 때마다 페이지를 새로고침하세요.
  • 컴포넌트 관리자 설정에서 사용자 정의 섹션은 슬러그(slug) 명명 규칙을 사용해야 하며, 그렇지 않으면 무시됩니다(예: "Custom Menu Name"의 경우 custom-menu-name, "Useful Links"의 경우 useful-links 등).

:gear: 설정

설정 설명
Sidebar menu order 기본 메뉴 섹션을 포함하는 목록 설정입니다. (community는 사이드바의 기본 상단 섹션이며 More 드롭다운 하위 메뉴를 포함합니다.) 측면의 위/아래 화살표를 사용하여 메뉴 섹션의 순서를 변경합니다. 전역으로 표시되는 사용자 정의 섹션도 추가할 수 있습니다 - 메뉴 이름 슬러그를 사용하세요(예: Test Menu라는 제목의 사용자 정의 메뉴의 경우 설정에 test-menu를 추가).

테마 컴포넌트는 기본적으로 기본 설정을 사용합니다. 관리자는 순서 목록에 혼합하려는 전역 사용자 정의 메뉴 섹션을 추가한 다음, 기본 섹션과 함께 순서를 다시 정렬해야 합니다.

기본 컴포넌트 설정 스크린샷


:camera_flash: 스크린샷

아래 스크린샷은 community 섹션과 “Dev Links”(dev-links), “Toolbox”(toolbox)라는 두 개의 예시 사용자 정의 메뉴 섹션이 왼쪽의 컴포넌트 관리자 패널과 오른쪽의 일반 사용자에게 어떻게 표시되는지 보여줍니다. 컴포넌트 관리자 설정에서 메뉴 섹션을 위/아래로 이동하는 화살표는 작은 빨간색 상자에 표시되어 있습니다.


여기서는 설정이 기본 categories 섹션을 community 섹션 위에 표시하도록 구성되었습니다(접힘 및 펼침 모드):

다음은 두 개의 사용자 정의 섹션을 사용한 예시입니다: 하나는 기본 community 섹션 위에 있는 dev-links이고, 다른 하나는 기본 tags 섹션 아래에 있는 toolbox입니다.

또한, 위 관리자 스크린샷에서 inbox-section이라고 표시된 섹션을 주목해 보세요. 이는 Messages section for sidebar 컴포넌트가 사이드바에 삽입하는 Messages 섹션입니다(위에서 toolbox 사용자 정의 메뉴 아래). 이 컴포넌트를 사용하여 해당 섹션의 위치도 이동할 수 있음을 보여줍니다.

추가로, 이 테마 컴포넌트는 Group sidebar menusIndented subcategories 컴포넌트와 함께 사용할 수 있습니다(위 스크린샷 참조).


:backhand_index_pointing_right: 참고 사항

  • sidebar_menu_order 설정에 새로운 전역 사용자 정의 섹션을 추가한 후, 포럼 사용자는 브라우저를 새로고침하거나 사이드바를 접었다 펼쳤을 때 새로운 올바른 메뉴 순서를 확인하게 됩니다.
  • 이 컴포넌트가 활성화된 상태에서 새로운 전역 사용자 정의 메뉴 섹션을 생성하면, 사이드바가 다시 렌더링될 때까지(페이지 새로고침 또는 접기/펼치기) 관리자에게 일시적으로 중복된 섹션이 표시될 수 있습니다.
  • 사용자가 생성한 사용자 정의 메뉴 섹션은 해당 사용자의 사이드바 하단에 항상 표시되며, 그 외에는 영향을 받지 않습니다.
  • Admin -> All Site Settings -> Chat Separate Sidebar Mode 설정이 Always로 설정되어 있으면, 채팅 버튼은 평소와 같이 하단에 표시되며, 컴포넌트는 기본 채팅 메뉴 섹션(chat-dms, chat-channels, chat-search)을 무시합니다.

제 기타 Discourse 관련 작업 보기
29개의 좋아요

It’s so cool. I really like to use the categories (1) then chat (2) setup. Thank you very much for your nice work Lilly

4개의 좋아요

Is this still supported? I tried to install and I got the following error. I tried from here and also using the manual instructions.

Yes it is. The link in the “install this theme component” button is outdated, but the link at the top is still correct and you can use that for installing the component manually

Or you try this button

Install this theme component

2개의 좋아요

I’ve just fixed the link in the install button in the OP so all good now.

4개의 좋아요

I’ve come across a bit of a bug, where the specified order isn’t working when I have an unusually narrow ‘desktop’ screen - as on my folding phone.

Summary

This is how I want it to look:

   

When I have a weird sized screen (seems to be a width of 640-820 or so), I lose the order:

1개의 좋아요

oh god the return of the 2 column sidebar. i thought that thing was gone? will have a look…

edit: i can’t repro this - when i adjust the browser size on my ipad to get the 2-column compact sidebar, it is in the correct order specified by the component. when i adjust the viewport size using the dev console, the sidebar shows it in the correct order as well (regardless of the viewport size). :woman_shrugging:t2:

4개의 좋아요

Was indeed me being a bit thick! I was using the old component and didn’t even notice.

I have picked up one thing though - what has been called community is now called the-forum instead. Here is a PR to tidy that up in the defaults:

https://github.com/Lillinator/discourse-sidebar-menu-reorder/pull/3

1개의 좋아요

On my forum it’s still called community and here on Meta too.


I wonder how you changed it.

2개의 좋아요

That is indeed weird! I do recall changing the text on it at some stage now I think about it. But not sure how that got into the HTML!

I’ll withdraw that PR and scratch my head a bit more. It might have to remain a ‘quirk’ of my site!

1개의 좋아요

you should be able to do some rails commands to rename it back. if your section is indeed called the-forum, then i think this should work from the rails console:

cd /var/discourse
./launcher enter app
rails c
section = SidebarSection.find_by(title: 'the-forum', public: true)
if section
  section.update!(title: 'community')
  puts "Done: renamed to 'community'."
else
  puts "Section not found."
end

definitely back up first.

3개의 좋아요

Just (finally) tried this. It didn’t find the section though:

I think that this might just have to remain a quirk of the site, eh?

1개의 좋아요

@nathank - ok i played around with this on my test instance and i was able to rename the section the-forum and then back to community.

when in the rails console, if you do:

SidebarSection.where(public: true).pluck(:id, :title, :section_type)

what does it output?

i am guessing it should give something like:

=> [..., [1, "the-forum", "community"]]

or

=> [..., [1, "The Forum", "community"]]

which would verify it is section_type = community with a different title. then we can do:

# find the default community section via rails enum
section = SidebarSection.find_by(section_type: :community)

# fallback: if not found by type, then look for the specific custom title
section ||= SidebarSection.find_by(title: 'the-forum', public: true)

if section
  section.update!(title: 'Community')
  puts "Success: The section has been renamed back to 'Community'."
else
  puts "Error: Section not found."
end

screenshot of my rails console showing the community section titled the-forum and renaming it back to Community, then verifying it was changed:

2개의 좋아요

Note: i just pushed some mobile fixes for this component - it had started rendering the horizontal lines between sidebar sections that should only show on desktop/tablet views.

2개의 좋아요

I’m using this lovely theme component alongside Lilly’s equally lovely Discourse Group Sidebar Menus component. My use case is creating custom menus for clients so everyone in an organization can have quick links relevant specific to them, right at the top, after the community section.

Wanted to note for future travelers (including myself) that the sidebar section name is very sensitive and has to be an exact match, with spaces in the name converted to dashes. So “Doing business” becomes “doing-business”.

This is all well and good but when I created the group sidebar section I had put a space at the end of the group name accidentally, which became “doing-business-”. It took me some troubleshooting with developer tools to discover this.

These features are so important to me that I would really appreciate them being considered for adding to core, so they can be more readily available and easy to use on any discourse site. :folded_hands:

2개의 좋아요

thanks Tobias. i actually mention to use the section name slugs in the setting description, and it is also indicated in the screenshot examples (see “dev-links” = DEV LINKS).

perhaps i should add it elsewhere besides the setting descriptions. :thinking:

edit: done

6개의 좋아요

이 테마 컴포넌트를 사용하여 사이드바에서 동일한 슬러그를 사용하거나 순서를 변경할 수 있을까요?

내 사용 사례는 무료 사용자와 구독 사용자 간에 다른 수준의 접근 권한을 가지되, 동일한 제목을 표시하는 것입니다.

정확히 어떤 의미인지 잘 모르겠네요. 이건 단순히 섹션의 순서를 바꾸는 것뿐이며, 슬러그 이름은 고유해야 합니다. 서로 다른 이름을 붙이고 Group Sidebar Menus 와 함께 사용하세요.

이해합니다. 저는 ‘새로운’ 사이드바 섹션에 아주 유사한 이름을 붙여야 합니다.

같은 내비게이션 바 섹션에서 두 개의 다른 링크를 사용하여 각 내용을 구분하려 하고 있습니다. '접근 권한이 없습니다’라는 일반적인 동작 방식이 제게는 조금 어렵게 느껴집니다.

이 컴포넌트와 관련하여 이것이 무슨 의미인지 전혀 모르겠습니다