0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00
Dieser Commit ist enthalten in:
Angus McLeod 2020-04-07 21:06:35 +10:00
Ursprung a20c74a943
Commit 6ced0cf13c
4 geänderte Dateien mit 24 neuen und 20 gelöschten Zeilen

Datei anzeigen

@ -29,6 +29,21 @@ export default Component.extend({
} }
}, },
setupTypeOutput(fieldType, options) {
const selectionType = {
category: 'category',
tag: 'tag',
group: 'group'
}[fieldType];
if (selectionType) {
options[`${selectionType}Selection`] = 'output';
options.outputDefaultSelection = selectionType;
}
return options;
},
@discourseComputed('field.type') @discourseComputed('field.type')
contentOptions(fieldType) { contentOptions(fieldType) {
let options = { let options = {
@ -38,17 +53,18 @@ export default Component.extend({
context: 'field' context: 'field'
} }
options = this.setupTypeOutput(fieldType, options);
if (this.isDropdown) { if (this.isDropdown) {
options.wizardFieldSelection = 'key,value'; options.wizardFieldSelection = 'key,value';
options.listSelection = 'assignment'; options.listSelection += ',assignment';
options.inputTypes = 'association,assignment'; options.inputTypes = 'association,assignment';
options.singular = true; options.singular = true;
options.pairConnector = 'association'; options.pairConnector = 'association';
options.keyPlaceholder = 'admin.wizard.key'; options.keyPlaceholder = 'admin.wizard.key';
options.valuePlaceholder = 'admin.wizard.value'; options.valuePlaceholder = 'admin.wizard.value';
options.outputDefaultSelection = 'list';
} }
return options; return options;
}, },
@ -60,20 +76,8 @@ export default Component.extend({
userFieldSelection: 'key,value', userFieldSelection: 'key,value',
context: 'field' context: 'field'
} }
let outputSelectionType = { return this.setupTypeOutput(fieldType, options);
category: ['category'],
tag: ['tag'],
group: ['group'],
dropdown: ['list']
}[fieldType];
outputSelectionType.forEach(function(type) {
options[`${type}Selection`] = 'output';
options.outputDefaultSelection = type;
});
return options;
}, },
@observes('field.type') @observes('field.type')

Datei anzeigen

@ -63,7 +63,7 @@ export default Controller.extend({
let stepFields = s.fields.map((f) => { let stepFields = s.fields.map((f) => {
return EmberObject.create({ return EmberObject.create({
id: f.id, id: f.id,
label: `${f.id} (${s.id})`, label: `${f.label} (${s.id})`,
type: f.type type: f.type
}); });
}); });

Datei anzeigen

@ -19,7 +19,7 @@ body.admin-wizard {
.wizard-settings-parent { .wizard-settings-parent {
margin-bottom: 30px; margin-bottom: 30px;
padding: 20px; padding: 20px;
border: 1px solid $primary-medium; border: 1px solid $primary-low;
} }
.wizard-settings-group { .wizard-settings-group {

Datei anzeigen

@ -112,7 +112,7 @@
.type-selector { .type-selector {
position: absolute; position: absolute;
top: -22px; top: -22px;
width: 100%; width: 150px;
} }
.type-selector a { .type-selector a {