From 6ced0cf13c5303f7a7a08829af15313320390369 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Tue, 7 Apr 2020 21:06:35 +1000 Subject: [PATCH] various --- .../components/wizard-custom-field.js.es6 | 38 ++++++++++--------- .../discourse/controllers/admin-wizard.js.es6 | 2 +- assets/stylesheets/common/wizard-admin.scss | 2 +- assets/stylesheets/common/wizard-mapper.scss | 2 +- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/assets/javascripts/discourse/components/wizard-custom-field.js.es6 b/assets/javascripts/discourse/components/wizard-custom-field.js.es6 index a7bf7576..60755bd4 100644 --- a/assets/javascripts/discourse/components/wizard-custom-field.js.es6 +++ b/assets/javascripts/discourse/components/wizard-custom-field.js.es6 @@ -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') contentOptions(fieldType) { let options = { @@ -38,17 +53,18 @@ export default Component.extend({ context: 'field' } + options = this.setupTypeOutput(fieldType, options); + if (this.isDropdown) { options.wizardFieldSelection = 'key,value'; - options.listSelection = 'assignment'; + options.listSelection += ',assignment'; options.inputTypes = 'association,assignment'; options.singular = true; options.pairConnector = 'association'; options.keyPlaceholder = 'admin.wizard.key'; options.valuePlaceholder = 'admin.wizard.value'; - options.outputDefaultSelection = 'list'; } - + return options; }, @@ -60,20 +76,8 @@ export default Component.extend({ userFieldSelection: 'key,value', context: 'field' } - - let outputSelectionType = { - category: ['category'], - tag: ['tag'], - group: ['group'], - dropdown: ['list'] - }[fieldType]; - - outputSelectionType.forEach(function(type) { - options[`${type}Selection`] = 'output'; - options.outputDefaultSelection = type; - }); - - return options; + + return this.setupTypeOutput(fieldType, options); }, @observes('field.type') diff --git a/assets/javascripts/discourse/controllers/admin-wizard.js.es6 b/assets/javascripts/discourse/controllers/admin-wizard.js.es6 index 9d82b4e0..e07ff8a1 100644 --- a/assets/javascripts/discourse/controllers/admin-wizard.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizard.js.es6 @@ -63,7 +63,7 @@ export default Controller.extend({ let stepFields = s.fields.map((f) => { return EmberObject.create({ id: f.id, - label: `${f.id} (${s.id})`, + label: `${f.label} (${s.id})`, type: f.type }); }); diff --git a/assets/stylesheets/common/wizard-admin.scss b/assets/stylesheets/common/wizard-admin.scss index ca87548e..5038546a 100644 --- a/assets/stylesheets/common/wizard-admin.scss +++ b/assets/stylesheets/common/wizard-admin.scss @@ -19,7 +19,7 @@ body.admin-wizard { .wizard-settings-parent { margin-bottom: 30px; padding: 20px; - border: 1px solid $primary-medium; + border: 1px solid $primary-low; } .wizard-settings-group { diff --git a/assets/stylesheets/common/wizard-mapper.scss b/assets/stylesheets/common/wizard-mapper.scss index 9e90652a..32ffba75 100644 --- a/assets/stylesheets/common/wizard-mapper.scss +++ b/assets/stylesheets/common/wizard-mapper.scss @@ -112,7 +112,7 @@ .type-selector { position: absolute; top: -22px; - width: 100%; + width: 150px; } .type-selector a {