0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-26 02:50:28 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-custom-step.js.es6

43 Zeilen
979 B
Text

2020-04-01 12:58:30 +02:00
import { observes, on, default as discourseComputed } from 'discourse-common/utils/decorators';
import { not } from "@ember/object/computed";
2020-04-02 07:21:57 +02:00
import EmberObject from "@ember/object";
2020-04-05 03:37:09 +02:00
import Component from "@ember/component";
2017-10-19 04:17:36 +02:00
2020-04-05 03:37:09 +02:00
export default Component.extend({
2017-09-23 04:34:07 +02:00
classNames: 'wizard-custom-step',
2020-04-01 12:58:30 +02:00
disableId: not('step.isNew'),
2020-04-01 12:58:30 +02:00
@discourseComputed('wizardFields', 'wizard.steps')
2020-03-21 18:30:11 +01:00
requiredContent(wizardFields, steps) {
let content = wizardFields;
let actions = [];
steps.forEach(s => {
actions.push(...s.actions);
});
actions.forEach(a => {
if (a.type === 'route_to' && a.code) {
2020-04-01 07:03:26 +02:00
content.push(
2020-04-02 07:21:57 +02:00
EmberObject.create({
2020-04-01 07:03:26 +02:00
id: a.code,
label: "code (Route To)"
})
);
}
});
return content;
},
2020-03-30 01:53:28 +02:00
actions: {
bannerUploadDone(upload) {
this.set("step.banner", upload.url);
},
bannerUploadDeleted() {
this.set("step.banner", null);
}
}
2017-09-23 04:34:07 +02:00
});