Skip to content

Commit

Permalink
DEV: Make hide category default when custom wizard is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
jumagura committed Sep 19, 2023
1 parent 10609f3 commit 0992e96
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,4 @@
options=(hash none="admin.wizard.select")
}}
</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>
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,12 @@ export default {
"wizardListVal",
attrs?.category?.custom_fields?.create_topic_wizard
);
component.set(
"hideFromComposer",
attrs?.category?.custom_fields?.custom_wizard_hide_from_composer
);
},

actions: {
changeWizard(wizard) {
this.set("wizardListVal", 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
);
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default {
let categories = this._super(options);

return categories.filter((category) => {
return !category.custom_fields?.custom_wizard_hide_from_composer;
return !category.custom_fields?.create_topic_wizard;
});
},
});
Expand Down
1 change: 0 additions & 1 deletion config/locales/client.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ en:
custom_wizard:
title: "Custom Wizard"
create_topic_wizard: "Select a wizard to replace the new topic composer in this category."
hide_from_composer: "Exclude category from composer dropdown"

message:
wizard:
Expand Down
3 changes: 1 addition & 2 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
# preloaded category custom fields
%w[
create_topic_wizard
custom_wizard_hide_from_composer
].each do |custom_field|
Site.preloaded_category_custom_fields << custom_field
end
Expand Down Expand Up @@ -202,7 +201,7 @@
::InvitesController.prepend InvitesControllerCustomWizard
::UsersController.prepend CustomWizardUsersController
::Guardian.prepend CustomWizardGuardian

full_path = "#{Rails.root}/plugins/discourse-custom-wizard/assets/stylesheets/wizard/wizard_custom.scss"
if Stylesheet::Importer.respond_to?(:plugin_assets)
Stylesheet::Importer.plugin_assets['wizard_custom'] = Set[full_path]
Expand Down
5 changes: 0 additions & 5 deletions test/javascripts/fixtures/categories.js.es6
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default {
navigate_to_first_post_after_read: false,
custom_fields: {
create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
},
allowed_tags: [],
allowed_tag_groups: [],
Expand Down Expand Up @@ -78,7 +77,6 @@ export default {
navigate_to_first_post_after_read: false,
custom_fields: {
create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
},
allowed_tags: [],
allowed_tag_groups: [],
Expand Down Expand Up @@ -123,7 +121,6 @@ export default {
navigate_to_first_post_after_read: false,
custom_fields: {
create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
},
allowed_tags: [],
allowed_tag_groups: [],
Expand Down Expand Up @@ -168,7 +165,6 @@ export default {
navigate_to_first_post_after_read: false,
custom_fields: {
create_topic_wizard: null,
custom_wizard_hide_from_composer: null,
},
allowed_tags: [],
allowed_tag_groups: [],
Expand Down Expand Up @@ -210,7 +206,6 @@ export default {
navigate_to_first_post_after_read: false,
custom_fields: {
create_topic_wizard: null,
custom_wizard_hide_from_composer: "t",
},
allowed_tags: [],
allowed_tag_groups: [],
Expand Down

0 comments on commit 0992e96

Please sign in to comment.