diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..7898fbf8 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "eslint-config-discourse" +} diff --git a/.github/workflows/plugin-linting.yml b/.github/workflows/plugin-linting.yml new file mode 100644 index 00000000..a121658d --- /dev/null +++ b/.github/workflows/plugin-linting.yml @@ -0,0 +1,53 @@ +name: Linting + +on: + push: + branches: + - master + - main + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: 12 + + - name: Set up ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + + - name: Setup bundler + run: gem install bundler -v 2.1.4 --no-doc + + - name: Setup gems + run: bundle install --jobs 4 + + - name: Yarn install + run: yarn install --dev + + - name: ESLint + run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern {test,assets}/javascripts + + - name: Prettier + run: | + yarn prettier -v + if [ -d "assets" ]; then \ + yarn prettier --list-different "assets/**/*.{scss,js,es6}" ; \ + fi + if [ -d "test" ]; then \ + yarn prettier --list-different "test/**/*.{js,es6}" ; \ + fi + + - name: Ember template lint + run: yarn ember-template-lint assets/javascripts + + - name: Rubocop + run: bundle exec rubocop . \ No newline at end of file diff --git a/.github/workflows/plugin-tests.yml b/.github/workflows/plugin-tests.yml new file mode 100644 index 00000000..ce6112af --- /dev/null +++ b/.github/workflows/plugin-tests.yml @@ -0,0 +1,137 @@ +name: Plugin Tests + +on: + push: + branches: + - master + - main + pull_request: + +jobs: + build: + name: ${{ matrix.build_type }} + runs-on: ubuntu-latest + timeout-minutes: 60 + + env: + DISCOURSE_HOSTNAME: www.example.com + RUBY_GLOBAL_METHOD_CACHE_SIZE: 131072 + RAILS_ENV: test + PGHOST: localhost + PGUSER: discourse + PGPASSWORD: discourse + + strategy: + fail-fast: false + + matrix: + build_type: ["backend", "frontend"] + ruby: ["2.7"] + postgres: ["12"] + redis: ["4.x"] + + services: + postgres: + image: postgres:${{ matrix.postgres }} + ports: + - 5432:5432 + env: + POSTGRES_USER: discourse + POSTGRES_PASSWORD: discourse + options: >- + --mount type=tmpfs,destination=/var/lib/postgresql/data + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v2 + with: + repository: discourse/discourse + fetch-depth: 1 + + - name: Install plugin + uses: actions/checkout@v2 + with: + path: plugins/${{ github.event.repository.name }} + fetch-depth: 1 + + - name: Check spec existence + id: check_spec + uses: andstor/file-existence-action@v1 + with: + files: "plugins/${{ github.event.repository.name }}/spec" + + - name: Check qunit existence + id: check_qunit + uses: andstor/file-existence-action@v1 + with: + files: "plugins/${{ github.event.repository.name }}/test/javascripts" + + - name: Setup Git + run: | + git config --global user.email "ci@ci.invalid" + git config --global user.name "Discourse CI" + + - name: Setup packages + run: | + sudo apt-get update + sudo apt-get -yqq install postgresql-client libpq-dev gifsicle jpegoptim optipng jhead + wget -qO- https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-pngquant | sudo sh + + - name: Update imagemagick + if: matrix.build_type == 'backend' + run: | + wget https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-imagemagick + chmod +x install-imagemagick + sudo ./install-imagemagick + + - name: Setup redis + uses: shogo82148/actions-setup-redis@v1 + with: + redis-version: ${{ matrix.redis }} + + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Lint English locale + if: matrix.build_type == 'backend' + run: bundle exec ruby script/i18n_lint.rb "plugins/${{ github.event.repository.name }}/locales/{client,server}.en.yml" + + - name: Get yarn cache directory + id: yarn-cache-dir + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Yarn cache + uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.os }}-yarn- + + - name: Yarn install + run: yarn install --dev + + - name: Migrate database + run: | + bin/rake db:create + bin/rake db:migrate + + - name: Plugin RSpec + if: matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true' + run: bin/rake plugin:spec[${{ github.event.repository.name }}] + + - name: Plugin QUnit + if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true' + run: bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000'] + timeout-minutes: 30 + + - name: Simplecov Report + if: matrix.build_type == 'backend' + run: COVERAGE=1 bin/rake plugin:spec[${{ github.event.repository.name }}] diff --git a/.gitignore b/.gitignore index 9c1559ac..11ce0a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ coverage/* -!coverage/.last_run.json \ No newline at end of file +!coverage/.last_run.json +gems/ +.bundle/ +auto_generated +.DS_Store +node_modules/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +{} diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 00000000..d46296cf --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,2 @@ +inherit_gem: + rubocop-discourse: default.yml diff --git a/.template-lintrc.js b/.template-lintrc.js new file mode 100644 index 00000000..a558b8e3 --- /dev/null +++ b/.template-lintrc.js @@ -0,0 +1,4 @@ +module.exports = { + plugins: ["ember-template-lint-plugin-discourse"], + extends: "discourse:recommended", +}; diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..7da32ec0 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +group :development do + gem 'rubocop-discourse' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 00000000..2416ce66 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,38 @@ +GEM + remote: https://rubygems.org/ + specs: + ast (2.4.2) + parallel (1.20.1) + parser (3.0.1.0) + ast (~> 2.4.1) + rainbow (3.0.0) + regexp_parser (2.1.1) + rexml (3.2.5) + rubocop (1.12.1) + parallel (~> 1.10) + parser (>= 3.0.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.2.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.4.1) + parser (>= 2.7.1.5) + rubocop-discourse (2.4.1) + rubocop (>= 1.1.0) + rubocop-rspec (>= 2.0.0) + rubocop-rspec (2.2.0) + rubocop (~> 1.0) + rubocop-ast (>= 1.1.0) + ruby-progressbar (1.11.0) + unicode-display_width (2.0.0) + +PLATFORMS + ruby + +DEPENDENCIES + rubocop-discourse + +BUNDLED WITH + 2.2.16 diff --git a/assets/javascripts/discourse/components/custom-field-input.js.es6 b/assets/javascripts/discourse/components/custom-field-input.js.es6 index 1ad0b152..f2dca4c7 100644 --- a/assets/javascripts/discourse/components/custom-field-input.js.es6 +++ b/assets/javascripts/discourse/components/custom-field-input.js.es6 @@ -1,6 +1,7 @@ import Component from "@ember/component"; import discourseComputed, { observes } from "discourse-common/utils/decorators"; -import { or, alias } from "@ember/object/computed"; +import { alias, or } from "@ember/object/computed"; +import I18n from "I18n"; const generateContent = function (array, type) { return array.map((key) => ({ @@ -34,7 +35,7 @@ export default Component.extend({ }, @discourseComputed("field.klass") - serializerContent(klass, p2) { + serializerContent(klass) { const serializers = this.get(`${klass}Serializers`); if (serializers) { @@ -66,21 +67,27 @@ export default Component.extend({ "field.serializers" ) saveDisabled(saving) { - if (saving) return true; + if (saving) { + return true; + } const originalField = this.originalField; - if (!originalField) return false; + if (!originalField) { + return false; + } return ["name", "klass", "type", "serializers"].every((attr) => { let current = this.get(attr); let original = originalField[attr]; - if (!current) return false; + if (!current) { + return false; + } - if (attr == "serializers") { + if (attr === "serializers") { return this.compareArrays(current, original); } else { - return current == original; + return current === original; } }); }, diff --git a/assets/javascripts/discourse/components/wizard-advanced-toggle.js.es6 b/assets/javascripts/discourse/components/wizard-advanced-toggle.js.es6 index b03a7ce5..c6e1fd9c 100644 --- a/assets/javascripts/discourse/components/wizard-advanced-toggle.js.es6 +++ b/assets/javascripts/discourse/components/wizard-advanced-toggle.js.es6 @@ -7,7 +7,9 @@ export default Component.extend({ @discourseComputed("showAdvanced") toggleClass(showAdvanced) { let classes = "btn"; - if (showAdvanced) classes += " btn-primary"; + if (showAdvanced) { + classes += " btn-primary"; + } return classes; }, diff --git a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 b/assets/javascripts/discourse/components/wizard-custom-action.js.es6 index 3dcc85d1..c8309f10 100644 --- a/assets/javascripts/discourse/components/wizard-custom-action.js.es6 +++ b/assets/javascripts/discourse/components/wizard-custom-action.js.es6 @@ -1,11 +1,10 @@ import { default as discourseComputed } from "discourse-common/utils/decorators"; -import { equal, empty, or, and } from "@ember/object/computed"; -import { generateName, selectKitContent } from "../lib/wizard"; +import { and, empty, equal, or } from "@ember/object/computed"; +import { notificationLevels, selectKitContent } from "../lib/wizard"; import { computed } from "@ember/object"; import wizardSchema from "../lib/wizard-schema"; import UndoChanges from "../mixins/undo-changes"; import Component from "@ember/component"; -import { notificationLevels } from "../lib/wizard"; import I18n from "I18n"; export default Component.extend(UndoChanges, { @@ -43,7 +42,7 @@ export default Component.extend(UndoChanges, { name: I18n.t(`admin.wizard.action.${type}.label`), }; }), - availableNotificationLevels: notificationLevels.map((type, index) => { + availableNotificationLevels: notificationLevels.map((type) => { return { id: type, name: I18n.t( @@ -92,7 +91,9 @@ export default Component.extend(UndoChanges, { @discourseComputed("apis", "action.api") availableEndpoints(apis, api) { - if (!api) return []; + if (!api) { + return []; + } return apis.find((a) => a.name === api).endpoints; }, }); diff --git a/assets/javascripts/discourse/components/wizard-custom-field.js.es6 b/assets/javascripts/discourse/components/wizard-custom-field.js.es6 index 85c26677..b5f6b0ee 100644 --- a/assets/javascripts/discourse/components/wizard-custom-field.js.es6 +++ b/assets/javascripts/discourse/components/wizard-custom-field.js.es6 @@ -1,5 +1,5 @@ import { default as discourseComputed } from "discourse-common/utils/decorators"; -import { equal, or, alias } from "@ember/object/computed"; +import { alias, equal, or } from "@ember/object/computed"; import { computed } from "@ember/object"; import { selectKitContent } from "../lib/wizard"; import UndoChanges from "../mixins/undo-changes"; @@ -107,6 +107,40 @@ export default Component.extend(UndoChanges, { return this.setupTypeOutput(fieldType, options); }, + @discourseComputed("step.index") + fieldConditionOptions(stepIndex) { + const options = { + inputTypes: "validation", + context: "field", + textSelection: "value", + userFieldSelection: true, + groupSelection: true, + }; + + if (stepIndex > 0) { + options.wizardFieldSelection = true; + options.wizardActionSelection = true; + } + + return options; + }, + + @discourseComputed("step.index") + fieldIndexOptions(stepIndex) { + const options = { + context: "field", + userFieldSelection: true, + groupSelection: true, + }; + + if (stepIndex > 0) { + options.wizardFieldSelection = true; + options.wizardActionSelection = true; + } + + return options; + }, + actions: { imageUploadDone(upload) { this.set("field.image", upload.url); diff --git a/assets/javascripts/discourse/components/wizard-custom-step.js.es6 b/assets/javascripts/discourse/components/wizard-custom-step.js.es6 index 102af717..2a07dd65 100644 --- a/assets/javascripts/discourse/components/wizard-custom-step.js.es6 +++ b/assets/javascripts/discourse/components/wizard-custom-step.js.es6 @@ -1,9 +1,27 @@ import Component from "@ember/component"; -import { default as discourseComputed } from "discourse-common/utils/decorators"; +import discourseComputed from "discourse-common/utils/decorators"; export default Component.extend({ classNames: "wizard-custom-step", + @discourseComputed("step.index") + stepConditionOptions(stepIndex) { + const options = { + inputTypes: "validation", + context: "step", + textSelection: "value", + userFieldSelection: true, + groupSelection: true, + }; + + if (stepIndex > 0) { + options["wizardFieldSelection"] = true; + options["wizardActionSelection"] = true; + } + + return options; + }, + actions: { bannerUploadDone(upload) { this.set("step.banner", upload.url); diff --git a/assets/javascripts/discourse/components/wizard-links.js.es6 b/assets/javascripts/discourse/components/wizard-links.js.es6 index 6f2ca117..c32809aa 100644 --- a/assets/javascripts/discourse/components/wizard-links.js.es6 +++ b/assets/javascripts/discourse/components/wizard-links.js.es6 @@ -1,15 +1,15 @@ import { default as discourseComputed, - on, observes, + on, } from "discourse-common/utils/decorators"; import { generateName } from "../lib/wizard"; import { - default as wizardSchema, setWizardDefaults, + default as wizardSchema, } from "../lib/wizard-schema"; import { notEmpty } from "@ember/object/computed"; -import { scheduleOnce, bind } from "@ember/runloop"; +import { scheduleOnce } from "@ember/runloop"; import EmberObject from "@ember/object"; import Component from "@ember/component"; import { A } from "@ember/array"; @@ -38,6 +38,7 @@ export default Component.extend({ const items = this.items; const item = items.findBy("id", itemId); items.removeObject(item); + item.set("index", newIndex); items.insertAt(newIndex, item); scheduleOnce("afterRender", this, () => this.applySortable()); }, @@ -53,7 +54,9 @@ export default Component.extend({ "items.@each.title" ) links(current, items) { - if (!items) return; + if (!items) { + return; + } return items.map((item) => { if (item) { @@ -88,22 +91,14 @@ export default Component.extend({ params.isNew = true; - let next = 1; - + let index = 0; if (items.length) { - next = - Math.max.apply( - Math, - items.map((i) => { - let parts = i.id.split("_"); - let lastPart = parts[parts.length - 1]; - return isNaN(lastPart) ? 0 : lastPart; - }) - ) + 1; + index = items.length; } - let id = `${itemType}_${next}`; + params.index = index; + let id = `${itemType}_${index + 1}`; if (itemType === "field") { id = `${this.parentId}_${id}`; } diff --git a/assets/javascripts/discourse/components/wizard-mapper-connector.js.es6 b/assets/javascripts/discourse/components/wizard-mapper-connector.js.es6 index 36c0ec20..3ec2d502 100644 --- a/assets/javascripts/discourse/components/wizard-mapper-connector.js.es6 +++ b/assets/javascripts/discourse/components/wizard-mapper-connector.js.es6 @@ -3,7 +3,6 @@ import { gt } from "@ember/object/computed"; import { computed } from "@ember/object"; import { defaultConnector } from "../lib/wizard-mapper"; import { later } from "@ember/runloop"; -import { observes } from "discourse-common/utils/decorators"; import I18n from "I18n"; export default Component.extend({ diff --git a/assets/javascripts/discourse/components/wizard-mapper-input.js.es6 b/assets/javascripts/discourse/components/wizard-mapper-input.js.es6 index c7327fbc..021f2084 100644 --- a/assets/javascripts/discourse/components/wizard-mapper-input.js.es6 +++ b/assets/javascripts/discourse/components/wizard-mapper-input.js.es6 @@ -1,11 +1,11 @@ import { computed, set } from "@ember/object"; -import { alias, equal, or, not } from "@ember/object/computed"; +import { alias, equal, not, or } from "@ember/object/computed"; import { - newPair, connectorContent, - inputTypesContent, - defaultSelectionType, defaultConnector, + defaultSelectionType, + inputTypesContent, + newPair, } from "../lib/wizard-mapper"; import Component from "@ember/component"; import { observes } from "discourse-common/utils/decorators"; diff --git a/assets/javascripts/discourse/components/wizard-mapper-pair.js.es6 b/assets/javascripts/discourse/components/wizard-mapper-pair.js.es6 index bc7e9be9..cb237056 100644 --- a/assets/javascripts/discourse/components/wizard-mapper-pair.js.es6 +++ b/assets/javascripts/discourse/components/wizard-mapper-pair.js.es6 @@ -1,6 +1,6 @@ import { connectorContent } from "../lib/wizard-mapper"; -import { gt, or, alias } from "@ember/object/computed"; -import { computed, observes } from "@ember/object"; +import { alias, gt } from "@ember/object/computed"; +import { computed } from "@ember/object"; import Component from "@ember/component"; export default Component.extend({ diff --git a/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 b/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 index e70708c9..6d65d782 100644 --- a/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 +++ b/assets/javascripts/discourse/components/wizard-mapper-selector.js.es6 @@ -1,13 +1,12 @@ -import { alias, or, gt } from "@ember/object/computed"; +import { alias, gt, or } from "@ember/object/computed"; import { computed } from "@ember/object"; import { default as discourseComputed, observes, - on, } from "discourse-common/utils/decorators"; import { getOwner } from "discourse-common/lib/get-owner"; import { defaultSelectionType, selectionTypes } from "../lib/wizard-mapper"; -import { snakeCase, generateName, userProperties } from "../lib/wizard"; +import { generateName, snakeCase, userProperties } from "../lib/wizard"; import Component from "@ember/component"; import { bind, later } from "@ember/runloop"; import I18n from "I18n"; @@ -135,7 +134,9 @@ export default Component.extend({ }, documentClick(e) { - if (this._state == "destroying") return; + if (this._state === "destroying") { + return; + } let $target = $(e.target); if (!$target.parents(".type-selector").length && this.showTypes) { @@ -249,7 +250,7 @@ export default Component.extend({ }, @discourseComputed("activeType", "inputType") - placeholderKey(activeType, inputType) { + placeholderKey(activeType) { if ( activeType === "text" && this.options[`${this.selectorType}Placeholder`] @@ -275,14 +276,20 @@ export default Component.extend({ optionEnabled(type) { const options = this.options; - if (!options) return false; + if (!options) { + return false; + } const option = options[type]; - if (option === true) return true; - if (typeof option !== "string") return false; + if (option === true) { + return true; + } + if (typeof option !== "string") { + return false; + } - return option.split(",").filter((option) => { - return [this.selectorType, this.inputType].indexOf(option) !== -1; + return option.split(",").filter((o) => { + return [this.selectorType, this.inputType].indexOf(o) !== -1; }).length; }, diff --git a/assets/javascripts/discourse/components/wizard-mapper.js.es6 b/assets/javascripts/discourse/components/wizard-mapper.js.es6 index 7581adbd..95aabb1c 100644 --- a/assets/javascripts/discourse/components/wizard-mapper.js.es6 +++ b/assets/javascripts/discourse/components/wizard-mapper.js.es6 @@ -1,10 +1,5 @@ -import { getOwner } from "discourse-common/lib/get-owner"; import { newInput, selectionTypes } from "../lib/wizard-mapper"; -import { - default as discourseComputed, - observes, - on, -} from "discourse-common/utils/decorators"; +import discourseComputed from "discourse-common/utils/decorators"; import { later } from "@ember/runloop"; import Component from "@ember/component"; import { A } from "@ember/array"; diff --git a/assets/javascripts/discourse/components/wizard-realtime-validations.js.es6 b/assets/javascripts/discourse/components/wizard-realtime-validations.js.es6 index b9b36e6f..8332b86e 100644 --- a/assets/javascripts/discourse/components/wizard-realtime-validations.js.es6 +++ b/assets/javascripts/discourse/components/wizard-realtime-validations.js.es6 @@ -19,7 +19,9 @@ export default Component.extend({ init() { this._super(...arguments); - if (!this.validations) return; + if (!this.validations) { + return; + } if (!this.field.validations) { const validations = {}; diff --git a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 index 2866537d..88d7200c 100644 --- a/assets/javascripts/discourse/components/wizard-text-editor.js.es6 +++ b/assets/javascripts/discourse/components/wizard-text-editor.js.es6 @@ -1,7 +1,4 @@ -import { - default as discourseComputed, - on, -} from "discourse-common/utils/decorators"; +import discourseComputed from "discourse-common/utils/decorators"; import { notEmpty } from "@ember/object/computed"; import { userProperties } from "../lib/wizard"; import { scheduleOnce } from "@ember/runloop"; diff --git a/assets/javascripts/discourse/connectors/admin-menu/wizards-nav-button.hbs b/assets/javascripts/discourse/connectors/admin-menu/wizards-nav-button.hbs index 5398e27d..f76722fc 100644 --- a/assets/javascripts/discourse/connectors/admin-menu/wizards-nav-button.hbs +++ b/assets/javascripts/discourse/connectors/admin-menu/wizards-nav-button.hbs @@ -1,3 +1,3 @@ {{#if currentUser.admin}} - {{nav-item route='adminWizards' label='admin.wizard.nav_label'}} + {{nav-item route="adminWizards" label="admin.wizard.nav_label"}} {{/if}} diff --git a/assets/javascripts/discourse/connectors/top-notices/prompt-completion.hbs b/assets/javascripts/discourse/connectors/top-notices/prompt-completion.hbs index 503ee113..70c0b7c4 100644 --- a/assets/javascripts/discourse/connectors/top-notices/prompt-completion.hbs +++ b/assets/javascripts/discourse/connectors/top-notices/prompt-completion.hbs @@ -1,7 +1,7 @@ {{#each site.complete_custom_wizard as |wizard|}} -
-
- {{i18n 'wizard.complete_custom' name=wizard.name}} + -{{/each}} \ No newline at end of file +{{/each}} diff --git a/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 index f330c00c..5dba2d7f 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-api-show.js.es6 @@ -2,7 +2,7 @@ import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import CustomWizardApi from "../models/custom-wizard-api"; import { default as discourseComputed } from "discourse-common/utils/decorators"; -import { not, and, equal } from "@ember/object/computed"; +import { and, equal, not } from "@ember/object/computed"; import { selectKitContent } from "../lib/wizard"; import Controller from "@ember/controller"; import I18n from "I18n"; @@ -63,9 +63,12 @@ export default Controller.extend({ clientSecret, threeLeggedOauth ) { - if (saveDisabled || !authType || !tokenUrl || !clientId || !clientSecret) + if (saveDisabled || !authType || !tokenUrl || !clientId || !clientSecret) { return true; - if (threeLeggedOauth) return !authUrl; + } + if (threeLeggedOauth) { + return !authUrl; + } return false; }, @@ -146,16 +149,20 @@ export default Controller.extend({ const api = this.get("api"); const name = api.name; const authType = api.authType; - let refreshList = false; + let refreshList = false; // eslint-disable-line let error; - if (!name || !authType) return; + if (!name || !authType) { + return; + } let data = { auth_type: authType, }; - if (api.title) data["title"] = api.title; + if (api.title) { + data["title"] = api.title; + } const originalTitle = this.get("api.originalTitle"); if (api.get("isNew") || (originalTitle && api.title !== originalTitle)) { @@ -232,7 +239,9 @@ export default Controller.extend({ remove() { const name = this.get("api.name"); - if (!name) return; + if (!name) { + return; + } this.set("updating", true); @@ -250,7 +259,9 @@ export default Controller.extend({ clearLogs() { const name = this.get("api.name"); - if (!name) return; + if (!name) { + return; + } ajax(`/admin/wizards/api/${name.underscore()}/logs`, { type: "DELETE", 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 c1254d3b..2081cfe3 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6 @@ -1,9 +1,5 @@ import Controller from "@ember/controller"; -import EmberObject from "@ember/object"; -import { ajax } from "discourse/lib/ajax"; -import { popupAjaxError } from "discourse/lib/ajax-error"; import CustomWizardCustomField from "../models/custom-wizard-custom-field"; -import { default as discourseComputed } from "discourse-common/utils/decorators"; export default Controller.extend({ messageKey: "create", @@ -49,7 +45,7 @@ export default Controller.extend({ }, removeField(field) { - return CustomWizardCustomField.destroyField(field).then((result) => { + return CustomWizardCustomField.destroyField(field).then(() => { this.get("customFields").removeObject(field); }); }, diff --git a/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 index 5a03f064..9559b01b 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-logs.js.es6 @@ -1,6 +1,4 @@ -import { default as computed } from "discourse-common/utils/decorators"; -import { popupAjaxError } from "discourse/lib/ajax-error"; -import { ajax } from "discourse/lib/ajax"; +import discourseComputed from "discourse-common/utils/decorators"; import { notEmpty } from "@ember/object/computed"; import CustomWizardLogs from "../models/custom-wizard-logs"; import Controller from "@ember/controller"; @@ -13,7 +11,9 @@ export default Controller.extend({ logs: [], loadLogs() { - if (!this.canLoadMore) return; + if (!this.canLoadMore) { + return; + } this.set("refreshing", true); @@ -27,7 +27,7 @@ export default Controller.extend({ .finally(() => this.set("refreshing", false)); }, - @computed("hasLogs", "refreshing") + @discourseComputed("hasLogs", "refreshing") noResults(hasLogs, refreshing) { return !hasLogs && !refreshing; }, diff --git a/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 index 840d68b1..7228d164 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-manager.js.es6 @@ -1,8 +1,5 @@ import Controller from "@ember/controller"; -import { - default as discourseComputed, - observes, -} from "discourse-common/utils/decorators"; +import { observes } from "discourse-common/utils/decorators"; import { empty } from "@ember/object/computed"; import CustomWizardManager from "../models/custom-wizard-manager"; import { A } from "@ember/array"; @@ -196,7 +193,7 @@ export default Controller.extend({ }, destroy() { - const destroyWizards = this.get("destroyWizards"); + let destroyWizards = this.get("destroyWizards"); if (!destroyWizards.length) { this.setMessage("error", "none_selected"); @@ -227,7 +224,7 @@ export default Controller.extend({ if (result.destroyed.length) { const destroyedIds = result.destroyed.map((d) => d.id); - const destroyWizards = this.get("destroyWizards"); + destroyWizards = this.get("destroyWizards"); const wizards = this.get("wizards"); wizards.removeObjects( diff --git a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 index 68dee12e..332efedd 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-wizard-show.js.es6 @@ -1,18 +1,14 @@ import { default as discourseComputed, observes, - on, } from "discourse-common/utils/decorators"; -import { notEmpty, alias } from "@ember/object/computed"; +import { notEmpty } from "@ember/object/computed"; import showModal from "discourse/lib/show-modal"; import { generateId, wizardFieldList } from "../lib/wizard"; -import { buildProperties } from "../lib/wizard-json"; import { dasherize } from "@ember/string"; -import EmberObject from "@ember/object"; -import { scheduleOnce, later } from "@ember/runloop"; +import { later, scheduleOnce } from "@ember/runloop"; import Controller from "@ember/controller"; import copyText from "discourse/lib/copy-text"; -import CustomWizard from "../models/custom-wizard"; import I18n from "I18n"; export default Controller.extend({ diff --git a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 index 73eae8b9..63ddd5e8 100644 --- a/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 +++ b/assets/javascripts/discourse/initializers/custom-wizard-edits.js.es6 @@ -1,4 +1,3 @@ -import { withPluginApi } from "discourse/lib/plugin-api"; import DiscourseURL from "discourse/lib/url"; export default { @@ -6,7 +5,9 @@ export default { initialize(container) { const siteSettings = container.lookup("site-settings:main"); - if (!siteSettings.custom_wizard_enabled) return; + if (!siteSettings.custom_wizard_enabled) { + return; + } const existing = DiscourseURL.routeTo; DiscourseURL.routeTo = function (path, opts) { diff --git a/assets/javascripts/discourse/initializers/custom-wizard-redirect.js.es6 b/assets/javascripts/discourse/initializers/custom-wizard-redirect.js.es6 index ae4db35b..e413cd17 100644 --- a/assets/javascripts/discourse/initializers/custom-wizard-redirect.js.es6 +++ b/assets/javascripts/discourse/initializers/custom-wizard-redirect.js.es6 @@ -8,7 +8,9 @@ export default { const messageBus = container.lookup("message-bus:main"); const siteSettings = container.lookup("site-settings:main"); - if (!siteSettings.custom_wizard_enabled || !messageBus) return; + if (!siteSettings.custom_wizard_enabled || !messageBus) { + return; + } messageBus.subscribe("/redirect_to_wizard", function (wizardId) { const wizardUrl = window.location.origin + "/w/" + wizardId; @@ -19,7 +21,7 @@ export default { actions: { willTransition(transition) { const redirectToWizard = this.get("currentUser.redirect_to_wizard"); - const excludedPaths = Discourse.SiteSettings.wizard_redirect_exclude_paths + const excludedPaths = this.siteSettings.wizard_redirect_exclude_paths .split("|") .concat(["loading"]); diff --git a/assets/javascripts/discourse/lib/wizard-json.js.es6 b/assets/javascripts/discourse/lib/wizard-json.js.es6 index ec85bb19..79da60cb 100644 --- a/assets/javascripts/discourse/lib/wizard-json.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-json.js.es6 @@ -1,4 +1,4 @@ -import { listProperties, camelCase, snakeCase } from "../lib/wizard"; +import { camelCase, listProperties } from "../lib/wizard"; import wizardSchema from "../lib/wizard-schema"; import EmberObject from "@ember/object"; import { A } from "@ember/array"; @@ -23,54 +23,69 @@ function castCase(property, value) { return property.indexOf("_type") > -1 ? camelCase(value) : value; } -function buildProperty(json, property, type) { - let value = json[property]; +function buildMappedProperty(value) { + let inputs = []; - if (mapped(property, type) && present(value) && value.constructor === Array) { - let inputs = []; + value.forEach((inputJson) => { + let input = {}; - value.forEach((inputJson) => { - let input = {}; + Object.keys(inputJson).forEach((inputKey) => { + if (inputKey === "pairs") { + let pairs = []; + let pairCount = inputJson.pairs.length; - Object.keys(inputJson).forEach((inputKey) => { - if (inputKey === "pairs") { - let pairs = []; - let pairCount = inputJson.pairs.length; + inputJson.pairs.forEach((pairJson) => { + let pair = {}; - inputJson.pairs.forEach((pairJson) => { - let pair = {}; - - Object.keys(pairJson).forEach((pairKey) => { - pair[pairKey] = castCase(pairKey, pairJson[pairKey]); - }); - - pair.pairCount = pairCount; - - pairs.push(EmberObject.create(pair)); + Object.keys(pairJson).forEach((pairKey) => { + pair[pairKey] = castCase(pairKey, pairJson[pairKey]); }); - input.pairs = pairs; - } else { - input[inputKey] = castCase(inputKey, inputJson[inputKey]); - } - }); + pair.pairCount = pairCount; - inputs.push(EmberObject.create(input)); + pairs.push(EmberObject.create(pair)); + }); + + input.pairs = pairs; + } else { + input[inputKey] = castCase(inputKey, inputJson[inputKey]); + } }); - return A(inputs); - } else { - return value; - } + inputs.push(EmberObject.create(input)); + }); + + return A(inputs); } -function buildObject(json, type) { +function buildProperty(json, property, type, objectIndex) { + let value = json[property]; + if ( + property === "index" && + (value === null || value === undefined) && + (objectIndex !== null || objectIndex !== undefined) + ) { + return objectIndex; + } + + if ( + !mapped(property, type) || + !present(value) || + !value.constructor === Array + ) { + return value; + } + + return buildMappedProperty(value); +} + +function buildObject(json, type, objectIndex) { let props = { isNew: false, }; Object.keys(json).forEach((prop) => { - props[prop] = buildProperty(json, prop, type); + props[prop] = buildProperty(json, prop, type, objectIndex); }); return EmberObject.create(props); @@ -80,8 +95,8 @@ function buildObjectArray(json, type) { let array = A(); if (present(json)) { - json.forEach((objJson) => { - let object = buildObject(objJson, type); + json.forEach((objJson, objectIndex) => { + let object = buildObject(objJson, type, objectIndex); if (hasAdvancedProperties(object, type)) { object.set("showAdvanced", true); @@ -94,9 +109,9 @@ function buildObjectArray(json, type) { return array; } -function buildBasicProperties(json, type, props) { +function buildBasicProperties(json, type, props, objectIndex = null) { listProperties(type).forEach((p) => { - props[p] = buildProperty(json, p, type); + props[p] = buildProperty(json, p, type, objectIndex); if (hasAdvancedProperties(json, type)) { props.showAdvanced = true; @@ -142,12 +157,17 @@ function buildProperties(json) { props = buildBasicProperties(json, "wizard", props); if (present(json.steps)) { - json.steps.forEach((stepJson) => { + json.steps.forEach((stepJson, objectIndex) => { let stepProps = { isNew: false, }; - stepProps = buildBasicProperties(stepJson, "step", stepProps); + stepProps = buildBasicProperties( + stepJson, + "step", + stepProps, + objectIndex + ); stepProps.fields = buildObjectArray(stepJson.fields, "field"); props.steps.pushObject(EmberObject.create(stepProps)); diff --git a/assets/javascripts/discourse/lib/wizard-mapper.js.es6 b/assets/javascripts/discourse/lib/wizard-mapper.js.es6 index 8af93297..29315b9c 100644 --- a/assets/javascripts/discourse/lib/wizard-mapper.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-mapper.js.es6 @@ -4,6 +4,13 @@ import I18n from "I18n"; // Inputs +const selectableInputTypes = [ + "conditional", + "assignment", + "association", + "validation", +]; + function defaultInputType(options = {}) { return options.inputTypes.split(",")[0]; } @@ -43,13 +50,23 @@ function defaultConnector(connectorType, inputType, options = {}) { return defaultInputType(options); } if (connectorType === "pair") { - if (inputType === "conditional") return "equal"; - if (inputType === "association") return "association"; - if (inputType === "validation") return "equal"; + if (inputType === "conditional") { + return "equal"; + } + if (inputType === "association") { + return "association"; + } + if (inputType === "validation") { + return "equal"; + } } if (connectorType === "output") { - if (inputType === "conditional") return "then"; - if (inputType === "assignment") return "set"; + if (inputType === "conditional") { + return "then"; + } + if (inputType === "assignment") { + return "set"; + } } return "equal"; } diff --git a/assets/javascripts/discourse/lib/wizard-schema.js.es6 b/assets/javascripts/discourse/lib/wizard-schema.js.es6 index 09841579..13a5268c 100644 --- a/assets/javascripts/discourse/lib/wizard-schema.js.es6 +++ b/assets/javascripts/discourse/lib/wizard-schema.js.es6 @@ -1,4 +1,5 @@ -import { set, get } from "@ember/object"; +import { get, set } from "@ember/object"; +import { getOwner } from "discourse-common/lib/get-owner"; const wizard = { basic: { @@ -37,6 +38,7 @@ const wizard = { const step = { basic: { id: null, + index: null, title: null, key: null, banner: null, @@ -44,9 +46,11 @@ const step = { required_data: null, required_data_message: null, permitted_params: null, + condition: null, + force_final: false, }, - mapped: ["required_data", "permitted_params"], - advanced: ["required_data", "permitted_params"], + mapped: ["required_data", "permitted_params", "condition", "index"], + advanced: ["required_data", "permitted_params", "condition", "index"], required: ["id"], dependent: {}, objectArrays: { @@ -77,16 +81,18 @@ const step = { const field = { basic: { id: null, + index: null, label: null, image: null, description: null, required: null, key: null, type: null, + condition: null, }, types: {}, - mapped: ["prefill", "content"], - advanced: ["property", "key"], + mapped: ["prefill", "content", "condition", "index"], + advanced: ["property", "key", "condition", "index"], required: ["id", "type"], dependent: {}, objectArrays: {}, @@ -234,7 +240,8 @@ export function buildFieldValidations(validations) { wizardSchema.field.validations = validations; } -if (Discourse.SiteSettings.wizard_apis_enabled) { +const siteSettings = getOwner(this).lookup("site-settings:main"); +if (siteSettings.wizard_apis_enabled) { wizardSchema.action.types.send_to_api = { api: null, api_endpoint: null, @@ -242,7 +249,7 @@ if (Discourse.SiteSettings.wizard_apis_enabled) { }; } -export function setWizardDefaults(obj, itemType, opts = {}) { +export function setWizardDefaults(obj, itemType) { const objSchema = wizardSchema[itemType]; const basicDefaults = objSchema.basic; diff --git a/assets/javascripts/discourse/lib/wizard.js.es6 b/assets/javascripts/discourse/lib/wizard.js.es6 index 4746fda1..1896b1fe 100644 --- a/assets/javascripts/discourse/lib/wizard.js.es6 +++ b/assets/javascripts/discourse/lib/wizard.js.es6 @@ -9,7 +9,7 @@ function generateName(id) { return id ? sentenceCase(id) : ""; } -function generateId(name, opts = {}) { +function generateId(name) { return name ? snakeCase(name) : ""; } @@ -60,10 +60,10 @@ const notificationLevels = [ "muted", ]; -function listProperties(type, opts = {}) { - let properties = Object.keys(wizardSchema[type].basic); +function listProperties(itemType, opts = {}) { + let properties = Object.keys(wizardSchema[itemType].basic); - const types = wizardSchema[type].types; + const types = wizardSchema[itemType].types; if (types) { let typeProperties = []; diff --git a/assets/javascripts/discourse/mixins/undo-changes.js.es6 b/assets/javascripts/discourse/mixins/undo-changes.js.es6 index 61608cf2..b2ab322d 100644 --- a/assets/javascripts/discourse/mixins/undo-changes.js.es6 +++ b/assets/javascripts/discourse/mixins/undo-changes.js.es6 @@ -1,8 +1,7 @@ import { listProperties } from "../lib/wizard"; import { default as wizardSchema } from "../lib/wizard-schema"; -import { set, get } from "@ember/object"; +import { get, set } from "@ember/object"; import Mixin from "@ember/object/mixin"; -import { observes } from "discourse-common/utils/decorators"; import { deepEqual } from "discourse-common/lib/object"; export default Mixin.create({ @@ -97,7 +96,6 @@ export default Mixin.create({ actions: { undoChanges() { const componentType = this.componentType; - const original = this.get("originalObject"); const obj = this.get(componentType); this.removeObservers(obj.type); @@ -118,6 +116,7 @@ export default Mixin.create({ this.setupObservers(type); }, + // eslint-disable-next-line mappedFieldUpdated(property, mappedComponent, type) { const obj = this.get(this.componentType); obj.notifyPropertyChange(property); diff --git a/assets/javascripts/discourse/models/custom-wizard.js.es6 b/assets/javascripts/discourse/models/custom-wizard.js.es6 index aa9c1145..e6a8408d 100644 --- a/assets/javascripts/discourse/models/custom-wizard.js.es6 +++ b/assets/javascripts/discourse/models/custom-wizard.js.es6 @@ -1,7 +1,7 @@ import { ajax } from "discourse/lib/ajax"; import EmberObject from "@ember/object"; -import { buildProperties, present, mapped } from "../lib/wizard-json"; -import { listProperties, camelCase, snakeCase } from "../lib/wizard"; +import { buildProperties, mapped, present } from "../lib/wizard-json"; +import { listProperties, snakeCase } from "../lib/wizard"; import wizardSchema from "../lib/wizard-schema"; import { Promise } from "rsvp"; import { popupAjaxError } from "discourse/lib/ajax-error"; @@ -131,9 +131,15 @@ const CustomWizard = EmberObject.extend({ return result; }, - buildMappedJson(inputs) { - if (!inputs || !inputs.length) return false; + buildMappedJson(value) { + if (typeof value === "string" || Number.isInteger(value)) { + return value; + } + if (!value || !value.length) { + return false; + } + let inputs = value; let result = []; inputs.forEach((inpt) => { diff --git a/assets/javascripts/discourse/routes/admin-wizards-api.js.es6 b/assets/javascripts/discourse/routes/admin-wizards-api.js.es6 index 927af8c8..541ab028 100644 --- a/assets/javascripts/discourse/routes/admin-wizards-api.js.es6 +++ b/assets/javascripts/discourse/routes/admin-wizards-api.js.es6 @@ -8,7 +8,7 @@ export default DiscourseRoute.extend({ setupController(controller, model) { const showParams = this.paramsFor("adminWizardsApiShow"); - const apiName = showParams.name == "create" ? null : showParams.name; + const apiName = showParams.name === "create" ? null : showParams.name; const apiList = (model || []).map((api) => { return { id: api.name, diff --git a/assets/javascripts/discourse/templates/admin-wizards-api-show.hbs b/assets/javascripts/discourse/templates/admin-wizards-api-show.hbs index 465e11aa..4d3def3d 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-api-show.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-api-show.hbs @@ -1,5 +1,5 @@
-
+
{{#if updating}} {{loading-spinner size="small"}} {{else}} @@ -23,7 +23,7 @@
{{#if api.isNew}} - {{i18n 'admin.wizard.api.new'}} + {{i18n "admin.wizard.api.new"}} {{else}} {{api.title}} {{/if}} @@ -31,14 +31,14 @@ @@ -72,13 +72,13 @@
- {{i18n 'admin.wizard.api.auth.settings'}} + {{i18n "admin.wizard.api.auth.settings"}}
{{#if showRedirectUri}}
- +
{{api.redirectUri}}
@@ -87,14 +87,14 @@ {{/if}}
- +
{{combo-box - value=api.authType + value=api.authType content=authorizationTypes onChange=(action (mut api.authType)) options=(hash - none='admin.wizard.api.auth.type_none' + none="admin.wizard.api.auth.type_none" )}}
@@ -102,7 +102,7 @@ {{#if isOauth}} {{#if threeLeggedOauth}}
- +
{{input value=api.authUrl}}
@@ -110,51 +110,51 @@ {{/if}}
- +
{{input value=api.tokenUrl}}
- +
{{input value=api.clientId}}
- +
{{input value=api.clientSecret}}
- +
{{#each api.authParams as |param|}}
- {{input value=param.key placeholder=(i18n 'admin.wizard.key')}} - {{input value=param.value placeholder=(i18n 'admin.wizard.value')}} - {{d-button action=(action "removeParam") actionParam=param icon='times'}} + {{input value=param.key placeholder=(i18n "admin.wizard.key")}} + {{input value=param.value placeholder=(i18n "admin.wizard.value")}} + {{d-button action=(action "removeParam") actionParam=param icon="times"}}
{{/each}} - {{d-button label='admin.wizard.api.auth.params.new' icon='plus' action=(action "addParam")}} + {{d-button label="admin.wizard.api.auth.params.new" icon="plus" action=(action "addParam")}}
{{/if}} {{#if isBasicAuth}}
- +
{{input value=api.username}}
- +
{{input value=api.password}}
@@ -175,12 +175,12 @@
- {{i18n 'admin.wizard.api.status.label'}} + {{i18n "admin.wizard.api.status.label"}}
{{#if threeLeggedOauth}}
- +
{{api.code}}
@@ -188,7 +188,7 @@ {{/if}}
- +
{{api.accessToken}}
@@ -196,7 +196,7 @@ {{#if threeLeggedOauth}}
- +
{{api.refreshToken}}
@@ -204,14 +204,14 @@ {{/if}}
- +
{{api.tokenExpiresAt}}
- +
{{api.tokenRefreshAt}}
@@ -221,11 +221,11 @@
- {{i18n 'admin.wizard.api.endpoint.label'}} + {{i18n "admin.wizard.api.endpoint.label"}}
- {{d-button action=(action "addEndpoint") label='admin.wizard.api.endpoint.add' icon='plus'}} + {{d-button action=(action "addEndpoint") label="admin.wizard.api.endpoint.add" icon="plus"}} {{#if api.endpoints}}
@@ -236,14 +236,14 @@
{{input value=endpoint.name - placeholder=(i18n 'admin.wizard.api.endpoint.name')}} + placeholder=(i18n "admin.wizard.api.endpoint.name")}} {{input value=endpoint.url - placeholder=(i18n 'admin.wizard.api.endpoint.url') - class='endpoint-url'}} + placeholder=(i18n "admin.wizard.api.endpoint.url") + class="endpoint-url"}} {{d-button action=(action "removeEndpoint") actionParam=endpoint - icon='times' - class='remove-endpoint'}} + icon="times" + class="remove-endpoint"}}
{{combo-box @@ -278,33 +278,37 @@
- {{i18n 'admin.wizard.api.log.label'}} + {{i18n "admin.wizard.api.log.label"}} {{d-button action=(action "clearLogs") - icon='trash-alt' - class='clear-logs'}} + icon="trash-alt" + class="clear-logs"}}
- - - - - - {{#each api.log as |logentry|}} - - - - - - - - {{/each}} + + + + + + + + + {{#each api.log as |logentry|}} + + + + + + + + {{/each}} +
DatetimeUserStatusURLError
{{logentry.time}} - - {{logentry.status}}{{logentry.url}}{{logentry.error}}
DatetimeUserStatusURLError
{{logentry.time}} + + {{logentry.status}}{{logentry.url}}{{logentry.error}}
diff --git a/assets/javascripts/discourse/templates/admin-wizards-api.hbs b/assets/javascripts/discourse/templates/admin-wizards-api.hbs index 5f0c02ff..00d8ad60 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-api.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-api.hbs @@ -2,11 +2,11 @@ {{combo-box value=apiName content=apiList - onChange=(route-action 'changeApi') + onChange=(route-action "changeApi") options=(hash - none='admin.wizard.api.select' + none="admin.wizard.api.select" )}} - + {{d-button action="createApi" label="admin.wizard.api.create" diff --git a/assets/javascripts/discourse/templates/admin-wizards-custom-fields.hbs b/assets/javascripts/discourse/templates/admin-wizards-custom-fields.hbs index 4633344b..10501498 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-custom-fields.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-custom-fields.hbs @@ -1,6 +1,6 @@
-

{{i18n 'admin.wizard.custom_field.nav_label'}}

- +

{{i18n "admin.wizard.custom_field.nav_label"}}

+
{{d-button label="admin.wizard.custom_field.add" @@ -14,23 +14,27 @@ opts=messageOpts type=messageType url=documentationUrl - component='custom_fields'}} + component="custom_fields"}}
{{#if customFields}} - - {{#each fieldKeys as |key|}} - + + + {{#each fieldKeys as |key|}} + + {{/each}} + + + + + {{#each customFields as |field|}} + {{custom-field-input + field=field + removeField=(action "removeField") + saveField=(action "saveField")}} {{/each}} - - - {{#each customFields as |field|}} - {{custom-field-input - field=field - removeField=(action 'removeField') - saveField=(action 'saveField')}} - {{/each}} +
{{i18n (concat "admin.wizard.custom_field." key ".label")}}
{{i18n (concat "admin.wizard.custom_field." key ".label")}}
{{/if}}
diff --git a/assets/javascripts/discourse/templates/admin-wizards-logs.hbs b/assets/javascripts/discourse/templates/admin-wizards-logs.hbs index 28052fe2..18fd3fdb 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-logs.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-logs.hbs @@ -1,6 +1,6 @@
-

{{i18n 'admin.wizard.log.nav_label'}}

- +

{{i18n "admin.wizard.log.nav_label"}}

+ {{d-button label="refresh" icon="refresh" @@ -10,7 +10,7 @@ {{#load-more selector=".log-list tr" action=(action "loadMore") class="wizard-logs"}} {{#if noResults}} -

{{i18n 'search.no_results'}}

+

{{i18n "search.no_results"}}

{{else}} @@ -27,8 +27,8 @@ {{/each}} -
+ {{/if}} - + {{conditional-loading-spinner condition=refreshing}} -{{/load-more}} \ No newline at end of file +{{/load-more}} diff --git a/assets/javascripts/discourse/templates/admin-wizards-manager.hbs b/assets/javascripts/discourse/templates/admin-wizards-manager.hbs index 3eda71e2..9ee2f080 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-manager.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-manager.hbs @@ -1,18 +1,18 @@
-

{{i18n 'admin.wizard.manager.title'}}

- +

{{i18n "admin.wizard.manager.title"}}

+
{{#if filename}} {{/if}} - + {{input - id='file-upload' + id="file-upload" type="file" accept="application/json" change=(action "setFile")}} @@ -45,15 +45,15 @@ opts=messageOpts items=messageItems loading=loading - component='manager'}} + component="manager"}}
- - - + + + @@ -65,19 +65,19 @@ {{/link-to}} {{/each}}
{{i18n 'admin.wizard.label'}}{{i18n 'admin.wizard.manager.export'}}{{i18n 'admin.wizard.manager.destroy'}}{{i18n "admin.wizard.label"}}{{i18n "admin.wizard.manager.export"}}{{i18n "admin.wizard.manager.destroy"}}
- {{input + {{input type="checkbox" class="export" - change=(action 'selectWizard')}} + change=(action "selectWizard")}} - {{input + {{input type="checkbox" class="destroy" - change=(action 'selectWizard')}} + change=(action "selectWizard")}}
-
\ No newline at end of file +
diff --git a/assets/javascripts/discourse/templates/admin-wizards-submissions-show.hbs b/assets/javascripts/discourse/templates/admin-wizards-submissions-show.hbs index 3b4cb401..6d1f255b 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-submissions-show.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-submissions-show.hbs @@ -1,29 +1,33 @@ {{#if submissions}}
- - {{#each fields as |f|}} - - {{/each}} - - {{#each submissions as |s|}} + - {{#each-in s as |k v|}} - - {{/each-in}} + {{#each fields as |f|}} + + {{/each}} - {{/each}} + + + {{#each submissions as |s|}} + + {{#each-in s as |k v|}} + + {{/each-in}} + + {{/each}} +
{{f}}
{{v}}{{f}}
{{v}}
{{/if}} diff --git a/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs b/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs index ca0b835e..d843485a 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-submissions.hbs @@ -2,9 +2,9 @@ {{combo-box value=wizardId content=wizardList - onChange=(route-action 'changeWizard') + onChange=(route-action "changeWizard") options=(hash - none='admin.wizard.select' + none="admin.wizard.select" )}}
diff --git a/assets/javascripts/discourse/templates/admin-wizards-wizard-show.hbs b/assets/javascripts/discourse/templates/admin-wizards-wizard-show.hbs index 65cbc16e..7e5b0ee0 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-wizard-show.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-wizard-show.hbs @@ -1,10 +1,10 @@ -{{#if wizard}} +{{#if wizard}}
{{input name="name" value=wizard.name placeholderKey="admin.wizard.name_placeholder"}} - +
{{#if wizard.name}} {{#if copiedUrl}} @@ -12,15 +12,15 @@ {{else}} {{d-button action=(action "copyUrl") class="pull-right no-text" icon="copy"}} {{/if}} - {{wizardUrl}} + {{wizardUrl}} {{/if}}
-
+
- +
{{input @@ -30,127 +30,127 @@ class="small"}}
- +
- +
{{combo-box content=themes - valueProperty='id' + valueProperty="id" value=wizard.theme_id onChange=(action (mut wizard.theme_id)) options=(hash - none='admin.wizard.no_theme' + none="admin.wizard.no_theme" )}}
- {{i18n 'admin.wizard.label'}} + {{i18n "admin.wizard.label"}}
- +
- {{input type='checkbox' checked=wizard.required}} - {{i18n 'admin.wizard.required_label'}} + {{input type="checkbox" checked=wizard.required}} + {{i18n "admin.wizard.required_label"}}
- +
- {{input type='checkbox' checked=wizard.after_signup}} - {{i18n 'admin.wizard.after_signup_label'}} -
-
- -
-
- -
-
- {{input type='checkbox' checked=wizard.multiple_submissions}} - {{i18n 'admin.wizard.multiple_submissions_label'}} + {{input type="checkbox" checked=wizard.after_signup}} + {{i18n "admin.wizard.after_signup_label"}}
- +
- {{input type='checkbox' checked=wizard.prompt_completion}} - {{i18n 'admin.wizard.prompt_completion_label'}} + {{input type="checkbox" checked=wizard.multiple_submissions}} + {{i18n "admin.wizard.multiple_submissions_label"}}
- + +
+
+ +
+
+ {{input type="checkbox" checked=wizard.prompt_completion}} + {{i18n "admin.wizard.prompt_completion_label"}} +
+
+
- +
- {{input type='checkbox' checked=wizard.after_time}} - {{i18n 'admin.wizard.after_time_label'}} + {{input type="checkbox" checked=wizard.after_time}} + {{i18n "admin.wizard.after_time_label"}} {{d-button - action='setNextSessionScheduled' + action="setNextSessionScheduled" translatedLabel=nextSessionScheduledLabel class="btn-after-time" - icon='far-calendar'}} + icon="far-calendar"}}
- +
- +
{{wizard-mapper inputs=wizard.permitted options=(hash - context='wizard' - inputTypes='assignment,validation' - groupSelection='output' - userFieldSelection='key' - textSelection='value' - inputConnector='and' + context="wizard" + inputTypes="assignment,validation" + groupSelection="output" + userFieldSelection="key" + textSelection="value" + inputConnector="and" )}}
- + {{wizard-advanced-toggle showAdvanced=wizard.showAdvanced}} - + {{#if wizard.showAdvanced}}
- +
- +
- {{input type='checkbox' checked=wizard.save_submissions}} - {{i18n 'admin.wizard.save_submissions_label'}} + {{input type="checkbox" checked=wizard.save_submissions}} + {{i18n "admin.wizard.save_submissions_label"}}
- +
- +
- {{input type='checkbox' checked=wizard.restart_on_revisit}} - {{i18n 'admin.wizard.restart_on_revisit_label'}} + {{input type="checkbox" checked=wizard.restart_on_revisit}} + {{i18n "admin.wizard.restart_on_revisit_label"}}
- +
{{/if}}
@@ -185,19 +185,19 @@ wizardFields=wizardFields}} {{/each}} -
- - + {{#unless creating}} - {{/unless}} - - {{conditional-loading-spinner condition=saving size='small'}} - + + {{conditional-loading-spinner condition=saving size="small"}} + {{#if error}} {{d-icon "times"}}{{error}} {{/if}} diff --git a/assets/javascripts/discourse/templates/admin-wizards-wizard.hbs b/assets/javascripts/discourse/templates/admin-wizards-wizard.hbs index 049184e2..081cd5f3 100644 --- a/assets/javascripts/discourse/templates/admin-wizards-wizard.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards-wizard.hbs @@ -2,11 +2,11 @@ {{combo-box value=wizardListVal content=wizardList - onChange=(route-action 'changeWizard') + onChange=(route-action "changeWizard") options=(hash - none='admin.wizard.select' + none="admin.wizard.select" )}} - + {{d-button action="createWizard" label="admin.wizard.create" @@ -16,8 +16,8 @@ {{wizard-message key=messageKey url=messageUrl - component='wizard'}} + component="wizard"}}
{{outlet}} -
\ No newline at end of file +
diff --git a/assets/javascripts/discourse/templates/admin-wizards.hbs b/assets/javascripts/discourse/templates/admin-wizards.hbs index c616e668..bd575aae 100644 --- a/assets/javascripts/discourse/templates/admin-wizards.hbs +++ b/assets/javascripts/discourse/templates/admin-wizards.hbs @@ -1,12 +1,12 @@ {{#admin-nav}} - {{nav-item route='adminWizardsWizard' label='admin.wizard.nav_label'}} - {{nav-item route='adminWizardsCustomFields' label='admin.wizard.custom_field.nav_label'}} - {{nav-item route='adminWizardsSubmissions' label='admin.wizard.submissions.nav_label'}} + {{nav-item route="adminWizardsWizard" label="admin.wizard.nav_label"}} + {{nav-item route="adminWizardsCustomFields" label="admin.wizard.custom_field.nav_label"}} + {{nav-item route="adminWizardsSubmissions" label="admin.wizard.submissions.nav_label"}} {{#if siteSettings.wizard_apis_enabled}} - {{nav-item route='adminWizardsApi' label='admin.wizard.api.nav_label'}} + {{nav-item route="adminWizardsApi" label="admin.wizard.api.nav_label"}} {{/if}} - {{nav-item route='adminWizardsLogs' label='admin.wizard.log.nav_label'}} - {{nav-item route='adminWizardsManager' label='admin.wizard.manager.nav_label'}} + {{nav-item route="adminWizardsLogs" label="admin.wizard.log.nav_label"}} + {{nav-item route="adminWizardsManager" label="admin.wizard.manager.nav_label"}} {{/admin-nav}}
diff --git a/assets/javascripts/discourse/templates/components/custom-field-input.hbs b/assets/javascripts/discourse/templates/components/custom-field-input.hbs index 7e6598a0..205b1644 100644 --- a/assets/javascripts/discourse/templates/components/custom-field-input.hbs +++ b/assets/javascripts/discourse/templates/components/custom-field-input.hbs @@ -60,4 +60,4 @@ {{d-button action="edit" icon="pencil-alt"}} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/assets/javascripts/discourse/templates/components/wizard-advanced-toggle.hbs b/assets/javascripts/discourse/templates/components/wizard-advanced-toggle.hbs index e77e3a31..ec2bcb76 100644 --- a/assets/javascripts/discourse/templates/components/wizard-advanced-toggle.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-advanced-toggle.hbs @@ -1,4 +1,4 @@ {{d-button action="toggleAdvanced" - label='admin.wizard.advanced' - class=toggleClass}} \ No newline at end of file + label="admin.wizard.advanced" + class=toggleClass}} diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs index 265da2a3..f06e0d89 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-action.hbs @@ -10,7 +10,7 @@
- +
{{combo-box value=action.type @@ -26,7 +26,7 @@
- +
{{combo-box value=action.run_after @@ -38,23 +38,23 @@ {{wizard-message key=messageKey url=messageUrl - component='action'}} + component="action"}} {{#if basicTopicFields}}
- +
{{wizard-mapper inputs=action.title - property='title' - onUpdate=(action 'mappedFieldUpdated') + property="title" + onUpdate=(action "mappedFieldUpdated") options=(hash wizardFieldSelection=true - userFieldSelection='key,value' - context='action' + userFieldSelection="key,value" + context="action" )}}
@@ -63,21 +63,21 @@
- +
{{combo-box value=action.post content=wizardFields - nameProperty='label' + nameProperty="label" onChange=(action (mut action.post)) options=(hash - none='admin.wizard.selector.placeholder.wizard_field' + none="admin.wizard.selector.placeholder.wizard_field" isDisabled=showPostBuilder )}} - +
- {{input type='checkbox' checked=action.post_builder}} - {{i18n 'admin.wizard.action.post_builder.checkbox'}} + {{input type="checkbox" checked=action.post_builder}} + {{i18n "admin.wizard.action.post_builder.checkbox"}}
@@ -85,9 +85,9 @@ {{#if action.post_builder}}
- +
- +
{{wizard-text-editor value=action.post_template @@ -102,83 +102,83 @@
- +
{{wizard-mapper inputs=action.category - property='category' - onUpdate=(action 'mappedFieldUpdated') + property="category" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='key,value' + textSelection="key,value" wizardFieldSelection=true - userFieldSelection='key,value' - categorySelection='output' - wizardActionSelection='output' - outputDefaultSelection='category' - context='action' + userFieldSelection="key,value" + categorySelection="output" + wizardActionSelection="output" + outputDefaultSelection="category" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.tags - property='tags' - onUpdate=(action 'mappedFieldUpdated') + property="tags" + onUpdate=(action "mappedFieldUpdated") options=(hash - tagSelection='output' - outputDefaultSelection='tag' - listSelection='output' + tagSelection="output" + outputDefaultSelection="tag" + listSelection="output" wizardFieldSelection=true - userFieldSelection='key,value' - context='action' + userFieldSelection="key,value" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.visible - property='visible' - onUpdate=(action 'mappedFieldUpdated') + property="visible" + onUpdate=(action "mappedFieldUpdated") options=(hash wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
{{/if}} -{{#if sendMessage}} +{{#if sendMessage}}
- +
{{wizard-mapper inputs=action.recipient - property='recipient' - onUpdate=(action 'mappedFieldUpdated') + property="recipient" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='value,output' + textSelection="value,output" wizardFieldSelection=true - userFieldSelection='key,value' - groupSelection='key,value' - userSelection='output' - outputDefaultSelection='user' - context='action' + userFieldSelection="key,value" + groupSelection="key,value" + userSelection="output" + outputDefaultSelection="user" + context="action" )}}
@@ -187,21 +187,21 @@ {{#if updateProfile}}
- +
- - {{wizard-mapper + + {{wizard-mapper inputs=action.profile_updates - property='profile_updates' - onUpdate=(action 'mappedFieldUpdated') + property="profile_updates" + onUpdate=(action "mappedFieldUpdated") options=(hash - inputTypes='association' - textSelection='value' - userFieldSelection='key' - wizardFieldSelection='value' - wizardActionSelection='value' - keyDefaultSelection='userField' - context='action' + inputTypes="association" + textSelection="value" + userFieldSelection="key" + wizardFieldSelection="value" + wizardActionSelection="value" + keyDefaultSelection="userField" + context="action" )}}
{{/if}} @@ -211,7 +211,7 @@
- +
{{combo-box value=action.api @@ -219,7 +219,7 @@ onChange=(action (mut action.api)) options=(hash isDisabled=action.custom_title_enabled - none='admin.wizard.action.send_to_api.select_an_api' + none="admin.wizard.action.send_to_api.select_an_api" )}}
@@ -228,7 +228,7 @@
- +
{{combo-box value=action.api_endpoint @@ -236,7 +236,7 @@ onChange=(action (mut action.api_endpoint)) options=(hash isDisabled=apiEmpty - none='admin.wizard.action.send_to_api.select_an_endpoint' + none="admin.wizard.action.send_to_api.select_an_endpoint" )}}
@@ -245,14 +245,14 @@
- +
{{wizard-text-editor value=action.api_body previewEnabled=false barEnabled=false wizardFields=wizardFields - placeholder='admin.wizard.action.send_to_api.body_placeholder'}} + placeholder="admin.wizard.action.send_to_api.body_placeholder"}}
{{/if}} @@ -262,20 +262,20 @@
- +
{{wizard-mapper inputs=action.group - property='group' - onUpdate=(action 'mappedFieldUpdated') + property="group" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='value,output' - wizardFieldSelection='key,value,assignment' - userFieldSelection='key,value,assignment' + textSelection="value,output" + wizardFieldSelection="key,value,assignment" + userFieldSelection="key,value,assignment" wizardActionSelection=true - groupSelection='value,output' - outputDefaultSelection='group' - context='action' + groupSelection="value,output" + outputDefaultSelection="group" + context="action" )}}
@@ -286,19 +286,19 @@
- +
{{wizard-mapper inputs=action.url - property='url' - onUpdate=(action 'mappedFieldUpdated') + property="url" + onUpdate=(action "mappedFieldUpdated") options=(hash - context='action' + context="action" wizardFieldSelection=true - userFieldSelection='key,value' - groupSelection='key,value' - categorySelection='key,value' - userSelection='key,value' + userFieldSelection="key,value" + groupSelection="key,value" + categorySelection="key,value" + userSelection="key,value" )}}
@@ -309,19 +309,19 @@
- +
{{wizard-mapper inputs=action.categories - property='categories' - onUpdate=(action 'mappedFieldUpdated') + property="categories" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='key,value' + textSelection="key,value" wizardFieldSelection=true wizardActionSelection=true - userFieldSelection='key,value' - categorySelection='output' - context='action' + userFieldSelection="key,value" + categorySelection="output" + context="action" )}}
@@ -334,12 +334,12 @@
{{wizard-mapper inputs=action.mute_remainder - property='mute_remainder' - onUpdate=(action 'mappedFieldUpdated') + property="mute_remainder" + onUpdate=(action "mappedFieldUpdated") options=(hash - context='action' + context="action" wizardFieldSelection=true - userFieldSelection='key,value' + userFieldSelection="key,value" )}}
@@ -356,11 +356,11 @@ onChange=(action (mut action.notification_level)) options=(hash isDisabled=action.custom_title_enabled - none='admin.wizard.action.watch_categories.select_a_notification_level' + none="admin.wizard.action.watch_categories.select_a_notification_level" )}}
- +
@@ -370,7 +370,7 @@ {{input type="checkbox" checked=action.wizard_user}}
- +
@@ -379,13 +379,13 @@
{{wizard-mapper inputs=action.usernames - property='usernames' - onUpdate=(action 'mappedFieldUpdated') + property="usernames" + onUpdate=(action "mappedFieldUpdated") options=(hash - context='action' + context="action" wizardFieldSelection=true - userFieldSelection='key,value' - userSelection='output' + userFieldSelection="key,value" + userSelection="output" )}}
@@ -396,17 +396,17 @@
- +
{{wizard-mapper inputs=action.name - property='name' - onUpdate=(action 'mappedFieldUpdated') + property="name" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -414,17 +414,17 @@
- +
{{wizard-mapper inputs=action.full_name - property='full_name' - onUpdate=(action 'mappedFieldUpdated') + property="full_name" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -432,17 +432,17 @@
- +
{{wizard-mapper inputs=action.title - property='title' - onUpdate=(action 'mappedFieldUpdated') + property="title" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -450,17 +450,17 @@
- +
{{wizard-mapper inputs=action.bio_raw - property='bio_raw' - onUpdate=(action 'mappedFieldUpdated') + property="bio_raw" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -468,18 +468,18 @@
- +
{{wizard-mapper inputs=action.owner_usernames - property='owner_usernames' - onUpdate=(action 'mappedFieldUpdated') + property="owner_usernames" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - userSelection='output' - context='action' + userSelection="output" + context="action" )}}
@@ -487,18 +487,18 @@
- +
{{wizard-mapper inputs=action.usernames - property='usernames' - onUpdate=(action 'mappedFieldUpdated') + property="usernames" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - userSelection='output' - context='action' + userSelection="output" + context="action" )}}
@@ -506,17 +506,17 @@
- +
{{wizard-mapper inputs=action.grant_trust_level - property='grant_trust_level' - onUpdate=(action 'mappedFieldUpdated') + property="grant_trust_level" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -524,17 +524,17 @@
- +
{{wizard-mapper inputs=action.mentionable_level - property='mentionable_level' - onUpdate=(action 'mappedFieldUpdated') + property="mentionable_level" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -542,17 +542,17 @@
- +
{{wizard-mapper inputs=action.messageable_level - property='messageable_level' - onUpdate=(action 'mappedFieldUpdated') + property="messageable_level" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -560,35 +560,35 @@
- +
{{wizard-mapper inputs=action.visibility_level - property='visibility_level' - onUpdate=(action 'mappedFieldUpdated') + property="visibility_level" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
-
+
- +
{{wizard-mapper inputs=action.members_visibility_level - property='members_visibility_level' - onUpdate=(action 'mappedFieldUpdated') + property="members_visibility_level" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true userFieldSelection=true - context='action' + context="action" )}}
@@ -599,116 +599,116 @@
- +
{{wizard-mapper inputs=action.name - property='name' - onUpdate=(action 'mappedFieldUpdated') + property="name" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='key,value' + textSelection="key,value" wizardFieldSelection=true - userFieldSelection='key,value' - context='action' + userFieldSelection="key,value" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.slug - property='slug' - onUpdate=(action 'mappedFieldUpdated') + property="slug" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true - userFieldSelection='key,value' - context='action' + userFieldSelection="key,value" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.color - property='color' - onUpdate=(action 'mappedFieldUpdated') + property="color" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true - userFieldSelection='key,value' - context='action' + userFieldSelection="key,value" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.text_color - property='text_color' - onUpdate=(action 'mappedFieldUpdated') + property="text_color" + onUpdate=(action "mappedFieldUpdated") options=(hash textSelection=true wizardFieldSelection=true - userFieldSelection='key,value' - context='action' + userFieldSelection="key,value" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.parent_category_id - property='parent_category_id' - onUpdate=(action 'mappedFieldUpdated') + property="parent_category_id" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='key,value' + textSelection="key,value" wizardFieldSelection=true - userFieldSelection='key,value' - categorySelection='output' - context='action' + userFieldSelection="key,value" + categorySelection="output" + context="action" )}}
- +
- +
{{wizard-mapper inputs=action.permissions - property='permissions' - onUpdate=(action 'mappedFieldUpdated') + property="permissions" + onUpdate=(action "mappedFieldUpdated") options=(hash - inputTypes='association' + inputTypes="association" textSelection=true wizardFieldSelection=true - wizardActionSelection='key' + wizardActionSelection="key" userFieldSelection=true - groupSelection='key' - context='action' + groupSelection="key" + context="action" )}}
@@ -719,89 +719,89 @@ {{#if action.showAdvanced}}
- + {{#if hasCustomFields}}
- +
- +
{{wizard-mapper inputs=action.custom_fields - property='custom_fields' - onUpdate=(action 'mappedFieldUpdated') + property="custom_fields" + onUpdate=(action "mappedFieldUpdated") options=(hash - inputTypes='association' - customFieldSelection='key' - wizardFieldSelection='value' - wizardActionSelection='value' - userFieldSelection='value' - keyPlaceholder='admin.wizard.action.custom_fields.key' - context='action' + inputTypes="association" + customFieldSelection="key" + wizardFieldSelection="value" + wizardActionSelection="value" + userFieldSelection="value" + keyPlaceholder="admin.wizard.action.custom_fields.key" + context="action" )}}
{{/if}} - + {{#if sendMessage}}
- +
- +
{{wizard-mapper inputs=action.required - property='required' - onUpdate=(action 'mappedFieldUpdated') + property="required" + onUpdate=(action "mappedFieldUpdated") options=(hash - textSelection='value' + textSelection="value" wizardFieldSelection=true userFieldSelection=true groupSelection=true - context='action' + context="action" )}}
{{/if}} - + {{#if showPostAdvanced}}
- +
- {{input type='checkbox' checked=action.skip_redirect}} - + {{input type="checkbox" checked=action.skip_redirect}} + - {{i18n 'admin.wizard.action.skip_redirect.description' type='topic'}} + {{i18n "admin.wizard.action.skip_redirect.description" type="topic"}}
- +
- +
- {{input type='checkbox' checked=action.suppress_notifications}} - + {{input type="checkbox" checked=action.suppress_notifications}} + - {{i18n 'admin.wizard.action.suppress_notifications.description' type='topic'}} + {{i18n "admin.wizard.action.suppress_notifications.description" type="topic"}}
{{/if}} - + {{#if routeTo}}
- +
{{input value=action.code}}
diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs index 6b8a11fc..2677c9dd 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-field.hbs @@ -1,243 +1,267 @@ -{{#if showUndo}} - {{d-button - action="undoChanges" - icon=undoIcon - label=undoKey - class="undo-changes"}} -{{/if}} - -
-
- -
-
- {{input name="label" value=field.label}} -
-
- -
-
- -
- -
- {{i18n 'admin.wizard.field.required_label'}} - {{input type='checkbox' checked=field.required}} -
-
- -
-
- -
-
- {{textarea name="description" value=field.description}} -
-
- -
-
- -
-
- {{image-uploader - imageUrl=field.image - onUploadDone=(action "imageUploadDone") - onUploadDeleted=(action "imageUploadDeleted") - type="wizard-step" - class="no-repeat contain-image"}} -
-
- -
-
- -
- -
- {{combo-box - value=field.type - content=fieldTypes - onChange=(action "changeType") - options=(hash - none="admin.wizard.select_type" - )}} -
-
- -{{wizard-message - key=messageKey - url=messageUrl - component='field'}} - -{{#if isTextType}} -
-
- -
- -
- {{input - type="number" - name="min_length" - value=field.min_length - class="small"}} -
-
- -
-
- -
- -
- {{input - type="number" - name="max_length" - value=field.max_length - class="small"}} -
-
- - {{!-- - /* learning_step - * unit: custom_wizard:templates_and_builder - * type: step - * number: 1 - * title: Add the attribute to the template - * description: First, add a new setting block to allow the site admin to - * administer how the attribute will work. Here we can see the - * controls for the Character Counter field attribute. Note - * the attribute is only available for text type fields (see - * isTextType conditional above this block). Note the - * consistent use of the ``setting``, ``setting-label`` and - * ``setting-value`` HTML structure throughout this component, - * and other Custom Wizard admin components. - */ - --}} -
-
- -
- -
- {{i18n 'admin.wizard.field.char_counter_placeholder'}} - {{input - type="checkbox" - checked=field.char_counter}} -
-
-{{/if}} - -{{#if isUpload}} -
-
- -
- -
- {{input value=field.file_types class="medium"}} -
-
-{{/if}} - -{{#if showLimit}} -
-
- -
- -
- {{input type="number" value=field.limit class="small"}} -
-
-{{/if}} - -{{#if isDateTime}} -
-
- -
- -
- {{input value=field.format class="medium"}} - -
-
-{{/if}} - -{{#if showPrefill}} -
-
- -
- -
- {{wizard-mapper - inputs=field.prefill - property='prefill' - onUpdate=(action 'mappedFieldUpdated') - options=prefillOptions}} -
-
-{{/if}} - -{{#if showContent}} -
-
- -
- -
- {{wizard-mapper - inputs=field.content - property='content' - onUpdate=(action 'mappedFieldUpdated') - options=contentOptions}} -
-
-{{/if}} - -{{#if showAdvanced}} - {{wizard-advanced-toggle showAdvanced=field.showAdvanced}} - - {{#if field.showAdvanced}} -
- - {{#if isCategory}} -
-
- -
- -
- {{combo-box - value=field.property - content=categoryPropertyTypes - onChange=(action (mut field.property)) - options=(hash - none='admin.wizard.selector.placeholder.property' - )}} -
-
- {{/if}} - -
-
- -
-
- {{input - name="key" - value=field.key - class="medium" - placeholderKey="admin.wizard.translation_placeholder"}} -
-
- - {{#if validations}} - {{wizard-realtime-validations field=field validations=validations}} - {{/if}} -
- {{/if}} -{{/if}} +{{#if showUndo}} + {{d-button + action="undoChanges" + icon=undoIcon + label=undoKey + class="undo-changes"}} +{{/if}} + +
+
+ +
+
+ {{input name="label" value=field.label}} +
+
+ +
+
+ +
+ +
+ {{i18n "admin.wizard.field.required_label"}} + {{input type="checkbox" checked=field.required}} +
+
+ +
+
+ +
+
+ {{textarea name="description" value=field.description}} +
+
+ +
+
+ +
+
+ {{image-uploader + imageUrl=field.image + onUploadDone=(action "imageUploadDone") + onUploadDeleted=(action "imageUploadDeleted") + type="wizard-step" + class="no-repeat contain-image"}} +
+
+ +
+
+ +
+ +
+ {{combo-box + value=field.type + content=fieldTypes + onChange=(action "changeType") + options=(hash + none="admin.wizard.select_type" + )}} +
+
+ +{{wizard-message + key=messageKey + url=messageUrl + component="field"}} + +{{#if isTextType}} +
+
+ +
+ +
+ {{input + type="number" + name="min_length" + value=field.min_length + class="small"}} +
+
+ +
+
+ +
+ +
+ {{input + type="number" + name="max_length" + value=field.max_length + class="small"}} +
+
+ + {{!-- + /* learning_step + * unit: custom_wizard:templates_and_builder + * type: step + * number: 1 + * title: Add the attribute to the template + * description: First, add a new setting block to allow the site admin to + * administer how the attribute will work. Here we can see the + * controls for the Character Counter field attribute. Note + * the attribute is only available for text type fields (see + * isTextType conditional above this block). Note the + * consistent use of the ``setting``, ``setting-label`` and + * ``setting-value`` HTML structure throughout this component, + * and other Custom Wizard admin components. + */ + --}} +
+
+ +
+ +
+ {{i18n "admin.wizard.field.char_counter_placeholder"}} + {{input + type="checkbox" + checked=field.char_counter}} +
+
+{{/if}} + +{{#if isUpload}} +
+
+ +
+ +
+ {{input value=field.file_types class="medium"}} +
+
+{{/if}} + +{{#if showLimit}} +
+
+ +
+ +
+ {{input type="number" value=field.limit class="small"}} +
+
+{{/if}} + +{{#if isDateTime}} +
+
+ +
+ +
+ {{input value=field.format class="medium"}} + +
+
+{{/if}} + +{{#if showPrefill}} +
+
+ +
+ +
+ {{wizard-mapper + inputs=field.prefill + property="prefill" + onUpdate=(action "mappedFieldUpdated") + options=prefillOptions}} +
+
+{{/if}} + +{{#if showContent}} +
+
+ +
+ +
+ {{wizard-mapper + inputs=field.content + property="content" + onUpdate=(action "mappedFieldUpdated") + options=contentOptions}} +
+
+{{/if}} + +{{#if showAdvanced}} + {{wizard-advanced-toggle showAdvanced=field.showAdvanced}} + + {{#if field.showAdvanced}} +
+ +
+
+ +
+ +
+ {{wizard-mapper + inputs=field.condition + options=fieldConditionOptions}} +
+
+ +
+
+ +
+ +
+ {{wizard-mapper + inputs=field.index + options=fieldIndexOptions}} +
+
+ + {{#if isCategory}} +
+
+ +
+ +
+ {{combo-box + value=field.property + content=categoryPropertyTypes + onChange=(action (mut field.property)) + options=(hash + none="admin.wizard.selector.placeholder.property" + )}} +
+
+ {{/if}} + +
+
+ +
+
+ {{input + name="key" + value=field.key + class="medium" + placeholderKey="admin.wizard.translation_placeholder"}} +
+
+ + {{#if validations}} + {{wizard-realtime-validations field=field validations=validations}} + {{/if}} +
+ {{/if}} +{{/if}} diff --git a/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs b/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs index 147b9a21..85adfe8a 100644 --- a/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-custom-step.hbs @@ -1,112 +1,133 @@ -
-
- -
-
- {{input - name="title" - value=step.title}} -
-
- -
-
- -
-
- {{image-uploader - imageUrl=step.banner - onUploadDone=(action "bannerUploadDone") - onUploadDeleted=(action "bannerUploadDeleted") - type="wizard-banner" - class="no-repeat contain-image"}} -
-
- -
-
- -
-
- {{wizard-text-editor - value=step.raw_description}} -
-
- -{{wizard-advanced-toggle showAdvanced=step.showAdvanced}} - -{{#if step.showAdvanced}} -
- -
-
- -
-
- {{wizard-mapper - inputs=step.required_data - options=(hash - inputTypes='validation' - inputConnector='and' - wizardFieldSelection='value' - userFieldSelection='value' - keyPlaceholder="admin.wizard.submission_key" - context='step' - )}} - {{#if step.required_data}} -
-
- {{i18n 'admin.wizard.step.required_data.not_permitted_message'}} -
- {{input value=step.required_data_message}} -
- {{/if}} -
-
- -
-
- -
-
- {{wizard-mapper - inputs=step.permitted_params - options=(hash - pairConnector='set' - inputTypes='association' - keyPlaceholder='admin.wizard.param_key' - valuePlaceholder='admin.wizard.submission_key' - context='step' - )}} -
-
- -
-
- -
-
- {{input - name="key" - value=step.key - placeholderKey="admin.wizard.translation_placeholder"}} -
-
- -
-{{/if}} - -{{wizard-links - itemType="field" - current=currentField - items=step.fields - parentId=step.id}} - -{{#each step.fields as |field|}} - {{wizard-custom-field - field=field - currentFieldId=currentField.id - fieldTypes=fieldTypes - removeField="removeField" - wizardFields=wizardFields}} -{{/each}} \ No newline at end of file +
+
+ +
+
+ {{input + name="title" + value=step.title}} +
+
+ +
+
+ +
+
+ {{image-uploader + imageUrl=step.banner + onUploadDone=(action "bannerUploadDone") + onUploadDeleted=(action "bannerUploadDeleted") + type="wizard-banner" + class="no-repeat contain-image"}} +
+
+ +
+
+ +
+
+ {{wizard-text-editor + value=step.raw_description}} +
+
+ +{{wizard-advanced-toggle showAdvanced=step.showAdvanced}} + +{{#if step.showAdvanced}} +
+ +
+
+ +
+ +
+ {{wizard-mapper + inputs=step.condition + options=stepConditionOptions}} +
+
+ +
+
+
+

{{i18n "admin.wizard.step.force_final.label"}}

+ {{input type="checkbox" checked=step.force_final}} + {{i18n "admin.wizard.step.force_final.description"}} +
+
+ +
+
+ +
+
+ {{wizard-mapper + inputs=step.required_data + options=(hash + inputTypes="validation" + inputConnector="and" + wizardFieldSelection="value" + userFieldSelection="value" + keyPlaceholder="admin.wizard.submission_key" + context="step" + )}} + {{#if step.required_data}} +
+
+ {{i18n "admin.wizard.step.required_data.not_permitted_message"}} +
+ {{input value=step.required_data_message}} +
+ {{/if}} +
+
+ +
+
+ +
+
+ {{wizard-mapper + inputs=step.permitted_params + options=(hash + pairConnector="set" + inputTypes="association" + keyPlaceholder="admin.wizard.param_key" + valuePlaceholder="admin.wizard.submission_key" + context="step" + )}} +
+
+ +
+
+ +
+
+ {{input + name="key" + value=step.key + placeholderKey="admin.wizard.translation_placeholder"}} +
+
+
+{{/if}} + +{{wizard-links + itemType="field" + current=currentField + items=step.fields + parentId=step.id}} + +{{#each step.fields as |field|}} + {{wizard-custom-field + field=field + step=step + currentFieldId=currentField.id + fieldTypes=fieldTypes + removeField="removeField" + wizardFields=wizardFields}} +{{/each}} diff --git a/assets/javascripts/discourse/templates/components/wizard-links.hbs b/assets/javascripts/discourse/templates/components/wizard-links.hbs index b24b5083..5271b043 100644 --- a/assets/javascripts/discourse/templates/components/wizard-links.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-links.hbs @@ -1,14 +1,14 @@ -
{{{i18n header}}}
+
{{html-safe (i18n header)}}
@@ -40,7 +40,7 @@
{{wizard-mapper-selector - selectorType='output' + selectorType="output" inputType=input.type value=input.output activeType=input.output_type @@ -49,6 +49,6 @@
{{/if}} - - {{d-icon 'times'}} + + {{d-icon "times"}} diff --git a/assets/javascripts/discourse/templates/components/wizard-mapper-pair.hbs b/assets/javascripts/discourse/templates/components/wizard-mapper-pair.hbs index 6c0b4aa6..ffb9eaf2 100644 --- a/assets/javascripts/discourse/templates/components/wizard-mapper-pair.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-mapper-pair.hbs @@ -1,6 +1,6 @@
{{wizard-mapper-selector - selectorType='key' + selectorType="key" inputType=inputType value=pair.key activeType=pair.key_type @@ -18,7 +18,7 @@
{{wizard-mapper-selector - selectorType='value' + selectorType="value" inputType=inputType value=pair.value activeType=pair.value_type @@ -31,5 +31,5 @@ {{/if}} {{#if showRemove}} - {{d-icon 'times'}} -{{/if}} \ No newline at end of file + {{d-icon "times"}} +{{/if}} diff --git a/assets/javascripts/discourse/templates/components/wizard-mapper-selector-type.hbs b/assets/javascripts/discourse/templates/components/wizard-mapper-selector-type.hbs index 2ef7f2a3..32c4c26e 100644 --- a/assets/javascripts/discourse/templates/components/wizard-mapper-selector-type.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-mapper-selector-type.hbs @@ -1 +1 @@ -{{item.label}} \ No newline at end of file +{{item.label}} diff --git a/assets/javascripts/discourse/templates/components/wizard-mapper-selector.hbs b/assets/javascripts/discourse/templates/components/wizard-mapper-selector.hbs index c86d2a7d..94870416 100644 --- a/assets/javascripts/discourse/templates/components/wizard-mapper-selector.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-mapper-selector.hbs @@ -1,16 +1,16 @@
{{#if hasTypes}} - + {{activeTypeLabel}} - + {{#if showTypes}}
{{#each selectorTypes as |item|}} {{wizard-mapper-selector-type activeType=activeType item=item - toggle=(action 'toggleType')}} + toggle=(action "toggleType")}} {{/each}}
{{/if}} @@ -38,7 +38,7 @@ allowAny=comboBoxAllowAny )}} {{/if}} - + {{#if showMultiSelect}} {{multi-select content=multiSelectContent @@ -46,14 +46,14 @@ onChange=(action "changeValue") options=multiSelectOptions}} {{/if}} - + {{#if showList}} {{wizard-value-list values=value addKey=placeholderKey onChange=(action "changeValue")}} {{/if}} - + {{#if showTag}} {{tag-chooser tags=value @@ -63,13 +63,13 @@ filterable=true )}} {{/if}} - + {{#if showUser}} - {{user-selector - includeMessageableGroups='true' + {{user-selector + includeMessageableGroups="true" placeholderKey=placeholderKey usernames=value autocomplete="discourse" onChangeCallback=(action "changeUserValue")}} {{/if}} -
\ No newline at end of file +
diff --git a/assets/javascripts/discourse/templates/components/wizard-mapper.hbs b/assets/javascripts/discourse/templates/components/wizard-mapper.hbs index 25ee9512..2de35e0d 100644 --- a/assets/javascripts/discourse/templates/components/wizard-mapper.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-mapper.hbs @@ -3,18 +3,18 @@ {{wizard-mapper-connector connector=input.connector connectorType="input" - onUpdate=(action 'inputUpdated')}} + onUpdate=(action "inputUpdated")}} {{/if}} - - {{wizard-mapper-input + + {{wizard-mapper-input input=input options=inputOptions - remove=(action 'remove') - onUpdate=(action 'inputUpdated')}} + remove=(action "remove") + onUpdate=(action "inputUpdated")}} {{/each}} {{#if canAdd}} - {{d-button action='add' label='admin.wizard.add' icon='plus'}} + {{d-button action="add" label="admin.wizard.add" icon="plus"}} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/assets/javascripts/discourse/templates/components/wizard-message.hbs b/assets/javascripts/discourse/templates/components/wizard-message.hbs index 78c7558b..380fc5b3 100644 --- a/assets/javascripts/discourse/templates/components/wizard-message.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-message.hbs @@ -2,13 +2,13 @@ {{#if showIcon}} {{d-icon icon}} {{/if}} - {{{message}}} + {{html-safe message}} {{#if hasItems}}
    {{#each items as |item|}}
  • {{d-icon item.icon}} - {{{item.html}}} + {{html-safe item.html}}
  • {{/each}}
@@ -17,10 +17,10 @@ {{#if showDocumentation}} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/assets/javascripts/discourse/templates/components/wizard-realtime-validations.hbs b/assets/javascripts/discourse/templates/components/wizard-realtime-validations.hbs index 39734761..cd1298a9 100644 --- a/assets/javascripts/discourse/templates/components/wizard-realtime-validations.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-realtime-validations.hbs @@ -1,28 +1,28 @@ -

{{i18n 'admin.wizard.field.validations.header'}}

+

{{i18n "admin.wizard.field.validations.header"}}

    {{#each-in field.validations as |type props|}}
  • -

    {{i18n (concat 'admin.wizard.field.validations.' type)}}

    +

    {{i18n (concat "admin.wizard.field.validations." type)}}

    {{input type="checkbox" checked=props.status}} - {{i18n 'admin.wizard.field.validations.enabled'}} + {{i18n "admin.wizard.field.validations.enabled"}}
    - +
    {{category-selector - categories=(get this (concat 'validationBuffer.' type '.categories')) - onChange=(action 'updateValidationCategories' type props) + categories=(get this (concat "validationBuffer." type ".categories")) + onChange=(action "updateValidationCategories" type props) class="wizard"}}
    - +
    {{input type="number" class="time-n-value" value=props.time_n_value}} @@ -35,13 +35,13 @@
    - +
    {{radio-button name=(concat type field.id) value="above" selection=props.position}} - {{i18n 'admin.wizard.field.validations.above'}} + {{i18n "admin.wizard.field.validations.above"}} {{radio-button name=(concat type field.id) value="below" selection=props.position}} - {{i18n 'admin.wizard.field.validations.below'}} + {{i18n "admin.wizard.field.validations.below"}}
    diff --git a/assets/javascripts/discourse/templates/components/wizard-text-editor.hbs b/assets/javascripts/discourse/templates/components/wizard-text-editor.hbs index 36be715f..c657049d 100644 --- a/assets/javascripts/discourse/templates/components/wizard-text-editor.hbs +++ b/assets/javascripts/discourse/templates/components/wizard-text-editor.hbs @@ -9,33 +9,33 @@ action="togglePreview" translatedLabel=previewLabel}} {{/if}} - + {{#if fieldsEnabled}} {{d-button action="togglePopover" translatedLabel=popoverLabel}} - + {{#if showPopover}}
    - + {{#if hasWizardFields}} {{/if}} - + {{#if hasWizardActions}} {{/if}}
    {{/if}} {{/if}} -
    \ No newline at end of file +
diff --git a/assets/javascripts/wizard-custom-globals.js b/assets/javascripts/wizard-custom-globals.js index e37648e5..83923cba 100644 --- a/assets/javascripts/wizard-custom-globals.js +++ b/assets/javascripts/wizard-custom-globals.js @@ -1,5 +1,6 @@ -window.Discourse = {} +/* eslint no-undef: 0*/ +window.Discourse = {}; window.Wizard = {}; Wizard.SiteSettings = {}; Discourse.__widget_helpers = {}; -Discourse.SiteSettings = Wizard.SiteSettings; \ No newline at end of file +Discourse.SiteSettings = Wizard.SiteSettings; diff --git a/assets/javascripts/wizard-custom-guest.js b/assets/javascripts/wizard-custom-guest.js index dc2f6430..4493cf01 100644 --- a/assets/javascripts/wizard-custom-guest.js +++ b/assets/javascripts/wizard-custom-guest.js @@ -1,4 +1,4 @@ (function () { - document.cookie = 'destination_url=' + window.location.href + ';path=/'; - window.location.href = '/login' -})() + document.cookie = "destination_url=" + window.location.href + ";path=/"; + window.location.href = "/login"; +})(); diff --git a/assets/javascripts/wizard-custom-start.js b/assets/javascripts/wizard-custom-start.js index 99937b5f..3ffa9c5a 100644 --- a/assets/javascripts/wizard-custom-start.js +++ b/assets/javascripts/wizard-custom-start.js @@ -1,4 +1,4 @@ -(function() { - var wizard = require('discourse/plugins/discourse-custom-wizard/wizard/custom-wizard').default.create(); +(function () { + let wizard = require("discourse/plugins/discourse-custom-wizard/wizard/custom-wizard").default.create(); wizard.start(); })(); diff --git a/assets/javascripts/wizard/components/custom-user-selector.js.es6 b/assets/javascripts/wizard/components/custom-user-selector.js.es6 index ee88645c..b2f08ede 100644 --- a/assets/javascripts/wizard/components/custom-user-selector.js.es6 +++ b/assets/javascripts/wizard/components/custom-user-selector.js.es6 @@ -5,6 +5,8 @@ import { import { renderAvatar } from "discourse/helpers/user-avatar"; import userSearch from "../lib/user-search"; import WizardI18n from "../lib/wizard-i18n"; +import Handlebars from "handlebars"; +import { isEmpty } from "@ember/utils"; const template = function (params) { const options = params.options; @@ -43,13 +45,14 @@ export default Ember.TextField.extend({ @observes("usernames") _update() { - if (this.get("canReceiveUpdates") === "true") + if (this.get("canReceiveUpdates") === "true") { this.didInsertElement({ updateData: true }); + } }, didInsertElement(opts) { this._super(); - var self = this, + let self = this, selected = [], groups = [], currentUser = this.currentUser, @@ -82,7 +85,7 @@ export default Ember.TextField.extend({ dataSource(term) { const termRegex = /[^a-zA-Z0-9_\-\.@\+]/; - var results = userSearch({ + let results = userSearch({ term: term.replace(termRegex, ""), topicId: self.get("topicId"), exclude: excludedUsernames(), @@ -102,7 +105,7 @@ export default Ember.TextField.extend({ } return v.username || v.name; } else { - var excludes = excludedUsernames(); + let excludes = excludedUsernames(); return v.usernames.filter(function (item) { return excludes.indexOf(item) === -1; }); @@ -110,7 +113,7 @@ export default Ember.TextField.extend({ }, onChangeItems(items) { - var hasGroups = false; + let hasGroups = false; items = items.map(function (i) { if (groups.indexOf(i) > -1) { hasGroups = true; @@ -121,7 +124,9 @@ export default Ember.TextField.extend({ self.set("hasGroups", hasGroups); selected = items; - if (self.get("onChangeCallback")) self.sendAction("onChangeCallback"); + if (self.get("onChangeCallback")) { + self.sendAction("onChangeCallback"); + } }, reverseTransform(i) { @@ -139,7 +144,7 @@ export default Ember.TextField.extend({ @observes("usernames") _clearInput: function () { if (arguments.length > 1) { - if (Em.isEmpty(this.get("usernames"))) { + if (isEmpty(this.get("usernames"))) { $(this.element).parent().find("a").click(); } } diff --git a/assets/javascripts/wizard/components/field-validators.js.es6 b/assets/javascripts/wizard/components/field-validators.js.es6 index 85811076..a315020d 100644 --- a/assets/javascripts/wizard/components/field-validators.js.es6 +++ b/assets/javascripts/wizard/components/field-validators.js.es6 @@ -1,5 +1,4 @@ import Component from "@ember/component"; -import { observes } from "discourse-common/utils/decorators"; export default Component.extend({ actions: { perform() { diff --git a/assets/javascripts/wizard/components/similar-topics-validator.js.es6 b/assets/javascripts/wizard/components/similar-topics-validator.js.es6 index 2aef7678..98ea9270 100644 --- a/assets/javascripts/wizard/components/similar-topics-validator.js.es6 +++ b/assets/javascripts/wizard/components/similar-topics-validator.js.es6 @@ -1,11 +1,10 @@ import WizardFieldValidator from "../../wizard/components/validator"; import { deepMerge } from "discourse-common/lib/object"; -import { observes } from "discourse-common/utils/decorators"; +import discourseComputed, { observes } from "discourse-common/utils/decorators"; import { cancel, later } from "@ember/runloop"; import { A } from "@ember/array"; import EmberObject, { computed } from "@ember/object"; -import { notEmpty, and, equal, empty } from "@ember/object/computed"; -import discourseComputed from "discourse-common/utils/decorators"; +import { and, equal, notEmpty } from "@ember/object/computed"; import { categoryBadgeHTML } from "discourse/helpers/category-link"; import { dasherize } from "@ember/string"; @@ -16,7 +15,7 @@ export default WizardFieldValidator.extend({ hasSimilarTopics: notEmpty("similarTopics"), hasNotSearched: equal("similarTopics", null), noSimilarTopics: computed("similarTopics", function () { - return this.similarTopics !== null && this.similarTopics.length == 0; + return this.similarTopics !== null && this.similarTopics.length === 0; }), showSimilarTopics: computed("typing", "hasSimilarTopics", function () { return this.hasSimilarTopics && !this.typing; @@ -35,8 +34,9 @@ export default WizardFieldValidator.extend({ @discourseComputed("validation.categories") validationCategories(categoryIds) { - if (categoryIds) + if (categoryIds) { return categoryIds.map((id) => this.site.categoriesById[id]); + } return A(); }, @@ -78,15 +78,18 @@ export default WizardFieldValidator.extend({ @discourseComputed("currentState") currentStateClass(currentState) { - if (currentState) return `similar-topics-${dasherize(currentState)}`; + if (currentState) { + return `similar-topics-${dasherize(currentState)}`; + } return "similar-topics"; }, @discourseComputed("currentState") currentStateKey(currentState) { - if (currentState) + if (currentState) { return `realtime_validations.similar_topics.${currentState}`; + } return false; }, @@ -127,6 +130,7 @@ export default WizardFieldValidator.extend({ }, updateSimilarTopics() { + this.set("similarTopics", null); this.set("updating", true); this.backendValidate({ diff --git a/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 b/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 index 5e7fc5fe..2a92f12a 100644 --- a/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 +++ b/assets/javascripts/wizard/components/wizard-composer-editor.js.es6 @@ -4,22 +4,18 @@ import { on, } from "discourse-common/utils/decorators"; import { findRawTemplate } from "discourse-common/lib/raw-templates"; -import { throttle } from "@ember/runloop"; -import { scheduleOnce, next } from "@ember/runloop"; -import { - safariHacksDisabled, - caretPosition, - inCodeBlock, -} from "discourse/lib/utilities"; +import { next, scheduleOnce, throttle } from "@ember/runloop"; +import { caretPosition, inCodeBlock } from "discourse/lib/utilities"; import highlightSyntax from "discourse/lib/highlight-syntax"; import { getToken } from "wizard/lib/ajax"; import { - validateUploadedFiles, + displayErrorForUpload, getUploadMarkdown, + uploadIcon, + validateUploadedFiles, } from "discourse/lib/uploads"; import { cacheShortUploadUrl } from "pretty-text/upload-short-url"; import { alias } from "@ember/object/computed"; -import { uploadIcon } from "discourse/lib/uploads"; import WizardI18n from "../lib/wizard-i18n"; const uploadMarkdownResolvers = []; @@ -78,8 +74,8 @@ export default ComposerEditor.extend({ .join(","); }, - @discourseComputed("currentUser") - uploadIcon(currentUser) { + @discourseComputed() + uploadIcon() { return uploadIcon(false, this.siteSettings); }, @@ -295,7 +291,7 @@ export default ComposerEditor.extend({ shortcut: "K", trimLeading: true, unshift: true, - sendAction: (event) => component.set("showHyperlinkBox", true), + sendAction: () => component.set("showHyperlinkBox", true), }); }, diff --git a/assets/javascripts/wizard/components/wizard-field-category.js.es6 b/assets/javascripts/wizard/components/wizard-field-category.js.es6 index 913742d5..a7452214 100644 --- a/assets/javascripts/wizard/components/wizard-field-category.js.es6 +++ b/assets/javascripts/wizard/components/wizard-field-category.js.es6 @@ -12,7 +12,9 @@ export default Ember.Component.extend({ [...value].reduce((result, v) => { let val = property === "id" ? Category.findById(v) : Category.findBySlug(v); - if (val) result.push(val); + if (val) { + result.push(val); + } return result; }, []) ); diff --git a/assets/javascripts/wizard/components/wizard-no-access.js.es6 b/assets/javascripts/wizard/components/wizard-no-access.js.es6 index c0edb58a..57fe9111 100644 --- a/assets/javascripts/wizard/components/wizard-no-access.js.es6 +++ b/assets/javascripts/wizard/components/wizard-no-access.js.es6 @@ -2,6 +2,7 @@ import CustomWizard from "../models/custom"; export default Ember.Component.extend({ siteName: function () { + /*eslint no-undef:0*/ return Wizard.SiteSettings.title; }.property(), diff --git a/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 b/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 index 74b1e358..687cfa86 100644 --- a/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 +++ b/assets/javascripts/wizard/components/wizard-similar-topics.js.es6 @@ -15,7 +15,9 @@ export default Component.extend({ }, documentClick(e) { - if (this._state == "destroying") return; + if (this._state === "destroying") { + return; + } let $target = $(e.target); if (!$target.hasClass("show-topics")) { diff --git a/assets/javascripts/wizard/components/wizard-text-field.js.es6 b/assets/javascripts/wizard/components/wizard-text-field.js.es6 index 187deea9..c522eb2c 100644 --- a/assets/javascripts/wizard/components/wizard-text-field.js.es6 +++ b/assets/javascripts/wizard/components/wizard-text-field.js.es6 @@ -1,7 +1,7 @@ -/* eslint no-undef: 0 */ +/* eslint no-undef: 0*/ import computed from "discourse-common/utils/decorators"; -import { siteDir, isRTL, isLTR } from "discourse/lib/text-direction"; +import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction"; import WizardI18n from "../lib/wizard-i18n"; export default Ember.TextField.extend({ diff --git a/assets/javascripts/wizard/controllers/custom-step.js.es6 b/assets/javascripts/wizard/controllers/custom-step.js.es6 index bf415bc9..b44c0fca 100644 --- a/assets/javascripts/wizard/controllers/custom-step.js.es6 +++ b/assets/javascripts/wizard/controllers/custom-step.js.es6 @@ -4,14 +4,15 @@ import getUrl from "discourse-common/lib/get-url"; export default StepController.extend({ actions: { goNext(response) { - const next = this.get("step.next"); + let nextStepId = response["next_step_id"]; + if (response.redirect_on_next) { window.location.href = response.redirect_on_next; } else if (response.refresh_required) { - const id = this.get("wizard.id"); - window.location.href = getUrl(`/w/${id}/steps/${next}`); + const wizardId = this.get("wizard.id"); + window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`); } else { - this.transitionToRoute("custom.step", next); + this.transitionToRoute("custom.step", nextStepId); } }, diff --git a/assets/javascripts/wizard/helpers/char-counter.js.es6 b/assets/javascripts/wizard/helpers/char-counter.js.es6 index b666d0bf..a700a432 100644 --- a/assets/javascripts/wizard/helpers/char-counter.js.es6 +++ b/assets/javascripts/wizard/helpers/char-counter.js.es6 @@ -1,5 +1,6 @@ import { registerUnbound } from "discourse-common/lib/helpers"; import I18n from "I18n"; +import Handlebars from "handlebars"; export default registerUnbound("char-counter", function (body, maxLength) { let bodyLength = body ? body.length : 0; @@ -9,11 +10,11 @@ export default registerUnbound("char-counter", function (body, maxLength) { let isOverMax = bodyLength > maxLength ? "true" : "false"; finalString = `
${bodyLength} / ${I18n.t( "wizard.x_characters", - { count: parseInt(maxLength) } + { count: parseInt(maxLength, 10) } )}
`; } else { finalString = `
${I18n.t("wizard.x_characters", { - count: parseInt(bodyLength), + count: parseInt(bodyLength, 10), })}
`; } diff --git a/assets/javascripts/wizard/helpers/date-node.js.es6 b/assets/javascripts/wizard/helpers/date-node.js.es6 index 99fa01f3..b7d19d0f 100644 --- a/assets/javascripts/wizard/helpers/date-node.js.es6 +++ b/assets/javascripts/wizard/helpers/date-node.js.es6 @@ -1,5 +1,6 @@ import { registerUnbound } from "discourse-common/lib/helpers"; -import { longDate, number, relativeAge } from "discourse/lib/formatter"; +import { longDate, relativeAge } from "discourse/lib/formatter"; +import Handlebars from "handlebars"; export default registerUnbound("date-node", function (dt) { if (typeof dt === "string") { diff --git a/assets/javascripts/wizard/helpers/dir-span.js.es6 b/assets/javascripts/wizard/helpers/dir-span.js.es6 index a750720a..45720796 100644 --- a/assets/javascripts/wizard/helpers/dir-span.js.es6 +++ b/assets/javascripts/wizard/helpers/dir-span.js.es6 @@ -1,4 +1,5 @@ import { registerUnbound } from "discourse-common/lib/helpers"; +import Handlebars from "handlebars"; export default registerUnbound("dir-span", function (str) { return new Handlebars.SafeString(str); diff --git a/assets/javascripts/wizard/helpers/loading-spinner.es6 b/assets/javascripts/wizard/helpers/loading-spinner.es6 index fda8fe6b..5f15403d 100644 --- a/assets/javascripts/wizard/helpers/loading-spinner.es6 +++ b/assets/javascripts/wizard/helpers/loading-spinner.es6 @@ -1,15 +1,17 @@ -import { htmlHelper } from 'discourse-common/lib/helpers'; +import { htmlHelper } from "discourse-common/lib/helpers"; function renderSpinner(cssClass) { var html = "
"; } var spinnerHTML = renderSpinner(); -export default htmlHelper(params => { +export default htmlHelper((params) => { const hash = params.hash; - return renderSpinner((hash && hash.size) ? hash.size : undefined); + return renderSpinner(hash && hash.size ? hash.size : undefined); }); export { spinnerHTML, renderSpinner }; diff --git a/assets/javascripts/wizard/helpers/plugin-outlet.js.es6 b/assets/javascripts/wizard/helpers/plugin-outlet.js.es6 index adbbd777..e6ff81a6 100644 --- a/assets/javascripts/wizard/helpers/plugin-outlet.js.es6 +++ b/assets/javascripts/wizard/helpers/plugin-outlet.js.es6 @@ -1,5 +1,6 @@ import { registerUnbound } from "discourse-common/lib/helpers"; +import Handlebars from "handlebars"; -export default registerUnbound("plugin-outlet", function (attrs) { +export default registerUnbound("plugin-outlet", function () { return new Handlebars.SafeString(""); }); diff --git a/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 b/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 index 2e37c9ea..af647022 100644 --- a/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 +++ b/assets/javascripts/wizard/initializers/custom-wizard-field.js.es6 @@ -3,8 +3,10 @@ import discourseComputed from "discourse-common/utils/decorators"; export default { name: "custom-wizard-field", - initialize(app) { - if (window.location.pathname.indexOf("/w/") < 0) return; + initialize() { + if (window.location.pathname.indexOf("/w/") < 0) { + return; + } const FieldComponent = requirejs("wizard/components/wizard-field").default; const FieldModel = requirejs("wizard/models/wizard-field").default; @@ -41,7 +43,9 @@ export default { inputComponentName: function () { const type = this.get("field.type"); const id = this.get("field.id"); - if (["text_only"].includes(type)) return false; + if (["text_only"].includes(type)) { + return false; + } return dasherize(type === "component" ? id : `wizard-field-${type}`); }.property("field.type", "field.id"), }); diff --git a/assets/javascripts/wizard/initializers/custom-wizard-step.js.es6 b/assets/javascripts/wizard/initializers/custom-wizard-step.js.es6 index 58137e7a..fbbe7d8b 100644 --- a/assets/javascripts/wizard/initializers/custom-wizard-step.js.es6 +++ b/assets/javascripts/wizard/initializers/custom-wizard-step.js.es6 @@ -1,11 +1,16 @@ export default { name: "custom-wizard-step", - initialize(app) { - if (window.location.pathname.indexOf("/w/") < 0) return; + initialize() { + if (window.location.pathname.indexOf("/w/") < 0) { + return; + } const CustomWizard = requirejs( "discourse/plugins/discourse-custom-wizard/wizard/models/custom" ).default; + const updateCachedWizard = requirejs( + "discourse/plugins/discourse-custom-wizard/wizard/models/custom" + ).updateCachedWizard; const StepModel = requirejs("wizard/models/step").default; const StepComponent = requirejs("wizard/components/wizard-step").default; const ajax = requirejs("wizard/lib/ajax").ajax; @@ -16,6 +21,7 @@ export default { "discourse/plugins/discourse-custom-wizard/wizard/lib/text-lite" ).cook; const { schedule } = requirejs("@ember/runloop"); + const { alias, not } = requirejs("@ember/object/computed"); StepModel.reopen({ save() { @@ -132,7 +138,9 @@ export default { bannerImage: function () { const src = this.get("step.banner"); - if (!src) return; + if (!src) { + return; + } return getUrl(src); }.property("step.banner"), @@ -151,12 +159,17 @@ export default { this.sendAction("showMessage", message); }.observes("step.message"), + showNextButton: not("step.final"), + showDoneButton: alias("step.final"), + advance() { this.set("saving", true); this.get("step") .save() .then((response) => { - if (this.get("finalStep")) { + updateCachedWizard(CustomWizard.build(response["wizard"])); + + if (response["final"]) { CustomWizard.finished(response); } else { this.sendAction("goNext", response); @@ -166,7 +179,7 @@ export default { .finally(() => this.set("saving", false)); }, - keyPress(key) {}, + keyPress() {}, actions: { quit() { @@ -174,7 +187,6 @@ export default { }, done() { - this.set("finalStep", true); this.send("nextStep"); }, diff --git a/assets/javascripts/wizard/initializers/custom-wizard.js.es6 b/assets/javascripts/wizard/initializers/custom-wizard.js.es6 index 531f9475..ab7c9146 100644 --- a/assets/javascripts/wizard/initializers/custom-wizard.js.es6 +++ b/assets/javascripts/wizard/initializers/custom-wizard.js.es6 @@ -1,14 +1,13 @@ export default { name: "custom-routes", initialize(app) { - if (window.location.pathname.indexOf("/w/") < 0) return; + if (window.location.pathname.indexOf("/w/") < 0) { + return; + } const EmberObject = requirejs("@ember/object").default; const Router = requirejs("wizard/router").default; const ApplicationRoute = requirejs("wizard/routes/application").default; - const CustomWizard = requirejs( - "discourse/plugins/discourse-custom-wizard/wizard/models/custom" - ).default; const getUrl = requirejs("discourse-common/lib/get-url").default; const Store = requirejs("discourse/models/store").default; const registerRawHelpers = requirejs( @@ -18,6 +17,7 @@ export default { .createHelperContext; const RawHandlebars = requirejs("discourse-common/lib/raw-handlebars") .default; + const Handlebars = requirejs("handlebars").default; const Site = requirejs( "discourse/plugins/discourse-custom-wizard/wizard/models/site" ).default; @@ -36,10 +36,12 @@ export default { // IE11 Polyfill - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries#Polyfill if (!Object.entries) { Object.entries = function (obj) { - var ownProps = Object.keys(obj), + let ownProps = Object.keys(obj), i = ownProps.length, resArray = new Array(i); // preallocate the Array - while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]]; + while (i--) { + resArray[i] = [ownProps[i], obj[ownProps[i]]]; + } return resArray; }; @@ -53,7 +55,7 @@ export default { }); const targets = ["controller", "component", "route", "model", "adapter"]; - + /*eslint no-undef: 0*/ const siteSettings = Wizard.SiteSettings; app.register("site-settings:main", siteSettings, { instantiate: false }); createHelperContext({ siteSettings }); diff --git a/assets/javascripts/wizard/lib/jquery.timepicker.min.js b/assets/javascripts/wizard/lib/jquery.timepicker.min.js deleted file mode 100644 index 6a7b5954..00000000 --- a/assets/javascripts/wizard/lib/jquery.timepicker.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * jquery-timepicker v1.11.11 - A jQuery timepicker plugin inspired by Google Calendar. It supports both mouse and keyboard navigation. - * Copyright (c) 2017 Jon Thornton - http://jonthornton.github.com/jquery-timepicker/ - * License: MIT - */ - -!function(a){"object"==typeof exports&&exports&&"object"==typeof module&&module&&module.exports===exports?a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(a){var b=a[0];return b.offsetWidth>0&&b.offsetHeight>0}function c(b){if(b.minTime&&(b.minTime=t(b.minTime)),b.maxTime&&(b.maxTime=t(b.maxTime)),b.durationTime&&"function"!=typeof b.durationTime&&(b.durationTime=t(b.durationTime)),"now"==b.scrollDefault)b.scrollDefault=function(){return b.roundingFunction(t(new Date),b)};else if(b.scrollDefault&&"function"!=typeof b.scrollDefault){var c=b.scrollDefault;b.scrollDefault=function(){return b.roundingFunction(t(c),b)}}else b.minTime&&(b.scrollDefault=function(){return b.roundingFunction(b.minTime,b)});if("string"===a.type(b.timeFormat)&&b.timeFormat.match(/[gh]/)&&(b._twelveHourTime=!0),b.showOnFocus===!1&&-1!=b.showOn.indexOf("focus")&&b.showOn.splice(b.showOn.indexOf("focus"),1),b.disableTimeRanges.length>0){for(var d in b.disableTimeRanges)b.disableTimeRanges[d]=[t(b.disableTimeRanges[d][0]),t(b.disableTimeRanges[d][1])];b.disableTimeRanges=b.disableTimeRanges.sort(function(a,b){return a[0]-b[0]});for(var d=b.disableTimeRanges.length-1;d>0;d--)b.disableTimeRanges[d][0]<=b.disableTimeRanges[d-1][1]&&(b.disableTimeRanges[d-1]=[Math.min(b.disableTimeRanges[d][0],b.disableTimeRanges[d-1][0]),Math.max(b.disableTimeRanges[d][1],b.disableTimeRanges[d-1][1])],b.disableTimeRanges.splice(d,1))}return b}function d(b){var c=b.data("timepicker-settings"),d=b.data("timepicker-list");if(d&&d.length&&(d.remove(),b.data("timepicker-list",!1)),c.useSelect){d=a(" + {{#if field.value}} - {{#unless isImage}} - {{field.value.original_filename}} - {{else}} + {{#if isImage}} - {{/unless}} + {{else}} + {{field.value.original_filename}} + {{/if}} {{/if}} diff --git a/assets/javascripts/wizard/templates/components/wizard-field-url.hbs b/assets/javascripts/wizard/templates/components/wizard-field-url.hbs index f52b87c3..c7e1a508 100644 --- a/assets/javascripts/wizard/templates/components/wizard-field-url.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-field-url.hbs @@ -1 +1 @@ -{{input type='text' id=field.id value=field.value tabindex=field.tabindex}} \ No newline at end of file +{{input type="text" id=field.id value=field.value tabindex=field.tabindex}} diff --git a/assets/javascripts/wizard/templates/components/wizard-field.hbs b/assets/javascripts/wizard/templates/components/wizard-field.hbs index b0563384..e0dd1551 100644 --- a/assets/javascripts/wizard/templates/components/wizard-field.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-field.hbs @@ -1,29 +1,29 @@ - - -{{#if field.image}} -
-{{/if}} - -{{#if field.description}} -
{{cookedDescription}}
-{{/if}} - -{{#field-validators field=field as |validators|}} - {{#if inputComponentName}} -
- {{component inputComponentName field=field step=step fieldClass=fieldClass wizard=wizard }} -
- {{/if}} -{{/field-validators}} - -{{#if field.char_counter}} - {{#if textType}} - {{char-counter field.value field.max_length}} - {{/if}} -{{/if}} - -{{#if field.errorDescription}} -
{{{field.errorDescription}}}
-{{/if}} + + +{{#if field.image}} +
+{{/if}} + +{{#if field.description}} +
{{cookedDescription}}
+{{/if}} + +{{#field-validators field=field as |validators|}} + {{#if inputComponentName}} +
+ {{component inputComponentName field=field step=step fieldClass=fieldClass wizard=wizard autocomplete=validators.autocomplete}} +
+ {{/if}} +{{/field-validators}} + +{{#if field.char_counter}} + {{#if textType}} + {{char-counter field.value field.max_length}} + {{/if}} +{{/if}} + +{{#if field.errorDescription}} +
{{html-safe field.errorDescription}}
+{{/if}} diff --git a/assets/javascripts/wizard/templates/components/wizard-no-access.hbs b/assets/javascripts/wizard/templates/components/wizard-no-access.hbs index d3a2c192..f27be5b3 100644 --- a/assets/javascripts/wizard/templates/components/wizard-no-access.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-no-access.hbs @@ -1,7 +1,7 @@
{{text}}
-
diff --git a/assets/javascripts/wizard/templates/components/wizard-similar-topic.hbs b/assets/javascripts/wizard/templates/components/wizard-similar-topic.hbs index eeaaa751..47197dbc 100644 --- a/assets/javascripts/wizard/templates/components/wizard-similar-topic.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-similar-topic.hbs @@ -1,4 +1,4 @@ - + {{html-safe topic.fancy_title}}
{{date-node topic.created_at}} - {{html-safe topic.blurb}}
diff --git a/assets/javascripts/wizard/templates/components/wizard-similar-topics.hbs b/assets/javascripts/wizard/templates/components/wizard-similar-topics.hbs index 045f973d..d1ee1fa1 100644 --- a/assets/javascripts/wizard/templates/components/wizard-similar-topics.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-similar-topics.hbs @@ -1,11 +1,11 @@ -{{#if showTopics}} -
    - {{#each topics as |topic|}} -
  • {{wizard-similar-topic topic=topic}}
  • - {{/each}} -
-{{else}} - - {{i18n 'realtime_validations.similar_topics.show'}} - -{{/if}} \ No newline at end of file +{{#if showTopics}} +
    + {{#each topics as |topic|}} +
  • {{wizard-similar-topic topic=topic}}
  • + {{/each}} +
+{{else}} + + {{wizard-i18n "realtime_validations.similar_topics.show"}} + +{{/if}} diff --git a/assets/javascripts/wizard/templates/components/wizard-step.hbs b/assets/javascripts/wizard/templates/components/wizard-step.hbs index 96115745..5277ef03 100644 --- a/assets/javascripts/wizard/templates/components/wizard-step.hbs +++ b/assets/javascripts/wizard/templates/components/wizard-step.hbs @@ -1,8 +1,8 @@ -
+
{{#if step.title}} -

{{cookedTitle}}

+

{{cookedTitle}}

{{/if}} - + {{#if bannerImage}}
@@ -10,46 +10,46 @@ {{/if}} {{#if step.description}} -
{{cookedDescription}}
+
{{cookedDescription}}
{{/if}} {{#wizard-step-form step=step}} - {{#each step.fields as |field index|}} + {{#each step.fields as |field|}} {{wizard-field field=field step=step wizard=wizard}} {{/each}} {{/wizard-step-form}}
-