From db74e9484b0432b44d02ad279a5bf7a43b757923 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Tue, 21 Mar 2023 12:23:28 +1100 Subject: [PATCH] FEATURE: ability to reorder links in custom sidebar sections (#20626) Drag and drop to reorder custom sidebar sections --- .../app/components/sidebar/section.hbs | 9 ++- .../sidebar/user/custom-sections.hbs | 13 +++ .../sidebar/user/custom-sections.js | 34 ++------ .../components/sidebar/user/section-link.js | 63 +++++++++++++++ .../app/components/sidebar/user/section.js | 79 +++++++++++++++++++ .../app/controllers/sidebar-section-form.js | 5 +- .../discourse/app/modifiers/draggable.js | 2 +- .../stylesheets/common/base/_index.scss | 1 + .../common/base/sidebar-custom-section.scss | 34 ++++++++ .../stylesheets/common/base/sidebar.scss | 13 --- .../sidebar_sections_controller.rb | 24 ++++++ app/models/sidebar_section.rb | 2 +- app/models/sidebar_section_link.rb | 8 ++ config/routes.rb | 1 + ...0_add_position_to_sidebar_section_links.rb | 12 +++ .../sidebar_sections_controller_spec.rb | 62 ++++++++++++++- spec/system/custom_sidebar_sections_spec.rb | 27 +++++++ 17 files changed, 343 insertions(+), 46 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/sidebar/user/section-link.js create mode 100644 app/assets/javascripts/discourse/app/components/sidebar/user/section.js create mode 100644 app/assets/stylesheets/common/base/sidebar-custom-section.scss create mode 100644 db/migrate/20230307051200_add_position_to_sidebar_section_links.rb diff --git a/app/assets/javascripts/discourse/app/components/sidebar/section.hbs b/app/assets/javascripts/discourse/app/components/sidebar/section.hbs index fc2f5471ba6..11569ee5d0e 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/section.hbs +++ b/app/assets/javascripts/discourse/app/components/sidebar/section.hbs @@ -1,5 +1,12 @@ {{#if this.displaySection}} -
+