Skip to content

Commit f594602

Browse files
committed
DEV: Convert connector to a Glimmer component
1 parent d2ff1b5 commit f594602

File tree

4 files changed

+43
-39
lines changed

4 files changed

+43
-39
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h3>{{i18n "admin.wizard.category_settings.custom_wizard.title"}}</h3>
2+
3+
<section class="field new-topic-wizard">
4+
<label for="new-topic-wizard">
5+
{{i18n "admin.wizard.category_settings.custom_wizard.create_topic_wizard"}}
6+
</label>
7+
<div class="controls">
8+
<ComboBox
9+
@value={{this.wizardListVal}}
10+
@content={{this.wizardList}}
11+
@onChange={{this.changeWizard}}
12+
@options={{hash none="admin.wizard.select"}}
13+
/>
14+
</div>
15+
</section>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import Component from "@glimmer/component";
2+
import { action } from "@ember/object";
3+
import { tracked } from "@glimmer/tracking";
4+
import CustomWizardAdmin from "../models/custom-wizard-admin";
5+
import { popupAjaxError } from "discourse/lib/ajax-error";
6+
7+
export default class CustomWizardCategorySettings extends Component {
8+
@tracked wizardList = [];
9+
@tracked wizardListVal =
10+
this.args?.category?.custom_fields?.create_topic_wizard;
11+
12+
constructor() {
13+
super(...arguments);
14+
15+
CustomWizardAdmin.all()
16+
.then((result) => {
17+
this.wizardList = result;
18+
})
19+
.catch(popupAjaxError);
20+
}
21+
22+
@action
23+
changeWizard(wizard) {
24+
this.wizardListVal = wizard;
25+
this.args.category.custom_fields.create_topic_wizard = wizard;
26+
}
27+
}
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
<h3>{{i18n "admin.wizard.category_settings.custom_wizard.title"}}</h3>
2-
3-
<section class="field new-topic-wizard">
4-
<label for="new-topic-wizard">
5-
{{i18n "admin.wizard.category_settings.custom_wizard.create_topic_wizard"}}
6-
</label>
7-
<div class="controls">
8-
{{combo-box
9-
value=this.wizardListVal
10-
content=this.wizardList
11-
onChange=(action "changeWizard")
12-
options=(hash none="admin.wizard.select")
13-
}}
14-
</div>
15-
</section>
1+
<CustomWizardCategorySettings @category={{this.category}} />

assets/javascripts/discourse/connectors/category-custom-settings/custom-wizard-category-settings.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)