From 289d2a5540fcd4cb347820e9933743a6e65a718e Mon Sep 17 00:00:00 2001
From: Alan Guo Xiang Tan
Date: Tue, 20 Jun 2023 08:17:53 +0800
Subject: [PATCH] DEV: Deselect all and reset to defaults btns to edit
categories modal (#22143)
What does this change do?
This change adds the deselect all and reset to defaults buttons to the
edit navigation menu categories modal. The deselect all button when
click deselects all the selected categories in the modal. If the user
saves with no categories selected, the user's categories section in the
navigation menu will be set to the site's top categories.
The reset to defaults button is only shown when the
`default_navigation_menu_categories` site setting has been configured.
When clicked, the user's categories section in the navigation menu is
automatically set to the categories defined by the
`default_navigation_menu_categories` site setting.
---
.../discourse/app/components/d-modal.hbs | 20 ++-
.../sidebar/categories-form-modal.hbs | 165 ++++++++++--------
.../sidebar/categories-form-modal.js | 20 ++-
app/assets/stylesheets/common/base/modal.scss | 2 +-
.../components/sidebar-categories-form.scss | 32 +++-
config/locales/client.en.yml | 6 +-
...ting_sidebar_categories_navigation_spec.rb | 47 ++++-
.../modals/sidebar_edit_categories.rb | 16 +-
8 files changed, 223 insertions(+), 85 deletions(-)
diff --git a/app/assets/javascripts/discourse/app/components/d-modal.hbs b/app/assets/javascripts/discourse/app/components/d-modal.hbs
index 5d9d1ce0077..fcb28cf6b2a 100644
--- a/app/assets/javascripts/discourse/app/components/d-modal.hbs
+++ b/app/assets/javascripts/discourse/app/components/d-modal.hbs
@@ -34,15 +34,19 @@
/>
{{/if}}
- {{#if this.title}}
-
-
{{this.title}}
+
+ {{#if this.title}}
+
+
{{this.title}}
- {{#if this.subtitle}}
-
{{this.subtitle}}
- {{/if}}
-
- {{/if}}
+ {{#if this.subtitle}}
+
{{this.subtitle}}
+ {{/if}}
+
+ {{/if}}
+
+
+
{{#if this.panels}}
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/categories-form-modal.hbs b/app/assets/javascripts/discourse/app/components/sidebar/categories-form-modal.hbs
index a1052778657..988eab9b7e1 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/categories-form-modal.hbs
+++ b/app/assets/javascripts/discourse/app/components/sidebar/categories-form-modal.hbs
@@ -1,75 +1,102 @@
-
-
+{{/in-element}}
- {{#if (gt this.filteredCategoriesGroupings.length 0)}}
- {{#each this.filteredCategoriesGroupings as |categories|}}
-