1
0
Fork 0

DEV: Make hide category default when custom wizard is selected

Dieser Commit ist enthalten in:
jumagura 2023-09-19 14:17:06 -04:00
Ursprung 10609f33e2
Commit 0992e9601c
6 geänderte Dateien mit 2 neuen und 30 gelöschten Zeilen

Datei anzeigen

@ -12,14 +12,4 @@
options=(hash none="admin.wizard.select") options=(hash none="admin.wizard.select")
}} }}
</div> </div>
</section>
<section class="field hide-from-composer">
<label>
<Input
@type="checkbox"
@checked={{hideFromComposer}}
{{on "change" (action "toggleHideFromComposer")}}
/>
{{i18n "admin.wizard.category_settings.custom_wizard.hide_from_composer"}}
</label>
</section> </section>

Datei anzeigen

@ -13,10 +13,6 @@ export default {
"wizardListVal", "wizardListVal",
attrs?.category?.custom_fields?.create_topic_wizard attrs?.category?.custom_fields?.create_topic_wizard
); );
component.set(
"hideFromComposer",
attrs?.category?.custom_fields?.custom_wizard_hide_from_composer
);
}, },
actions: { actions: {
@ -24,12 +20,5 @@ export default {
this.set("wizardListVal", wizard); this.set("wizardListVal", wizard);
this.set("category.custom_fields.create_topic_wizard", wizard); this.set("category.custom_fields.create_topic_wizard", wizard);
}, },
toggleHideFromComposer() {
this.toggleProperty("hideFromComposer");
this.set(
"category.custom_fields.custom_wizard_hide_from_composer",
this.hideFromComposer
);
},
}, },
}; };

Datei anzeigen

@ -89,7 +89,7 @@ export default {
let categories = this._super(options); let categories = this._super(options);
return categories.filter((category) => { return categories.filter((category) => {
return !category.custom_fields?.custom_wizard_hide_from_composer; return !category.custom_fields?.create_topic_wizard;
}); });
}, },
}); });

Datei anzeigen

@ -133,7 +133,6 @@ en:
custom_wizard: custom_wizard:
title: "Custom Wizard" title: "Custom Wizard"
create_topic_wizard: "Select a wizard to replace the new topic composer in this category." create_topic_wizard: "Select a wizard to replace the new topic composer in this category."
hide_from_composer: "Exclude category from composer dropdown"
message: message:
wizard: wizard:

Datei anzeigen

@ -105,7 +105,6 @@ after_initialize do
# preloaded category custom fields # preloaded category custom fields
%w[ %w[
create_topic_wizard create_topic_wizard
custom_wizard_hide_from_composer
].each do |custom_field| ].each do |custom_field|
Site.preloaded_category_custom_fields << custom_field Site.preloaded_category_custom_fields << custom_field
end end
@ -202,7 +201,7 @@ after_initialize do
::InvitesController.prepend InvitesControllerCustomWizard ::InvitesController.prepend InvitesControllerCustomWizard
::UsersController.prepend CustomWizardUsersController ::UsersController.prepend CustomWizardUsersController
::Guardian.prepend CustomWizardGuardian ::Guardian.prepend CustomWizardGuardian
full_path = "#{Rails.root}/plugins/discourse-custom-wizard/assets/stylesheets/wizard/wizard_custom.scss" full_path = "#{Rails.root}/plugins/discourse-custom-wizard/assets/stylesheets/wizard/wizard_custom.scss"
if Stylesheet::Importer.respond_to?(:plugin_assets) if Stylesheet::Importer.respond_to?(:plugin_assets)
Stylesheet::Importer.plugin_assets['wizard_custom'] = Set[full_path] Stylesheet::Importer.plugin_assets['wizard_custom'] = Set[full_path]

Datei anzeigen

@ -33,7 +33,6 @@ export default {
navigate_to_first_post_after_read: false, navigate_to_first_post_after_read: false,
custom_fields: { custom_fields: {
create_topic_wizard: null, create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
}, },
allowed_tags: [], allowed_tags: [],
allowed_tag_groups: [], allowed_tag_groups: [],
@ -78,7 +77,6 @@ export default {
navigate_to_first_post_after_read: false, navigate_to_first_post_after_read: false,
custom_fields: { custom_fields: {
create_topic_wizard: null, create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
}, },
allowed_tags: [], allowed_tags: [],
allowed_tag_groups: [], allowed_tag_groups: [],
@ -123,7 +121,6 @@ export default {
navigate_to_first_post_after_read: false, navigate_to_first_post_after_read: false,
custom_fields: { custom_fields: {
create_topic_wizard: null, create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
}, },
allowed_tags: [], allowed_tags: [],
allowed_tag_groups: [], allowed_tag_groups: [],
@ -168,7 +165,6 @@ export default {
navigate_to_first_post_after_read: false, navigate_to_first_post_after_read: false,
custom_fields: { custom_fields: {
create_topic_wizard: null, create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
}, },
allowed_tags: [], allowed_tags: [],
allowed_tag_groups: [], allowed_tag_groups: [],
@ -210,7 +206,6 @@ export default {
navigate_to_first_post_after_read: false, navigate_to_first_post_after_read: false,
custom_fields: { custom_fields: {
create_topic_wizard: null, create_topic_wizard: null,
custom_wizard_hide_from_composer: "t",
}, },
allowed_tags: [], allowed_tags: [],
allowed_tag_groups: [], allowed_tag_groups: [],