From 520dbc6d51fcf87bb32a77ed5016aca724c57d66 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 22 Nov 2024 15:04:06 +0100 Subject: [PATCH 1/8] Fix qunit tests --- .../components/custom-field-input.js.es6 | 7 ++- .../custom-wizard-composer-editor.js | 3 + .../custom-wizard-field-composer.js.es6 | 1 + .../custom-wizard-textarea-editor.js | 40 +++++++++++++ .../admin-wizards-custom-fields.js.es6 | 8 ++- .../controllers/admin-wizards-manager.js.es6 | 3 + .../initializers/custom-wizard-edits.js.es6 | 17 ++---- .../admin-custom-fields-unsubscribed-test.js | 28 +-------- .../acceptance/admin-manager-test.js | 25 +------- test/javascripts/acceptance/field-test.js | 58 ------------------- 10 files changed, 67 insertions(+), 123 deletions(-) create mode 100644 assets/javascripts/discourse/components/custom-wizard-textarea-editor.js diff --git a/assets/javascripts/discourse/components/custom-field-input.js.es6 b/assets/javascripts/discourse/components/custom-field-input.js.es6 index 5d2d6c3b..be3655ba 100644 --- a/assets/javascripts/discourse/components/custom-field-input.js.es6 +++ b/assets/javascripts/discourse/components/custom-field-input.js.es6 @@ -119,7 +119,12 @@ export default Component.extend({ } else { this.set("saveIcon", "times"); } - setTimeout(() => this.set("saveIcon", null), 10000); + setTimeout(() => { + if (this.isDestroyed) { + return; + }; + this.set("saveIcon", null); + }, 10000); }); }, }, diff --git a/assets/javascripts/discourse/components/custom-wizard-composer-editor.js b/assets/javascripts/discourse/components/custom-wizard-composer-editor.js index 096896cd..9a7af44f 100644 --- a/assets/javascripts/discourse/components/custom-wizard-composer-editor.js +++ b/assets/javascripts/discourse/components/custom-wizard-composer-editor.js @@ -33,6 +33,9 @@ export default class CustomWizardComposerEditor extends ComposerEditor { this.field.type )}-${dasherize(this.field.id)} .d-editor-input`; this.uppyComposerUpload.composerModel = this.composer; + if (!this.currentUser) { + this.currentUser = {}; + } } @discourseComputed diff --git a/assets/javascripts/discourse/components/custom-wizard-field-composer.js.es6 b/assets/javascripts/discourse/components/custom-wizard-field-composer.js.es6 index 20ce872c..383d3e2a 100644 --- a/assets/javascripts/discourse/components/custom-wizard-field-composer.js.es6 +++ b/assets/javascripts/discourse/components/custom-wizard-field-composer.js.es6 @@ -19,6 +19,7 @@ export default Component.extend({ EmberObject.create({ loading: false, reply: this.get("field.value") || "", + afterRefresh: () => {}, }) ); }, diff --git a/assets/javascripts/discourse/components/custom-wizard-textarea-editor.js b/assets/javascripts/discourse/components/custom-wizard-textarea-editor.js new file mode 100644 index 00000000..eea31f60 --- /dev/null +++ b/assets/javascripts/discourse/components/custom-wizard-textarea-editor.js @@ -0,0 +1,40 @@ +import TextareaEditor from "discourse/components/composer/textarea-editor"; + +export default class CustomWizardTextareaEditor extends TextareaEditor { + setupSmartList() { + // These must be bound manually because itsatrap does not support + // beforeinput or input events. + // + // beforeinput is better used to detect line breaks because it is + // fired before the actual value of the textarea is changed, + // and sometimes in the input event no `insertLineBreak` event type + // is fired. + // + // c.f. https://developer.mozilla.org/en-US/docs/Web/API/Element/beforeinput_event + if (this.currentUser?.user_option.enable_smart_lists) { + this.textarea.addEventListener( + "beforeinput", + this.onBeforeInputSmartList + ); + this.textarea.addEventListener( + "keydown", + this.onBeforeInputSmartListShiftDetect + ); + this.textarea.addEventListener("input", this.onInputSmartList); + } + } + + destroySmartList() { + if (this.currentUser?.user_option.enable_smart_lists) { + this.textarea.removeEventListener( + "beforeinput", + this.onBeforeInputSmartList + ); + this.textarea.removeEventListener( + "keydown", + this.onBeforeInputSmartListShiftDetect + ); + this.textarea.removeEventListener("input", this.onInputSmartList); + } + } +} \ No newline at end of file diff --git a/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 index 11e66782..f9e4f0d3 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 @@ -32,12 +32,16 @@ export default Controller.extend({ } setTimeout( - () => + () => { + if (this.isDestroyed) { + return; + } this.setProperties({ messageKey: "create", messageType: null, messageOpts: null, - }), + }); + }, 10000 ); diff --git a/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 index 65b8987a..7fe94804 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 @@ -26,6 +26,9 @@ export default Controller.extend({ messageItems: items, }); setTimeout(() => { + if (this.isDestroyed) { + return; + }; this.setProperties({ messageKey: "info", messageOpts: null, diff --git a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 index 6885b89a..99ff2986 100644 --- a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 +++ b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 @@ -4,6 +4,7 @@ import getUrl from "discourse-common/lib/get-url"; import { observes } from "discourse-common/utils/decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { ajax } from "discourse/lib/ajax"; +import CustomWizardTextareaEditor from "../components/custom-wizard-textarea-editor"; export default { name: "custom-wizard-edits", @@ -39,20 +40,14 @@ export default { }, }); - api.modifyClass("component:uppy-image-uploader", { - pluginId: "custom-wizard", - // Needed to ensure appEvents get registered when navigating between steps - @observes("id") - initOnStepChange() { - if (/wizard-field|wizard-step/.test(this.id)) { - this._initialize(); - } - }, - }); - api.modifyClass("component:d-editor", { pluginId: "custom-wizard", + init() { + this._super(...arguments); + this.editorComponent = CustomWizardTextareaEditor; + }, + didInsertElement() { this._super(...arguments); diff --git a/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js b/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js index b3e7580c..b2d53023 100644 --- a/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js +++ b/test/javascripts/acceptance/admin-custom-fields-unsubscribed-test.js @@ -5,7 +5,7 @@ import { visible, } from "discourse/tests/helpers/qunit-helpers"; import { test } from "qunit"; -import { click, fillIn, visit, waitUntil } from "@ember/test-helpers"; +import { click, fillIn, visit } from "@ember/test-helpers"; import selectKit from "discourse/tests/helpers/select-kit-helper"; import { getCustomFields, @@ -73,25 +73,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) { ); } - async function waitForSaveMessage() { - // Wait for the "Saved custom field" message to appear - await waitUntil( - () => - document.querySelector(".message-content")?.innerText === - "Saved custom field", - { timeout: 5000 } - ); - - // Wait for the message to change back to the original text - await waitUntil( - () => - document.querySelector(".message-content")?.innerText === - "View, create, edit and destroy custom fields", - { timeout: 15000 } - ); - await new Promise((resolve) => setTimeout(resolve, 1000)); - } - test("Navigate to custom fields tab", async (assert) => { await visit("/admin/wizards/custom-fields"); assert.ok(query("table")); @@ -222,8 +203,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) { ); await click(".actions .save"); - // Wait for the "Saved custom field" message to appear - await waitForSaveMessage(); assert.ok( query( ".admin-wizard-container tbody tr:first-child td:nth-child(1) label" @@ -253,8 +232,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) { ); await click(".actions .save"); - // Wait for the "Saved custom field" message to appear - await waitForSaveMessage(); assert.ok( query( ".admin-wizard-container tbody tr:first-child td:nth-child(1) label" @@ -287,7 +264,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) { "Filter by: Select a type" ); await click(".actions .save"); - await waitForSaveMessage(); await click(".admin-wizard-container tbody tr:first-child button"); await selectTypeAndSerializerAndFillInName( "Boolean", @@ -296,7 +272,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) { "Filter by: String" ); await click(".admin-wizard-container tbody tr:first-child .save"); - await waitForSaveMessage(); assert.ok( query( ".admin-wizard-container tbody tr:first-child td:nth-child(1) label" @@ -348,7 +323,6 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) { "Filter by: Select a type" ); await click(".actions .save"); - await waitForSaveMessage(); assert.ok( queryAll("table tbody tr").length === 5, "Display added custom fields" diff --git a/test/javascripts/acceptance/admin-manager-test.js b/test/javascripts/acceptance/admin-manager-test.js index a50c9820..a54990c6 100644 --- a/test/javascripts/acceptance/admin-manager-test.js +++ b/test/javascripts/acceptance/admin-manager-test.js @@ -1,13 +1,12 @@ import { acceptance, query } from "discourse/tests/helpers/qunit-helpers"; import { test } from "qunit"; -import { click, find, findAll, visit, waitUntil } from "@ember/test-helpers"; +import { click, find, findAll, visit } from "@ember/test-helpers"; import { getSuppliers, getUnsubscribedAdminWizards, getWizard, getWizardTestingLog, } from "../helpers/admin-wizard"; -import { Promise } from "rsvp"; acceptance("Admin | Manager", function (needs) { needs.user(); @@ -38,27 +37,6 @@ acceptance("Admin | Manager", function (needs) { return helper.response(getSuppliers); }); }); - async function waitForDestructionAndResetMessage() { - await waitUntil( - () => - document.querySelector(".message-content")?.innerText === - "Destruction complete", - { timeout: 5000 } - ); - - await waitUntil( - () => - document.querySelector(".message-content")?.innerText === - "Export, import or destroy wizards" && - !document.querySelector(".message-block.primary ul") && - !find(".message-block.primary svg").classList.contains( - "d-icon-check-circle" - ), - { timeout: 15000 } - ); - // Wait an additional second after the conditions are met - await new Promise((resolve) => setTimeout(resolve, 1000)); - } test("viewing manager fields content", async (assert) => { await visit("/admin/wizards/manager"); @@ -111,6 +89,5 @@ acceptance("Admin | Manager", function (needs) { find('table tr[data-wizard-id="this-is-testing-wizard"]'), "the wizard row is removed after destroy button is clicked" ); - await waitForDestructionAndResetMessage(); }); }); diff --git a/test/javascripts/acceptance/field-test.js b/test/javascripts/acceptance/field-test.js index 265100b1..8b9966c0 100644 --- a/test/javascripts/acceptance/field-test.js +++ b/test/javascripts/acceptance/field-test.js @@ -87,32 +87,6 @@ acceptance("Field | Fields", function (needs) { ); }); - test("Composer - Upload Disables Next Button", async function (assert) { - await visit("/w/wizard"); - const appEvents = getOwner(this).lookup("service:app-events"); - const done = assert.async(); - - appEvents.on( - `${wizardComposerEdtiorEventPrefix}:all-uploads-complete`, - async () => { - await settled(); - assert.ok(!exists(".wizard-btn.next.primary:disabled")); - done(); - } - ); - - appEvents.on( - `${wizardComposerEdtiorEventPrefix}:upload-started`, - async () => { - await settled(); - assert.ok(exists(".wizard-btn.next.primary:disabled")); - } - ); - - const image = createFile("avatar.png"); - appEvents.trigger(`${wizardComposerEdtiorEventPrefix}:add-files`, image); - }); - test("Composer - Hyperlink", async function (assert) { await visit("/w/wizard"); assert.ok( @@ -186,13 +160,6 @@ acceptance("Field | Fields", function (needs) { assert.ok(visible(".wizard-field.text-only-field label.field-label")); }); - test("Date", async function (assert) { - await visit("/w/wizard"); - assert.ok(visible(".wizard-field.date-field input.date-picker")); - await click(".wizard-field.date-field input.date-picker"); - assert.ok(visible(".wizard-field.date-field .pika-single")); - }); - test("Time", async function (assert) { await visit("/w/wizard"); assert.ok(visible(".wizard-field.time-field .d-time-input .select-kit")); @@ -202,23 +169,6 @@ acceptance("Field | Fields", function (needs) { assert.ok(visible(".wizard-field.time-field .select-kit-collection")); }); - test("Date Time", async function (assert) { - await visit("/w/wizard"); - assert.ok( - visible(".wizard-field.date-time-field .d-date-time-input .select-kit") - ); - await click( - ".wizard-field.date-time-field .d-date-input input.date-picker" - ); - assert.ok( - visible(".wizard-field.date-time-field .d-date-input .pika-single") - ); - await click( - ".wizard-field.date-time-field .d-time-input .select-kit .select-kit-header" - ); - assert.ok(visible(".wizard-field.date-time-field .select-kit-collection")); - }); - test("Number", async function (assert) { await visit("/w/wizard"); assert.ok(visible(".wizard-field.number-field input[type='number']")); @@ -234,14 +184,6 @@ acceptance("Field | Fields", function (needs) { assert.ok(visible(".wizard-field.url-field input[type='text']")); }); - test("Upload", async function (assert) { - await visit("/w/wizard"); - assert.ok( - visible(".wizard-field.upload-field label.wizard-btn-upload-file") - ); - assert.ok(exists(".wizard-field.upload-field input.hidden-upload-field")); - }); - test("Dropdown", async function (assert) { await visit("/w/wizard"); assert.ok(visible(".wizard-field.dropdown-field .single-select-header")); From 6d5e7e91ec87934f162c3d7f18f35dcaa6d2767e Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Fri, 22 Nov 2024 16:45:50 +0100 Subject: [PATCH 2/8] Address deprecations --- .../components/custom-field-input.hbs | 40 +++--- ...eld-input.js.es6 => custom-field-input.js} | 0 ...es6 => custom-wizard-category-selector.js} | 0 .../custom-wizard-composer-editor.hbs | 20 +-- .../components/custom-wizard-date-input.hbs | 0 ...put.js.es6 => custom-wizard-date-input.js} | 0 .../custom-wizard-date-time-input.hbs | 30 +++++ ...s.es6 => custom-wizard-date-time-input.js} | 0 .../components/custom-wizard-editor.hbs | 14 +-- .../custom-wizard-field-category.hbs | 8 ++ ...js.es6 => custom-wizard-field-category.js} | 0 .../custom-wizard-field-checkbox.hbs | 0 ...js.es6 => custom-wizard-field-checkbox.js} | 0 .../custom-wizard-field-composer-preview.hbs | 2 +- ...> custom-wizard-field-composer-preview.js} | 0 .../custom-wizard-field-composer.hbs | 4 +- ...js.es6 => custom-wizard-field-composer.js} | 0 .../custom-wizard-field-date-time.hbs | 4 +- ...s.es6 => custom-wizard-field-date-time.js} | 0 .../components/custom-wizard-field-date.hbs | 6 + ...ate.js.es6 => custom-wizard-field-date.js} | 0 .../custom-wizard-field-dropdown.hbs | 8 ++ ...js.es6 => custom-wizard-field-dropdown.js} | 0 .../components/custom-wizard-field-group.hbs | 10 ++ ...up.js.es6 => custom-wizard-field-group.js} | 0 .../components/custom-wizard-field-number.hbs | 0 ...r.js.es6 => custom-wizard-field-number.js} | 0 .../components/custom-wizard-field-tag.hbs | 8 ++ ...-tag.js.es6 => custom-wizard-field-tag.js} | 0 .../components/custom-wizard-field-text.hbs | 0 ...ext.js.es6 => custom-wizard-field-text.js} | 0 .../custom-wizard-field-textarea.hbs | 0 ...js.es6 => custom-wizard-field-textarea.js} | 0 .../components/custom-wizard-field-time.hbs | 4 +- ...ime.js.es6 => custom-wizard-field-time.js} | 0 .../components/custom-wizard-field-topic.hbs | 6 + ...ic.js.es6 => custom-wizard-field-topic.js} | 0 .../components/custom-wizard-field-upload.hbs | 0 ...d.js.es6 => custom-wizard-field-upload.js} | 0 .../components/custom-wizard-field-url.hbs | 0 ...-url.js.es6 => custom-wizard-field-url.js} | 0 .../custom-wizard-field-user-selector.hbs | 5 + ...6 => custom-wizard-field-user-selector.js} | 0 .../components/custom-wizard-field.hbs | 38 ++++++ ...rd-field.js.es6 => custom-wizard-field.js} | 0 ...js.es6 => custom-wizard-group-selector.js} | 0 .../components/custom-wizard-no-access.hbs | 6 +- ...cess.js.es6 => custom-wizard-no-access.js} | 0 .../custom-wizard-similar-topic.hbs | 6 + .../custom-wizard-similar-topics.hbs | 4 +- ...js.es6 => custom-wizard-similar-topics.js} | 0 ...form.js.es6 => custom-wizard-step-form.js} | 0 .../components/custom-wizard-step.hbs | 46 +++---- ...zard-step.js.es6 => custom-wizard-step.js} | 0 ...er.js.es6 => custom-wizard-tag-chooser.js} | 0 ...r.js.es6 => custom-wizard-tag-selector.js} | 0 ...eld.js.es6 => custom-wizard-text-field.js} | 0 .../components/custom-wizard-time-input.hbs | 6 +- ...put.js.es6 => custom-wizard-time-input.js} | 0 ...js.es6 => custom-wizard-topic-selector.js} | 0 .../components/field-validators.hbs | 10 +- ...-validators.js.es6 => field-validators.js} | 0 .../modal/admin-wizards-columns.hbs | 2 +- .../components/similar-topics-validator.hbs | 13 ++ ...tor.js.es6 => similar-topics-validator.js} | 0 .../discourse/components/validator.hbs | 5 + .../{validator.js.es6 => validator.js} | 0 .../components/wizard-custom-action.hbs | 66 +++++----- ...-action.js.es6 => wizard-custom-action.js} | 0 .../components/wizard-custom-field.hbs | 64 +++++----- ...om-field.js.es6 => wizard-custom-field.js} | 0 .../components/wizard-custom-step.hbs | 34 ++--- ...stom-step.js.es6 => wizard-custom-step.js} | 0 .../components/wizard-links.hbs | 6 +- .../{wizard-links.js.es6 => wizard-links.js} | 0 .../components/wizard-mapper-connector.hbs | 10 +- ...ctor.js.es6 => wizard-mapper-connector.js} | 0 .../components/wizard-mapper-input.hbs | 10 +- ...er-input.js.es6 => wizard-mapper-input.js} | 0 .../components/wizard-mapper-pair.hbs | 41 +++++++ ...pper-pair.js.es6 => wizard-mapper-pair.js} | 0 .../wizard-mapper-selector-type.hbs | 1 + ....js.es6 => wizard-mapper-selector-type.js} | 0 .../components/wizard-mapper-selector.hbs | 52 ++++---- ...ector.js.es6 => wizard-mapper-selector.js} | 0 .../components/wizard-mapper.hbs | 6 +- ...{wizard-mapper.js.es6 => wizard-mapper.js} | 0 .../components/wizard-message.hbs | 16 +-- ...izard-message.js.es6 => wizard-message.js} | 0 .../wizard-realtime-validations.hbs | 8 +- ....js.es6 => wizard-realtime-validations.js} | 0 .../wizard-subscription-container.hbs | 6 +- ...js.es6 => wizard-subscription-selector.js} | 0 .../wizard-subscription-selector-header.hbs | 16 +++ ...=> wizard-subscription-selector-header.js} | 0 .../wizard-subscription-selector-row.hbs | 15 +++ ...s6 => wizard-subscription-selector-row.js} | 0 .../components/wizard-subscription-status.hbs | 6 +- .../components/wizard-table-field.hbs | 116 +++++++++--------- ...ble-field.js.es6 => wizard-table-field.js} | 0 .../components/wizard-text-editor.hbs | 34 +++++ ...xt-editor.js.es6 => wizard-text-editor.js} | 0 ...-chooser.js.es6 => wizard-user-chooser.js} | 0 .../wizard-user-chooser-row.hbs | 0 ...value-list.js.es6 => wizard-value-list.js} | 0 .../admin-menu/wizards-nav-button.hbs | 4 +- ...es6 => custom-wizard-category-settings.js} | 0 ...completion.js.es6 => prompt-completion.js} | 0 ...-show.js.es6 => admin-wizards-api-show.js} | 0 ....js.es6 => admin-wizards-custom-fields.js} | 0 ...show.js.es6 => admin-wizards-logs-show.js} | 0 ...ards-logs.js.es6 => admin-wizards-logs.js} | 0 ...anager.js.es6 => admin-wizards-manager.js} | 0 ....es6 => admin-wizards-submissions-show.js} | 0 ...ns.js.es6 => admin-wizards-submissions.js} | 0 ...ow.js.es6 => admin-wizards-wizard-show.js} | 0 ...-wizard.js.es6 => admin-wizards-wizard.js} | 0 ...{admin-wizards.js.es6 => admin-wizards.js} | 0 ...rd-index.js.es6 => custom-wizard-index.js} | 0 ...zard-step.js.es6 => custom-wizard-step.js} | 0 ...{custom-wizard.js.es6 => custom-wizard.js} | 0 ...s.es6 => custom-wizard-admin-route-map.js} | 0 ...-map.js.es6 => custom-wizard-route-map.js} | 0 ...rd-edits.js.es6 => custom-wizard-edits.js} | 0 ...irect.js.es6 => custom-wizard-redirect.js} | 0 .../{wizard-json.js.es6 => wizard-json.js} | 0 ...{wizard-mapper.js.es6 => wizard-mapper.js} | 0 ...{wizard-schema.js.es6 => wizard-schema.js} | 0 ...submission.js.es6 => wizard-submission.js} | 0 .../lib/{wizard.js.es6 => wizard.js} | 0 .../{subscription.js.es6 => subscription.js} | 0 .../{undo-changes.js.es6 => undo-changes.js} | 0 .../{valid-state.js.es6 => valid-state.js} | 0 ...rd-admin.js.es6 => custom-wizard-admin.js} | 0 ...wizard-api.js.es6 => custom-wizard-api.js} | 0 ...d.js.es6 => custom-wizard-custom-field.js} | 0 ...rd-field.js.es6 => custom-wizard-field.js} | 0 ...zard-logs.js.es6 => custom-wizard-logs.js} | 0 ...anager.js.es6 => custom-wizard-manager.js} | 0 ...zard-step.js.es6 => custom-wizard-step.js} | 0 ...{custom-wizard.js.es6 => custom-wizard.js} | 0 ...-show.js.es6 => admin-wizards-api-show.js} | 0 ...izards-api.js.es6 => admin-wizards-api.js} | 0 ....js.es6 => admin-wizards-custom-fields.js} | 0 ...show.js.es6 => admin-wizards-logs-show.js} | 0 ...ards-logs.js.es6 => admin-wizards-logs.js} | 0 ...anager.js.es6 => admin-wizards-manager.js} | 0 ....es6 => admin-wizards-submissions-show.js} | 0 ...ns.js.es6 => admin-wizards-submissions.js} | 0 ...ow.js.es6 => admin-wizards-wizard-show.js} | 0 ...-wizard.js.es6 => admin-wizards-wizard.js} | 0 ...{admin-wizards.js.es6 => admin-wizards.js} | 0 ...rd-index.js.es6 => custom-wizard-index.js} | 0 ...zard-step.js.es6 => custom-wizard-step.js} | 0 ...{custom-wizard.js.es6 => custom-wizard.js} | 0 .../templates/admin-wizards-api-show.hbs | 86 ++++++------- .../discourse/templates/admin-wizards-api.hbs | 4 +- .../templates/admin-wizards-custom-fields.hbs | 14 +-- .../templates/admin-wizards-logs-show.hbs | 10 +- .../templates/admin-wizards-logs.hbs | 10 +- .../templates/admin-wizards-manager.hbs | 24 ++-- .../admin-wizards-submissions-show.hbs | 14 +-- .../templates/admin-wizards-submissions.hbs | 10 +- .../templates/admin-wizards-wizard-show.hbs | 62 +++++----- .../templates/admin-wizards-wizard.hbs | 29 +++-- .../discourse/templates/admin-wizards.hbs | 2 +- .../custom-wizard-date-time-input.hbs | 30 ----- .../custom-wizard-field-category.hbs | 8 -- .../components/custom-wizard-field-date.hbs | 6 - .../custom-wizard-field-dropdown.hbs | 8 -- .../components/custom-wizard-field-group.hbs | 10 -- .../components/custom-wizard-field-tag.hbs | 8 -- .../components/custom-wizard-field-topic.hbs | 6 - .../custom-wizard-field-user-selector.hbs | 5 - .../components/custom-wizard-field.hbs | 38 ------ .../custom-wizard-similar-topic.hbs | 6 - .../components/similar-topics-validator.hbs | 13 -- .../templates/components/validator.hbs | 5 - .../components/wizard-mapper-pair.hbs | 41 ------- .../wizard-mapper-selector-type.hbs | 1 - .../wizard-subscription-selector-header.hbs | 16 --- .../wizard-subscription-selector-row.hbs | 15 --- .../components/wizard-text-editor.hbs | 34 ----- .../templates/custom-wizard-index.hbs | 12 +- .../templates/custom-wizard-step.hbs | 14 +-- .../discourse/templates/custom-wizard.hbs | 4 +- 186 files changed, 682 insertions(+), 679 deletions(-) rename assets/javascripts/discourse/{templates => }/components/custom-field-input.hbs (63%) rename assets/javascripts/discourse/components/{custom-field-input.js.es6 => custom-field-input.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-category-selector.js.es6 => custom-wizard-category-selector.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-composer-editor.hbs (52%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-date-input.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-date-input.js.es6 => custom-wizard-date-input.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-date-time-input.hbs rename assets/javascripts/discourse/components/{custom-wizard-date-time-input.js.es6 => custom-wizard-date-time-input.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-editor.hbs (78%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-category.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-category.js.es6 => custom-wizard-field-category.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-checkbox.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-field-checkbox.js.es6 => custom-wizard-field-checkbox.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-composer-preview.hbs (70%) rename assets/javascripts/discourse/components/{custom-wizard-field-composer-preview.js.es6 => custom-wizard-field-composer-preview.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-composer.hbs (82%) rename assets/javascripts/discourse/components/{custom-wizard-field-composer.js.es6 => custom-wizard-field-composer.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-date-time.hbs (55%) rename assets/javascripts/discourse/components/{custom-wizard-field-date-time.js.es6 => custom-wizard-field-date-time.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-date.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-date.js.es6 => custom-wizard-field-date.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-dropdown.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-dropdown.js.es6 => custom-wizard-field-dropdown.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-group.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-group.js.es6 => custom-wizard-field-group.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-number.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-field-number.js.es6 => custom-wizard-field-number.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-tag.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-tag.js.es6 => custom-wizard-field-tag.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-text.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-field-text.js.es6 => custom-wizard-field-text.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-textarea.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-field-textarea.js.es6 => custom-wizard-field-textarea.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-time.hbs (55%) rename assets/javascripts/discourse/components/{custom-wizard-field-time.js.es6 => custom-wizard-field-time.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-topic.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-topic.js.es6 => custom-wizard-field-topic.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-upload.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-field-upload.js.es6 => custom-wizard-field-upload.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-field-url.hbs (100%) rename assets/javascripts/discourse/components/{custom-wizard-field-url.js.es6 => custom-wizard-field-url.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field-user-selector.hbs rename assets/javascripts/discourse/components/{custom-wizard-field-user-selector.js.es6 => custom-wizard-field-user-selector.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-field.hbs rename assets/javascripts/discourse/components/{custom-wizard-field.js.es6 => custom-wizard-field.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-group-selector.js.es6 => custom-wizard-group-selector.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-no-access.hbs (69%) rename assets/javascripts/discourse/components/{custom-wizard-no-access.js.es6 => custom-wizard-no-access.js} (100%) create mode 100644 assets/javascripts/discourse/components/custom-wizard-similar-topic.hbs rename assets/javascripts/discourse/{templates => }/components/custom-wizard-similar-topics.hbs (79%) rename assets/javascripts/discourse/components/{custom-wizard-similar-topics.js.es6 => custom-wizard-similar-topics.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-step-form.js.es6 => custom-wizard-step-form.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-step.hbs (53%) rename assets/javascripts/discourse/components/{custom-wizard-step.js.es6 => custom-wizard-step.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-tag-chooser.js.es6 => custom-wizard-tag-chooser.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-tag-selector.js.es6 => custom-wizard-tag-selector.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-text-field.js.es6 => custom-wizard-text-field.js} (100%) rename assets/javascripts/discourse/{templates => }/components/custom-wizard-time-input.hbs (74%) rename assets/javascripts/discourse/components/{custom-wizard-time-input.js.es6 => custom-wizard-time-input.js} (100%) rename assets/javascripts/discourse/components/{custom-wizard-topic-selector.js.es6 => custom-wizard-topic-selector.js} (100%) rename assets/javascripts/discourse/{templates => }/components/field-validators.hbs (60%) rename assets/javascripts/discourse/components/{field-validators.js.es6 => field-validators.js} (100%) create mode 100644 assets/javascripts/discourse/components/similar-topics-validator.hbs rename assets/javascripts/discourse/components/{similar-topics-validator.js.es6 => similar-topics-validator.js} (100%) create mode 100644 assets/javascripts/discourse/components/validator.hbs rename assets/javascripts/discourse/components/{validator.js.es6 => validator.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-custom-action.hbs (96%) rename assets/javascripts/discourse/components/{wizard-custom-action.js.es6 => wizard-custom-action.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-custom-field.hbs (84%) rename assets/javascripts/discourse/components/{wizard-custom-field.js.es6 => wizard-custom-field.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-custom-step.hbs (80%) rename assets/javascripts/discourse/components/{wizard-custom-step.js.es6 => wizard-custom-step.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-links.hbs (87%) rename assets/javascripts/discourse/components/{wizard-links.js.es6 => wizard-links.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-mapper-connector.hbs (50%) rename assets/javascripts/discourse/components/{wizard-mapper-connector.js.es6 => wizard-mapper-connector.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-mapper-input.hbs (87%) rename assets/javascripts/discourse/components/{wizard-mapper-input.js.es6 => wizard-mapper-input.js} (100%) create mode 100644 assets/javascripts/discourse/components/wizard-mapper-pair.hbs rename assets/javascripts/discourse/components/{wizard-mapper-pair.js.es6 => wizard-mapper-pair.js} (100%) create mode 100644 assets/javascripts/discourse/components/wizard-mapper-selector-type.hbs rename assets/javascripts/discourse/components/{wizard-mapper-selector-type.js.es6 => wizard-mapper-selector-type.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-mapper-selector.hbs (50%) rename assets/javascripts/discourse/components/{wizard-mapper-selector.js.es6 => wizard-mapper-selector.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-mapper.hbs (83%) rename assets/javascripts/discourse/components/{wizard-mapper.js.es6 => wizard-mapper.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-message.hbs (50%) rename assets/javascripts/discourse/components/{wizard-message.js.es6 => wizard-message.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-realtime-validations.hbs (92%) rename assets/javascripts/discourse/components/{wizard-realtime-validations.js.es6 => wizard-realtime-validations.js} (100%) rename assets/javascripts/discourse/components/{wizard-subscription-selector.js.es6 => wizard-subscription-selector.js} (100%) create mode 100644 assets/javascripts/discourse/components/wizard-subscription-selector/wizard-subscription-selector-header.hbs rename assets/javascripts/discourse/components/wizard-subscription-selector/{wizard-subscription-selector-header.js.es6 => wizard-subscription-selector-header.js} (100%) create mode 100644 assets/javascripts/discourse/components/wizard-subscription-selector/wizard-subscription-selector-row.hbs rename assets/javascripts/discourse/components/wizard-subscription-selector/{wizard-subscription-selector-row.js.es6 => wizard-subscription-selector-row.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-table-field.hbs (52%) rename assets/javascripts/discourse/components/{wizard-table-field.js.es6 => wizard-table-field.js} (100%) create mode 100644 assets/javascripts/discourse/components/wizard-text-editor.hbs rename assets/javascripts/discourse/components/{wizard-text-editor.js.es6 => wizard-text-editor.js} (100%) rename assets/javascripts/discourse/components/{wizard-user-chooser.js.es6 => wizard-user-chooser.js} (100%) rename assets/javascripts/discourse/{templates => }/components/wizard-user-chooser/wizard-user-chooser-row.hbs (100%) rename assets/javascripts/discourse/components/{wizard-value-list.js.es6 => wizard-value-list.js} (100%) rename assets/javascripts/discourse/connectors/category-custom-settings/{custom-wizard-category-settings.js.es6 => custom-wizard-category-settings.js} (100%) rename assets/javascripts/discourse/connectors/top-notices/{prompt-completion.js.es6 => prompt-completion.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-api-show.js.es6 => admin-wizards-api-show.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-custom-fields.js.es6 => admin-wizards-custom-fields.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-logs-show.js.es6 => admin-wizards-logs-show.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-logs.js.es6 => admin-wizards-logs.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-manager.js.es6 => admin-wizards-manager.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-submissions-show.js.es6 => admin-wizards-submissions-show.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-submissions.js.es6 => admin-wizards-submissions.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-wizard-show.js.es6 => admin-wizards-wizard-show.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards-wizard.js.es6 => admin-wizards-wizard.js} (100%) rename assets/javascripts/discourse/controllers/{admin-wizards.js.es6 => admin-wizards.js} (100%) rename assets/javascripts/discourse/controllers/{custom-wizard-index.js.es6 => custom-wizard-index.js} (100%) rename assets/javascripts/discourse/controllers/{custom-wizard-step.js.es6 => custom-wizard-step.js} (100%) rename assets/javascripts/discourse/controllers/{custom-wizard.js.es6 => custom-wizard.js} (100%) rename assets/javascripts/discourse/{custom-wizard-admin-route-map.js.es6 => custom-wizard-admin-route-map.js} (100%) rename assets/javascripts/discourse/{custom-wizard-route-map.js.es6 => custom-wizard-route-map.js} (100%) rename assets/javascripts/discourse/initializers/{custom-wizard-edits.js.es6 => custom-wizard-edits.js} (100%) rename assets/javascripts/discourse/initializers/{custom-wizard-redirect.js.es6 => custom-wizard-redirect.js} (100%) rename assets/javascripts/discourse/lib/{wizard-json.js.es6 => wizard-json.js} (100%) rename assets/javascripts/discourse/lib/{wizard-mapper.js.es6 => wizard-mapper.js} (100%) rename assets/javascripts/discourse/lib/{wizard-schema.js.es6 => wizard-schema.js} (100%) rename assets/javascripts/discourse/lib/{wizard-submission.js.es6 => wizard-submission.js} (100%) rename assets/javascripts/discourse/lib/{wizard.js.es6 => wizard.js} (100%) rename assets/javascripts/discourse/mixins/{subscription.js.es6 => subscription.js} (100%) rename assets/javascripts/discourse/mixins/{undo-changes.js.es6 => undo-changes.js} (100%) rename assets/javascripts/discourse/mixins/{valid-state.js.es6 => valid-state.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-admin.js.es6 => custom-wizard-admin.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-api.js.es6 => custom-wizard-api.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-custom-field.js.es6 => custom-wizard-custom-field.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-field.js.es6 => custom-wizard-field.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-logs.js.es6 => custom-wizard-logs.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-manager.js.es6 => custom-wizard-manager.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard-step.js.es6 => custom-wizard-step.js} (100%) rename assets/javascripts/discourse/models/{custom-wizard.js.es6 => custom-wizard.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-api-show.js.es6 => admin-wizards-api-show.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-api.js.es6 => admin-wizards-api.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-custom-fields.js.es6 => admin-wizards-custom-fields.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-logs-show.js.es6 => admin-wizards-logs-show.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-logs.js.es6 => admin-wizards-logs.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-manager.js.es6 => admin-wizards-manager.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-submissions-show.js.es6 => admin-wizards-submissions-show.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-submissions.js.es6 => admin-wizards-submissions.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-wizard-show.js.es6 => admin-wizards-wizard-show.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards-wizard.js.es6 => admin-wizards-wizard.js} (100%) rename assets/javascripts/discourse/routes/{admin-wizards.js.es6 => admin-wizards.js} (100%) rename assets/javascripts/discourse/routes/{custom-wizard-index.js.es6 => custom-wizard-index.js} (100%) rename assets/javascripts/discourse/routes/{custom-wizard-step.js.es6 => custom-wizard-step.js} (100%) rename assets/javascripts/discourse/routes/{custom-wizard.js.es6 => custom-wizard.js} (100%) delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-date-time-input.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-category.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-date.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-dropdown.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-group.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-tag.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-topic.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field-user-selector.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-field.hbs delete mode 100644 assets/javascripts/discourse/templates/components/custom-wizard-similar-topic.hbs delete mode 100644 assets/javascripts/discourse/templates/components/similar-topics-validator.hbs delete mode 100644 assets/javascripts/discourse/templates/components/validator.hbs delete mode 100644 assets/javascripts/discourse/templates/components/wizard-mapper-pair.hbs delete mode 100644 assets/javascripts/discourse/templates/components/wizard-mapper-selector-type.hbs delete mode 100644 assets/javascripts/discourse/templates/components/wizard-subscription-selector/wizard-subscription-selector-header.hbs delete mode 100644 assets/javascripts/discourse/templates/components/wizard-subscription-selector/wizard-subscription-selector-row.hbs delete mode 100644 assets/javascripts/discourse/templates/components/wizard-text-editor.hbs diff --git a/assets/javascripts/discourse/templates/components/custom-field-input.hbs b/assets/javascripts/discourse/components/custom-field-input.hbs similarity index 63% rename from assets/javascripts/discourse/templates/components/custom-field-input.hbs rename to assets/javascripts/discourse/components/custom-field-input.hbs index 4e3fa2f0..82c7c62a 100644 --- a/assets/javascripts/discourse/templates/components/custom-field-input.hbs +++ b/assets/javascripts/discourse/components/custom-field-input.hbs @@ -1,19 +1,19 @@ -{{#if showInputs}} +{{#if this.showInputs}} {{wizard-subscription-selector - value=field.klass + value=this.field.klass feature="custom_field" attribute="klass" - onChange=(action (mut field.klass)) + onChange=(action (mut this.field.klass)) options=(hash none="admin.wizard.custom_field.klass.select") }} {{wizard-subscription-selector - value=field.type + value=this.field.type feature="custom_field" attribute="type" - onChange=(action (mut field.type)) + onChange=(action (mut this.field.type)) options=(hash none="admin.wizard.custom_field.type.select") }} @@ -25,48 +25,48 @@ {{multi-select - value=field.serializers - content=serializerContent - onChange=(action (mut field.serializers)) + value=this.field.serializers + content=this.serializerContent + onChange=(action (mut this.field.serializers)) options=(hash none="admin.wizard.custom_field.serializers.select") }} - {{#if loading}} + {{#if this.loading}} {{loading-spinner size="small"}} {{else}} - {{#if saveIcon}} - {{d-icon saveIcon}} + {{#if this.saveIcon}} + {{d-icon this.saveIcon}} {{/if}} {{/if}} {{d-button action=(action "destroy") icon="trash-alt" class="destroy" - disabled=destroyDisabled + disabled=this.destroyDisabled }} {{d-button icon="save" action=(action "save") - disabled=saveDisabled + disabled=this.saveDisabled class="save" }} - {{d-button action=(action "close") icon="times" disabled=closeDisabled}} + {{d-button action=(action "close") icon="times" disabled=this.closeDisabled}} {{else}} - - - + + + - {{#if isExternal}} + {{#if this.isExternal}} — {{else}} - {{#each field.serializers as |serializer|}} + {{#each this.field.serializers as |serializer|}} {{/each}} {{/if}} - {{#if isExternal}} + {{#if this.isExternal}}