diff --git a/assets/javascripts/discourse/components/wizard-custom-field.js.es6 b/assets/javascripts/discourse/components/wizard-custom-field.js.es6
index 484b501a..abd9f459 100644
--- a/assets/javascripts/discourse/components/wizard-custom-field.js.es6
+++ b/assets/javascripts/discourse/components/wizard-custom-field.js.es6
@@ -1,4 +1,5 @@
import { default as computed, observes, on } from 'ember-addons/ember-computed-decorators';
+import { generateSelectKitContent } from '../lib/custom-wizard';
export default Ember.Component.extend({
classNames: 'wizard-custom-field',
@@ -6,11 +7,11 @@ export default Ember.Component.extend({
isUpload: Ember.computed.equal('field.type', 'upload'),
isCategory: Ember.computed.equal('field.type', 'category'),
disableId: Ember.computed.not('field.isNew'),
- choicesTypes: ['translation', 'preset', 'custom'],
+ choicesTypes: generateSelectKitContent(['translation', 'preset', 'custom']),
choicesTranslation: Ember.computed.equal('field.choices_type', 'translation'),
choicesPreset: Ember.computed.equal('field.choices_type', 'preset'),
choicesCustom: Ember.computed.equal('field.choices_type', 'custom'),
- categoryPropertyTypes: ['id', 'slug'],
+ categoryPropertyTypes: generateSelectKitContent(['id', 'slug']),
@computed('field.type')
isInput: (type) => type === 'text' || type === 'textarea',
diff --git a/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6
index 371ad14e..8f0972e6 100644
--- a/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6
+++ b/assets/javascripts/discourse/controllers/admin-wizards-api.js.es6
@@ -2,17 +2,18 @@ import { ajax } from 'discourse/lib/ajax';
import { popupAjaxError } from 'discourse/lib/ajax-error';
import CustomWizardApi from '../models/custom-wizard-api';
import { default as computed } from 'ember-addons/ember-computed-decorators';
+import { generateSelectKitContent } from '../lib/custom-wizard';
export default Ember.Controller.extend({
queryParams: ['refresh_list'],
loadingSubscriptions: false,
notAuthorized: Ember.computed.not('api.authorized'),
- endpointMethods: ['GET', 'PUT', 'POST', 'PATCH', 'DELETE'],
+ endpointMethods: generateSelectKitContent(['GET', 'PUT', 'POST', 'PATCH', 'DELETE']),
showRemove: Ember.computed.not('isNew'),
showRedirectUri: Ember.computed.and('threeLeggedOauth', 'api.name'),
responseIcon: null,
- contentTypes: ['application/json', 'application/x-www-form-urlencoded'],
- successCodes: [100, 101, 102, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 303, 304, 305, 306, 307, 308],
+ contentTypes: generateSelectKitContent(['application/json', 'application/x-www-form-urlencoded']),
+ successCodes: generateSelectKitContent([100, 101, 102, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 303, 304, 305, 306, 307, 308]),
@computed('saveDisabled', 'api.authType', 'api.authUrl', 'api.tokenUrl', 'api.clientId', 'api.clientSecret', 'threeLeggedOauth')
authDisabled(saveDisabled, authType, authUrl, tokenUrl, clientId, clientSecret, threeLeggedOauth) {
@@ -26,7 +27,7 @@ export default Ember.Controller.extend({
return !name || !authType;
},
- authorizationTypes: ['none', 'basic', 'oauth_2', 'oauth_3'],
+ authorizationTypes: generateSelectKitContent(['none', 'basic', 'oauth_2', 'oauth_3']),
isBasicAuth: Ember.computed.equal('api.authType', 'basic'),
@computed('api.authType')
diff --git a/assets/javascripts/discourse/lib/custom-wizard.js.es6 b/assets/javascripts/discourse/lib/custom-wizard.js.es6
new file mode 100644
index 00000000..16010372
--- /dev/null
+++ b/assets/javascripts/discourse/lib/custom-wizard.js.es6
@@ -0,0 +1,5 @@
+function generateSelectKitContent(content) {
+ return content.map(i => ({id: i, name: i}))
+}
+
+export { generateSelectKitContent };
\ No newline at end of file
diff --git a/assets/javascripts/discourse/routes/admin-wizard.js.es6 b/assets/javascripts/discourse/routes/admin-wizard.js.es6
index a10f625e..383e6dc8 100644
--- a/assets/javascripts/discourse/routes/admin-wizard.js.es6
+++ b/assets/javascripts/discourse/routes/admin-wizard.js.es6
@@ -1,5 +1,6 @@
import CustomWizard from '../models/custom-wizard';
import { ajax } from 'discourse/lib/ajax';
+import { generateSelectKitContent } from '../lib/custom-wizard';
export default Discourse.Route.extend({
beforeModel() {
@@ -40,7 +41,12 @@ export default Discourse.Route.extend({
_getFieldTypes(model) {
return ajax('/admin/wizards/field-types')
- .then((result) => model.set('fieldTypes', result.types));
+ .then((result) => {
+ model.set(
+ 'fieldTypes',
+ generateSelectKitContent([...result.types])
+ )
+ });
},
_getThemes(model) {
diff --git a/assets/javascripts/discourse/templates/admin-wizard.hbs b/assets/javascripts/discourse/templates/admin-wizard.hbs
index 9b7a53ad..2d1f2d0d 100644
--- a/assets/javascripts/discourse/templates/admin-wizard.hbs
+++ b/assets/javascripts/discourse/templates/admin-wizard.hbs
@@ -107,7 +107,11 @@
{{i18n 'admin.wizard.theme_id'}}
- {{combo-box content=model.themes valueAttribute='id' value=model.theme_id none='admin.wizard.no_theme'}}
+ {{combo-box
+ content=model.themes
+ valueProperty='id'
+ value=model.theme_id
+ none='admin.wizard.no_theme'}}
diff --git a/assets/javascripts/discourse/templates/admin-wizards-api.hbs b/assets/javascripts/discourse/templates/admin-wizards-api.hbs
index 611876a0..06980f42 100644
--- a/assets/javascripts/discourse/templates/admin-wizards-api.hbs
+++ b/assets/javascripts/discourse/templates/admin-wizards-api.hbs
@@ -89,7 +89,10 @@
- {{combo-box value=api.authType content=authorizationTypes none='admin.wizard.api.auth.type_none'}}
+ {{combo-box
+ value=api.authType
+ content=authorizationTypes
+ none='admin.wizard.api.auth.type_none'}}
@@ -240,15 +243,18 @@
class='remove-endpoint'}}
- {{combo-box content=endpointMethods
- value=endpoint.method
- none="admin.wizard.api.endpoint.method"}}
- {{combo-box content=contentTypes
- value=endpoint.content_type
- none="admin.wizard.api.endpoint.content_type"}}
- {{multi-select content=successCodes
- values=endpoint.success_codes
- none="admin.wizard.api.endpoint.success_codes"}}
+ {{combo-box
+ content=endpointMethods
+ value=endpoint.method
+ none="admin.wizard.api.endpoint.method"}}
+ {{combo-box
+ content=contentTypes
+ value=endpoint.content_type
+ none="admin.wizard.api.endpoint.content_type"}}
+ {{multi-select
+ content=successCodes
+ values=endpoint.success_codes
+ none="admin.wizard.api.endpoint.success_codes"}}
diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs
index 63919ae3..1350eee5 100644
--- a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs
+++ b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs
@@ -12,7 +12,10 @@
{{i18n "admin.wizard.type"}}
- {{combo-box value=action.type content=types none="admin.wizard.field.type"}}
+ {{combo-box
+ value=action.type
+ content=types
+ none="admin.wizard.field.type"}}
@@ -22,11 +25,12 @@
{{i18n "admin.wizard.action.title"}}
- {{combo-box value=action.title
- content=availableFields
- nameProperty="label"
- none='admin.wizard.select_field'
- isDisabled=action.custom_title_enabled}}
+ {{combo-box
+ value=action.title
+ content=availableFields
+ nameProperty="label"
+ isDisabled=action.custom_title_enabled
+ none='admin.wizard.select_field'}}
{{input type='checkbox' checked=action.custom_title_enabled}}
{{i18n 'admin.wizard.action.custom_title'}}
@@ -42,10 +46,12 @@
{{i18n "admin.wizard.action.post"}}
- {{combo-box value=action.post content=availableFields
- nameProperty='label'
- none='admin.wizard.select_field'
- isDisabled=action.post_builder}}
+ {{combo-box
+ value=action.post
+ content=availableFields
+ nameProperty='label'
+ isDisabled=action.post_builder
+ none='admin.wizard.select_field'}}
{{input type='checkbox' checked=action.post_builder}}
{{i18n 'admin.wizard.action.post_builder.checkbox'}}
@@ -77,7 +83,9 @@
{{i18n "admin.wizard.action.create_topic.category"}}
- {{category-chooser value=action.category_id isDisabled=action.custom_category_enabled}}
+ {{category-chooser
+ value=action.category_id
+ isDisabled=action.custom_category_enabled}}
{{input type='checkbox' checked=action.custom_category_enabled}}
{{i18n 'admin.wizard.action.custom_category.label'}}
@@ -87,10 +95,11 @@
{{input type='checkbox' checked=action.custom_category_wizard_field}}
{{i18n 'admin.wizard.action.custom_category.wizard_field'}}
{{#if action.custom_category_wizard_field}}
- {{combo-box value=action.category_id
- content=categoryFields
- nameProperty="label"
- none='admin.wizard.select_field'}}
+ {{combo-box
+ value=action.category_id
+ content=categoryFields
+ nameProperty="label"
+ none='admin.wizard.select_field'}}
{{/if}}
@@ -111,19 +120,21 @@
{{i18n "admin.wizard.action.create_topic.tags"}}
- {{tag-chooser tags=action.tags
- filterable=true
- allowCreate=true
- isDisabled=action.custom_tag_enabled}}
+ {{tag-chooser
+ tags=action.tags
+ filterable=true
+ allowCreate=true
+ isDisabled=action.custom_tag_enabled}}
{{input type='checkbox' checked=action.custom_tag_enabled}}
{{i18n 'admin.wizard.action.custom_tag.label'}}
{{#if action.custom_tag_enabled}}
- {{combo-box value=action.custom_tag_field
- content=tagFields
- nameProperty="label"
- none='admin.wizard.select_field'}}
+ {{combo-box
+ value=action.custom_tag_field
+ content=tagFields
+ nameProperty="label"
+ none='admin.wizard.select_field'}}
{{/if}}
@@ -160,10 +171,11 @@
{{i18n 'admin.wizard.required'}}
- {{combo-box content=availableFields
- nameProperty='label'
- none='admin.wizard.select_field'
- value=action.required}}
+ {{combo-box
+ value=action.required
+ content=availableFields
+ nameProperty='label'
+ none='admin.wizard.select_field'}}
@@ -204,10 +216,11 @@
{{i18n "admin.wizard.action.send_to_api.api"}}
- {{combo-box value=action.api
- content=availableApis
- none='admin.wizard.action.send_to_api.select_an_api'
- isDisabled=action.custom_title_enabled}}
+ {{combo-box
+ value=action.api
+ content=availableApis
+ isDisabled=action.custom_title_enabled
+ none='admin.wizard.action.send_to_api.select_an_api'}}
@@ -216,10 +229,11 @@
{{i18n "admin.wizard.action.send_to_api.endpoint"}}
- {{combo-box value=action.api_endpoint
- content=availableEndpoints
- none='admin.wizard.action.send_to_api.select_an_endpoint'
- isDisabled=apiEmpty}}
+ {{combo-box
+ value=action.api_endpoint
+ content=availableEndpoints
+ isDisabled=apiEmpty
+ none='admin.wizard.action.send_to_api.select_an_endpoint'}}
@@ -242,11 +256,12 @@
{{i18n "admin.wizard.action.add_to_group.group_selection"}}
- {{combo-box value=action.group_id
- content=availableFields
- nameProperty="label"
- none='admin.wizard.select_field'
- isDisabled=action.custom_group_enabled}}
+ {{combo-box
+ value=action.group_id
+ content=availableFields
+ isDisabled=action.custom_group_enabled
+ nameProperty="label"
+ none='admin.wizard.select_field'}}
{{input type='checkbox' checked=action.custom_group_enabled}}
{{i18n 'admin.wizard.action.add_to_group.custom_group'}}
diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
index 31a0b387..aa91b615 100644
--- a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
+++ b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs
@@ -48,7 +48,10 @@
{{i18n 'admin.wizard.type'}}
- {{combo-box value=field.type content=types none="admin.wizard.field.type"}}
+ {{combo-box
+ value=field.type
+ content=types
+ none="admin.wizard.field.type"}}
@@ -79,7 +82,10 @@
{{i18n 'admin.wizard.field.choices_label'}}
- {{combo-box value=field.choices_type content=choicesTypes none="admin.wizard.field.choices_type"}}
+ {{combo-box
+ value=field.choices_type
+ content=choicesTypes
+ none="admin.wizard.field.choices_type"}}
{{#if choicesTranslation}}
- {{combo-box content=categoryPropertyTypes value=field.property}}
+ {{combo-box
+ content=categoryPropertyTypes
+ value=field.property}}
{{/if}}
diff --git a/assets/javascripts/wizard-custom.js b/assets/javascripts/wizard-custom.js
index 64e46725..d5b0c68f 100644
--- a/assets/javascripts/wizard-custom.js
+++ b/assets/javascripts/wizard-custom.js
@@ -64,6 +64,9 @@
//= require discourse/helpers/category-link
//= require discourse/helpers/user-avatar
//= require discourse/helpers/format-username
+//= require discourse/helpers/component-for-collection
+//= require discourse/helpers/component-for-row
+//= require discourse/helpers/discourse-tag
//= require discourse/services/app-events
//= require discourse/services/emoji-store
@@ -97,6 +100,7 @@
//= require jquery.putcursoratend.js
//= require template_include.js
//= require caret_position.js
+//= require popper.js
//= require ./wizard/custom-wizard
//= require_tree ./wizard/components
diff --git a/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 b/assets/javascripts/wizard/components/wizard-composer-editor.js.es6
index 4ec87cb3..8be6ebb7 100644
--- a/assets/javascripts/wizard/components/wizard-composer-editor.js.es6
+++ b/assets/javascripts/wizard/components/wizard-composer-editor.js.es6
@@ -64,15 +64,6 @@ export default ComposerEditor.extend({
sendAction: this.showUploadModal
});
}
-
- toolbar.addButton({
- id: "options",
- group: "extras",
- icon: "cog",
- title: "composer.options",
- sendAction: this.onExpandPopupMenuOptions.bind(this),
- popupMenu: true
- });
}
}
})
\ No newline at end of file
diff --git a/assets/javascripts/wizard/components/wizard-field-composer.js.es6 b/assets/javascripts/wizard/components/wizard-field-composer.js.es6
index 50e09301..9227faef 100644
--- a/assets/javascripts/wizard/components/wizard-field-composer.js.es6
+++ b/assets/javascripts/wizard/components/wizard-field-composer.js.es6
@@ -30,15 +30,11 @@ export default Ember.Component.extend({
groupsMentioned() {
},
afterRefresh() {
- },
- storeToolbarState() {
- },
+ },
cannotSeeMention() {
},
importQuote() {
},
- onPopupMenuAction() {
- },
showUploadSelector() {
}
}
diff --git a/assets/javascripts/wizard/templates/components/wizard-composer-editor.hbs b/assets/javascripts/wizard/templates/components/wizard-composer-editor.hbs
index 64504e8d..87af2ccb 100644
--- a/assets/javascripts/wizard/templates/components/wizard-composer-editor.hbs
+++ b/assets/javascripts/wizard/templates/components/wizard-composer-editor.hbs
@@ -12,8 +12,5 @@
loading=composer.loading
showLink=showLink
composerEvents=true
- onExpandPopupMenuOptions=(action "onExpandPopupMenuOptions")
- onPopupMenuAction=onPopupMenuAction
- popupMenuOptions=popupMenuOptions
disabled=disableTextarea
outletArgs=(hash composer=composer editorType="composer")}}
\ No newline at end of file
diff --git a/assets/javascripts/wizard/templates/components/wizard-editor.hbs b/assets/javascripts/wizard/templates/components/wizard-editor.hbs
index 13fbcc3a..0033b34a 100644
--- a/assets/javascripts/wizard/templates/components/wizard-editor.hbs
+++ b/assets/javascripts/wizard/templates/components/wizard-editor.hbs
@@ -16,10 +16,12 @@
{{toolbar-popup-menu-options
onPopupMenuAction=onPopupMenuAction
onExpand=(action b.action b)
- title=b.title
- headerIcon=b.icon
class=b.className
- content=popupMenuOptions}}
+ content=popupMenuOptions
+ options=(hash
+ popupTitle=b.title
+ icon=b.icon
+ )}}
{{else}}
{{d.icon}}