1
0
Fork 0
Dieser Commit ist enthalten in:
Faizaan Gagan 2021-04-21 03:32:31 +05:30
Commit fb8cdab0fd
174 geänderte Dateien mit 3526 neuen und 2192 gelöschten Zeilen

3
.eslintrc Normale Datei
Datei anzeigen

@ -0,0 +1,3 @@
{
"extends": "eslint-config-discourse"
}

53
.github/workflows/plugin-linting.yml gevendort Normale Datei
Datei anzeigen

@ -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 .

137
.github/workflows/plugin-tests.yml gevendort Normale Datei
Datei anzeigen

@ -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 }}]

5
.gitignore gevendort
Datei anzeigen

@ -1,2 +1,7 @@
coverage/*
!coverage/.last_run.json
gems/
.bundle/
auto_generated
.DS_Store
node_modules/

1
.prettierrc Normale Datei
Datei anzeigen

@ -0,0 +1 @@
{}

2
.rubocop.yml Normale Datei
Datei anzeigen

@ -0,0 +1,2 @@
inherit_gem:
rubocop-discourse: default.yml

4
.template-lintrc.js Normale Datei
Datei anzeigen

@ -0,0 +1,4 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};

7
Gemfile Normale Datei
Datei anzeigen

@ -0,0 +1,7 @@
# frozen_string_literal: true
source 'https://rubygems.org'
group :development do
gem 'rubocop-discourse'
end

38
Gemfile.lock Normale Datei
Datei anzeigen

@ -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

Datei anzeigen

@ -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;
}
});
},

Datei anzeigen

@ -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;
},

Datei anzeigen

@ -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;
},
});

Datei anzeigen

@ -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);

Datei anzeigen

@ -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);

Datei anzeigen

@ -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}`;
}

Datei anzeigen

@ -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({

Datei anzeigen

@ -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";

Datei anzeigen

@ -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({

Datei anzeigen

@ -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;
},

Datei anzeigen

@ -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";

Datei anzeigen

@ -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 = {};

Datei anzeigen

@ -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";

Datei anzeigen

@ -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}}

Datei anzeigen

@ -1,7 +1,7 @@
{{#each site.complete_custom_wizard as |wizard|}}
<div class='row'>
<div class='alert alert-info alert-wizard'>
<a href="{{wizard.url}}">{{i18n 'wizard.complete_custom' name=wizard.name}}</a>
<div class="row">
<div class="alert alert-info alert-wizard">
<a href={{wizard.url}}>{{i18n "wizard.complete_custom" name=wizard.name}}</a>
</div>
</div>
{{/each}}

Datei anzeigen

@ -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",

Datei anzeigen

@ -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);
});
},

Datei anzeigen

@ -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;
},

Datei anzeigen

@ -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(

Datei anzeigen

@ -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({

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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;

Datei anzeigen

@ -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,10 +23,7 @@ function castCase(property, value) {
return property.indexOf("_type") > -1 ? camelCase(value) : value;
}
function buildProperty(json, property, type) {
let value = json[property];
if (mapped(property, type) && present(value) && value.constructor === Array) {
function buildMappedProperty(value) {
let inputs = [];
value.forEach((inputJson) => {
@ -59,18 +56,36 @@ function buildProperty(json, property, type) {
});
return A(inputs);
} else {
return value;
}
}
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));

Datei anzeigen

@ -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";
}

Datei anzeigen

@ -1,4 +1,4 @@
import { set, get } from "@ember/object";
import { get, set } from "@ember/object";
const wizard = {
basic: {
@ -37,6 +37,7 @@ const wizard = {
const step = {
basic: {
id: null,
index: null,
title: null,
key: null,
banner: null,
@ -44,9 +45,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: {
@ -60,16 +63,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: {},
@ -225,7 +230,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;

Datei anzeigen

@ -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 = [];

Datei anzeigen

@ -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);

Datei anzeigen

@ -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) => {

Datei anzeigen

@ -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,

Datei anzeigen

@ -1,5 +1,5 @@
<div class="wizard-api-header page">
<div class='buttons'>
<div class="buttons">
{{#if updating}}
{{loading-spinner size="small"}}
{{else}}
@ -23,7 +23,7 @@
<div class="wizard-header">
{{#if api.isNew}}
{{i18n 'admin.wizard.api.new'}}
{{i18n "admin.wizard.api.new"}}
{{else}}
{{api.title}}
{{/if}}
@ -31,14 +31,14 @@
<div class="metadata">
<div class="title">
<label>{{i18n 'admin.wizard.api.title'}}</label>
{{input value=api.title placeholder=(i18n 'admin.wizard.api.title_placeholder')}}
<label>{{i18n "admin.wizard.api.title"}}</label>
{{input value=api.title placeholder=(i18n "admin.wizard.api.title_placeholder")}}
</div>
<div class="name">
<label>{{i18n 'admin.wizard.api.name'}}</label>
<label>{{i18n "admin.wizard.api.name"}}</label>
{{#if api.isNew}}
{{input value=api.name placeholder=(i18n 'admin.wizard.api.name_placeholder')}}
{{input value=api.name placeholder=(i18n "admin.wizard.api.name_placeholder")}}
{{else}}
{{api.name}}
{{/if}}
@ -64,7 +64,7 @@
</div>
<div class="wizard-header">
{{i18n 'admin.wizard.api.auth.label'}}
{{i18n "admin.wizard.api.auth.label"}}
</div>
</div>
@ -72,13 +72,13 @@
<div class="settings">
<div class="wizard-header medium">
{{i18n 'admin.wizard.api.auth.settings'}}
{{i18n "admin.wizard.api.auth.settings"}}
</div>
{{#if showRedirectUri}}
<div class="control-group redirect-uri">
<div class="control-label">
<label>{{i18n 'admin.wizard.api.auth.redirect_uri'}}</label>
<label>{{i18n "admin.wizard.api.auth.redirect_uri"}}</label>
<div class="controls">
{{api.redirectUri}}
</div>
@ -87,14 +87,14 @@
{{/if}}
<div class="control-group auth-type">
<label>{{i18n 'admin.wizard.api.auth.type'}}</label>
<label>{{i18n "admin.wizard.api.auth.type"}}</label>
<div class="controls">
{{combo-box
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"
)}}
</div>
</div>
@ -102,7 +102,7 @@
{{#if isOauth}}
{{#if threeLeggedOauth}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.url'}}</label>
<label>{{i18n "admin.wizard.api.auth.url"}}</label>
<div class="controls">
{{input value=api.authUrl}}
</div>
@ -110,51 +110,51 @@
{{/if}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.token_url'}}</label>
<label>{{i18n "admin.wizard.api.auth.token_url"}}</label>
<div class="controls">
{{input value=api.tokenUrl}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.client_id'}}</label>
<label>{{i18n "admin.wizard.api.auth.client_id"}}</label>
<div class="controls">
{{input value=api.clientId}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.client_secret'}}</label>
<label>{{i18n "admin.wizard.api.auth.client_secret"}}</label>
<div class="controls">
{{input value=api.clientSecret}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.params.label'}}</label>
<label>{{i18n "admin.wizard.api.auth.params.label"}}</label>
<div class="controls">
{{#each api.authParams as |param|}}
<div class="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"}}
</div>
{{/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")}}
</div>
</div>
{{/if}}
{{#if isBasicAuth}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.username'}}</label>
<label>{{i18n "admin.wizard.api.auth.username"}}</label>
<div class="controls">
{{input value=api.username}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.auth.password'}}</label>
<label>{{i18n "admin.wizard.api.auth.password"}}</label>
<div class="controls">
{{input value=api.password}}
</div>
@ -175,12 +175,12 @@
</div>
<div class="wizard-header medium">
{{i18n 'admin.wizard.api.status.label'}}
{{i18n "admin.wizard.api.status.label"}}
</div>
{{#if threeLeggedOauth}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.code'}}</label>
<label>{{i18n "admin.wizard.api.status.code"}}</label>
<div class="controls">
{{api.code}}
</div>
@ -188,7 +188,7 @@
{{/if}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.access_token'}}</label>
<label>{{i18n "admin.wizard.api.status.access_token"}}</label>
<div class="controls">
{{api.accessToken}}
</div>
@ -196,7 +196,7 @@
{{#if threeLeggedOauth}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.refresh_token'}}</label>
<label>{{i18n "admin.wizard.api.status.refresh_token"}}</label>
<div class="controls">
{{api.refreshToken}}
</div>
@ -204,14 +204,14 @@
{{/if}}
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.expires_at'}}</label>
<label>{{i18n "admin.wizard.api.status.expires_at"}}</label>
<div class="controls">
{{api.tokenExpiresAt}}
</div>
</div>
<div class="control-group">
<label>{{i18n 'admin.wizard.api.status.refresh_at'}}</label>
<label>{{i18n "admin.wizard.api.status.refresh_at"}}</label>
<div class="controls">
{{api.tokenRefreshAt}}
</div>
@ -221,11 +221,11 @@
</div>
<div class="wizard-header">
{{i18n 'admin.wizard.api.endpoint.label'}}
{{i18n "admin.wizard.api.endpoint.label"}}
</div>
<div class="wizard-api-endpoints">
{{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}}
<div class="endpoint-list">
@ -236,14 +236,14 @@
<div class="endpoint-">
<div class="top">
{{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"}}
</div>
<div class="bottom">
{{combo-box
@ -278,26 +278,29 @@
</div>
<div class="wizard-header">
{{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"}}
</div>
<div class="wizard-api-log">
<div class="log-list">
<table class="wizard-api-log-table">
<thead>
<th>Datetime</th>
<th>User</th>
<th>Status</th>
<th>URL</th>
<th>Error</th>
</thead>
<tbody>
{{#each api.log as |logentry|}}
<tr>
<td>{{logentry.time}}</td>
<td class="user-image">
<div class="user-image-inner">
<a href="{{unbound logentry.userpath}}" data-user-card="{{unbound logentry.username}}">{{avatar logentry imageSize="large"}}</a>
<a href={{logentry.userpath}} data-user-card={{logentry.username}}>{{avatar logentry imageSize="large"}}</a>
</div>
</td>
<td>{{logentry.status}}</td>
@ -305,6 +308,7 @@
<td>{{logentry.error}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>

Datei anzeigen

@ -2,9 +2,9 @@
{{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

Datei anzeigen

@ -1,5 +1,5 @@
<div class="admin-wizard-controls">
<h3>{{i18n 'admin.wizard.custom_field.nav_label'}}</h3>
<h3>{{i18n "admin.wizard.custom_field.nav_label"}}</h3>
<div class="buttons">
{{d-button
@ -14,23 +14,27 @@
opts=messageOpts
type=messageType
url=documentationUrl
component='custom_fields'}}
component="custom_fields"}}
<div class="admin-wizard-container">
{{#if customFields}}
<table>
<thead>
<tr>
{{#each fieldKeys as |key|}}
<th>{{i18n (concat "admin.wizard.custom_field." key ".label")}}</th>
{{/each}}
<th></th>
</tr>
</thead>
<tbody>
{{#each customFields as |field|}}
{{custom-field-input
field=field
removeField=(action 'removeField')
saveField=(action 'saveField')}}
removeField=(action "removeField")
saveField=(action "saveField")}}
{{/each}}
</tbody>
</table>
{{/if}}
</div>

Datei anzeigen

@ -1,5 +1,5 @@
<div class="admin-wizard-controls">
<h3>{{i18n 'admin.wizard.log.nav_label'}}</h3>
<h3>{{i18n "admin.wizard.log.nav_label"}}</h3>
{{d-button
label="refresh"
@ -10,7 +10,7 @@
{{#load-more selector=".log-list tr" action=(action "loadMore") class="wizard-logs"}}
{{#if noResults}}
<p>{{i18n 'search.no_results'}}</p>
<p>{{i18n "search.no_results"}}</p>
{{else}}
<table class="table grid">
<thead>

Datei anzeigen

@ -1,18 +1,18 @@
<div class="admin-wizard-controls">
<h3>{{i18n 'admin.wizard.manager.title'}}</h3>
<h3>{{i18n "admin.wizard.manager.title"}}</h3>
<div class="buttons">
{{#if filename}}
<div class="filename">
<a {{action 'clearFile'}}>
{{d-icon 'times'}}
<a role="button" {{action "clearFile"}}>
{{d-icon "times"}}
</a>
<span>{{filename}}</span>
</div>
{{/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"}}
<div class="admin-wizard-container">
<table class="table grid">
<thead>
<tr>
<th>{{i18n 'admin.wizard.label'}}</th>
<th class="control-column">{{i18n 'admin.wizard.manager.export'}}</th>
<th class="control-column">{{i18n 'admin.wizard.manager.destroy'}}</th>
<th>{{i18n "admin.wizard.label"}}</th>
<th class="control-column">{{i18n "admin.wizard.manager.export"}}</th>
<th class="control-column">{{i18n "admin.wizard.manager.destroy"}}</th>
</tr>
</thead>
<tbody>
@ -68,13 +68,13 @@
{{input
type="checkbox"
class="export"
change=(action 'selectWizard')}}
change=(action "selectWizard")}}
</td>
<td class="control-column">
{{input
type="checkbox"
class="destroy"
change=(action 'selectWizard')}}
change=(action "selectWizard")}}
</td>
</tr>
{{/each}}

Datei anzeigen

@ -1,9 +1,9 @@
{{#if submissions}}
<div class="wizard-header large">
<label>{{i18n 'admin.wizard.submissions.title' name=wizard.name}}</label>
<label>{{i18n "admin.wizard.submissions.title" name=wizard.name}}</label>
<a class="btn btn-default download-link" href="{{downloadUrl}}" target="_blank">
{{d-icon 'download'}}
<a class="btn btn-default download-link" href={{downloadUrl}} target="_blank" rel="noopener noreferrer">
{{d-icon "download"}}
<span class="d-button-label">
{{i18n "admin.wizard.submissions.download"}}
</span>
@ -12,11 +12,14 @@
<div class="wizard-submissions">
<table>
<thead>
<tr>
{{#each fields as |f|}}
<th>{{f}}</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each submissions as |s|}}
<tr>
{{#each-in s as |k v|}}
@ -24,6 +27,7 @@
{{/each-in}}
</tr>
{{/each}}
</tbody>
</table>
</div>
{{/if}}

Datei anzeigen

@ -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"
)}}
</div>

Datei anzeigen

@ -12,7 +12,7 @@
{{else}}
{{d-button action=(action "copyUrl") class="pull-right no-text" icon="copy"}}
{{/if}}
<a href="{{wizardUrl}}" target="_blank">{{wizardUrl}}</a>
<a href={{wizardUrl}} target="_blank" rel="noopener noreferrer">{{wizardUrl}}</a>
{{/if}}
</div>
</div>
@ -20,7 +20,7 @@
<div class="wizard-basic-details">
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.background'}}</label>
<label>{{i18n "admin.wizard.background"}}</label>
</div>
<div class="setting-value">
{{input
@ -33,95 +33,95 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.theme_id'}}</label>
<label>{{i18n "admin.wizard.theme_id"}}</label>
</div>
<div class="setting-value">
{{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"
)}}
</div>
</div>
</div>
<div class="wizard-header medium">
{{i18n 'admin.wizard.label'}}
{{i18n "admin.wizard.label"}}
</div>
<div class="wizard-settings">
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.required'}}</label>
<label>{{i18n "admin.wizard.required"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.required}}
<span>{{i18n 'admin.wizard.required_label'}}</span>
{{input type="checkbox" checked=wizard.required}}
<span>{{i18n "admin.wizard.required_label"}}</span>
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.after_signup'}}</label>
<label>{{i18n "admin.wizard.after_signup"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.after_signup}}
<span>{{i18n 'admin.wizard.after_signup_label'}}</span>
{{input type="checkbox" checked=wizard.after_signup}}
<span>{{i18n "admin.wizard.after_signup_label"}}</span>
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.multiple_submissions'}}</label>
<label>{{i18n "admin.wizard.multiple_submissions"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.multiple_submissions}}
<span>{{i18n 'admin.wizard.multiple_submissions_label'}}</span>
{{input type="checkbox" checked=wizard.multiple_submissions}}
<span>{{i18n "admin.wizard.multiple_submissions_label"}}</span>
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.prompt_completion'}}</label>
<label>{{i18n "admin.wizard.prompt_completion"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.prompt_completion}}
<span>{{i18n 'admin.wizard.prompt_completion_label'}}</span>
{{input type="checkbox" checked=wizard.prompt_completion}}
<span>{{i18n "admin.wizard.prompt_completion_label"}}</span>
</div>
</div>
<div class="setting full-inline">
<div class="setting-label">
<label>{{i18n 'admin.wizard.after_time'}}</label>
<label>{{i18n "admin.wizard.after_time"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.after_time}}
<span>{{i18n 'admin.wizard.after_time_label'}}</span>
{{input type="checkbox" checked=wizard.after_time}}
<span>{{i18n "admin.wizard.after_time_label"}}</span>
{{d-button
action='setNextSessionScheduled'
action="setNextSessionScheduled"
translatedLabel=nextSessionScheduledLabel
class="btn-after-time"
icon='far-calendar'}}
icon="far-calendar"}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.permitted'}}</label>
<label>{{i18n "admin.wizard.permitted"}}</label>
</div>
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -133,21 +133,21 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.save_submissions'}}</label>
<label>{{i18n "admin.wizard.save_submissions"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.save_submissions}}
<span>{{i18n 'admin.wizard.save_submissions_label'}}</span>
{{input type="checkbox" checked=wizard.save_submissions}}
<span>{{i18n "admin.wizard.save_submissions_label"}}</span>
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.restart_on_revisit'}}</label>
<label>{{i18n "admin.wizard.restart_on_revisit"}}</label>
</div>
<div class="setting-value">
{{input type='checkbox' checked=wizard.restart_on_revisit}}
<span>{{i18n 'admin.wizard.restart_on_revisit_label'}}</span>
{{input type="checkbox" checked=wizard.restart_on_revisit}}
<span>{{i18n "admin.wizard.restart_on_revisit_label"}}</span>
</div>
</div>
@ -185,18 +185,18 @@
wizardFields=wizardFields}}
{{/each}}
<div class='admin-wizard-buttons'>
<button {{action "save"}} disabled={{disableSave}} class='btn btn-primary'>
{{i18n 'admin.wizard.save'}}
<div class="admin-wizard-buttons">
<button {{action "save"}} disabled={{disableSave}} class="btn btn-primary" type="button">
{{i18n "admin.wizard.save"}}
</button>
{{#unless creating}}
<button {{action "remove"}} class='btn btn-danger remove'>
{{d-icon "far-trash-alt"}}{{i18n 'admin.wizard.remove'}}
<button {{action "remove"}} class="btn btn-danger remove" type="button">
{{d-icon "far-trash-alt"}}{{i18n "admin.wizard.remove"}}
</button>
{{/unless}}
{{conditional-loading-spinner condition=saving size='small'}}
{{conditional-loading-spinner condition=saving size="small"}}
{{#if error}}
<span class="error">{{d-icon "times"}}{{error}}</span>

Datei anzeigen

@ -2,9 +2,9 @@
{{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
@ -16,7 +16,7 @@
{{wizard-message
key=messageKey
url=messageUrl
component='wizard'}}
component="wizard"}}
<div class="admin-wizard-container settings">
{{outlet}}

Datei anzeigen

@ -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}}
<div class="admin-container">

Datei anzeigen

@ -1,4 +1,4 @@
{{d-button
action="toggleAdvanced"
label='admin.wizard.advanced'
label="admin.wizard.advanced"
class=toggleClass}}

Datei anzeigen

@ -38,7 +38,7 @@
{{wizard-message
key=messageKey
url=messageUrl
component='action'}}
component="action"}}
{{#if basicTopicFields}}
<div class="setting full field-mapper-setting">
@ -49,12 +49,12 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -68,16 +68,16 @@
{{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
)}}
<div class="setting-gutter">
{{input type='checkbox' checked=action.post_builder}}
<span>{{i18n 'admin.wizard.action.post_builder.checkbox'}}</span>
{{input type="checkbox" checked=action.post_builder}}
<span>{{i18n "admin.wizard.action.post_builder.checkbox"}}</span>
</div>
</div>
</div>
@ -85,7 +85,7 @@
{{#if action.post_builder}}
<div class="setting full">
<div class="setting-label">
<label>{{i18n 'admin.wizard.action.post_builder.label'}}</label>
<label>{{i18n "admin.wizard.action.post_builder.label"}}</label>
</div>
<div class="setting-value editor">
@ -106,16 +106,16 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -128,15 +128,15 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -149,12 +149,12 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -169,16 +169,16 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -187,21 +187,21 @@
{{#if updateProfile}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.action.update_profile.setting'}}</label>
<label>{{i18n "admin.wizard.action.update_profile.setting"}}</label>
</div>
{{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"
)}}
</div>
{{/if}}
@ -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"
)}}
</div>
</div>
@ -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"
)}}
</div>
</div>
@ -252,7 +252,7 @@
previewEnabled=false
barEnabled=false
wizardFields=wizardFields
placeholder='admin.wizard.action.send_to_api.body_placeholder'}}
placeholder="admin.wizard.action.send_to_api.body_placeholder"}}
</div>
</div>
{{/if}}
@ -266,16 +266,16 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -290,15 +290,15 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -313,15 +313,15 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -334,12 +334,12 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -356,7 +356,7 @@
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"
)}}
</div>
</div>
@ -379,13 +379,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -400,13 +400,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -418,13 +418,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -436,13 +436,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -454,13 +454,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -472,14 +472,14 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -491,14 +491,14 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -510,13 +510,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -528,13 +528,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -546,13 +546,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -564,13 +564,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -582,13 +582,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -603,13 +603,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -622,13 +622,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -641,13 +641,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -660,13 +660,13 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -679,14 +679,14 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -699,16 +699,16 @@
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -723,22 +723,22 @@
{{#if hasCustomFields}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.action.custom_fields.label'}}</label>
<label>{{i18n "admin.wizard.action.custom_fields.label"}}</label>
</div>
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -747,20 +747,20 @@
{{#if sendMessage}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.required'}}</label>
<label>{{i18n "admin.wizard.required"}}</label>
</div>
<div class="setting-value">
{{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"
)}}
</div>
</div>
@ -773,10 +773,10 @@
</div>
<div class="setting-value">
{{input type='checkbox' checked=action.skip_redirect}}
{{input type="checkbox" checked=action.skip_redirect}}
<span>
{{i18n 'admin.wizard.action.skip_redirect.description' type='topic'}}
{{i18n "admin.wizard.action.skip_redirect.description" type="topic"}}
</span>
</div>
</div>
@ -787,10 +787,10 @@
</div>
<div class="setting-value">
{{input type='checkbox' checked=action.suppress_notifications}}
{{input type="checkbox" checked=action.suppress_notifications}}
<span>
{{i18n 'admin.wizard.action.suppress_notifications.description' type='topic'}}
{{i18n "admin.wizard.action.suppress_notifications.description" type="topic"}}
</span>
</div>
</div>

Datei anzeigen

@ -8,7 +8,7 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.label'}}</label>
<label>{{i18n "admin.wizard.field.label"}}</label>
</div>
<div class="setting-value">
{{input name="label" value=field.label}}
@ -17,18 +17,18 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.required'}}</label>
<label>{{i18n "admin.wizard.field.required"}}</label>
</div>
<div class="setting-value">
<span>{{i18n 'admin.wizard.field.required_label'}}</span>
{{input type='checkbox' checked=field.required}}
<span>{{i18n "admin.wizard.field.required_label"}}</span>
{{input type="checkbox" checked=field.required}}
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.description'}}</label>
<label>{{i18n "admin.wizard.field.description"}}</label>
</div>
<div class="setting-value">
{{textarea name="description" value=field.description}}
@ -37,7 +37,7 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.image'}}</label>
<label>{{i18n "admin.wizard.field.image"}}</label>
</div>
<div class="setting-value">
{{image-uploader
@ -51,7 +51,7 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.type'}}</label>
<label>{{i18n "admin.wizard.type"}}</label>
</div>
<div class="setting-value">
@ -68,12 +68,12 @@
{{wizard-message
key=messageKey
url=messageUrl
component='field'}}
component="field"}}
{{#if isTextType}}
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.min_length'}}</label>
<label>{{i18n "admin.wizard.field.min_length"}}</label>
</div>
<div class="setting-value">
@ -87,7 +87,7 @@
<div class="setting full">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.max_length'}}</label>
<label>{{i18n "admin.wizard.field.max_length"}}</label>
</div>
<div class="setting-value">
@ -101,11 +101,11 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.char_counter'}}</label>
<label>{{i18n "admin.wizard.field.char_counter"}}</label>
</div>
<div class="setting-value">
<span>{{i18n 'admin.wizard.field.char_counter_placeholder'}}</span>
<span>{{i18n "admin.wizard.field.char_counter_placeholder"}}</span>
{{input
type="checkbox"
checked=field.char_counter}}
@ -116,7 +116,7 @@
{{#if isUpload}}
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.file_types'}}</label>
<label>{{i18n "admin.wizard.field.file_types"}}</label>
</div>
<div class="setting-value">
@ -128,7 +128,7 @@
{{#if showLimit}}
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.limit'}}</label>
<label>{{i18n "admin.wizard.field.limit"}}</label>
</div>
<div class="setting-value">
@ -140,12 +140,12 @@
{{#if isDateTime}}
<div class="setting">
<div class="setting-label">
<label>{{{i18n 'admin.wizard.field.date_time_format.label'}}}</label>
<label>{{html-safe (i18n "admin.wizard.field.date_time_format.label")}}</label>
</div>
<div class="setting-value">
{{input value=field.format class="medium"}}
<label>{{{i18n 'admin.wizard.field.date_time_format.instructions'}}}</label>
<label>{{html-safe (i18n "admin.wizard.field.date_time_format.instructions")}}</label>
</div>
</div>
{{/if}}
@ -153,14 +153,14 @@
{{#if showPrefill}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.prefill'}}</label>
<label>{{i18n "admin.wizard.field.prefill"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=field.prefill
property='prefill'
onUpdate=(action 'mappedFieldUpdated')
property="prefill"
onUpdate=(action "mappedFieldUpdated")
options=prefillOptions}}
</div>
</div>
@ -169,14 +169,14 @@
{{#if showContent}}
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.content'}}</label>
<label>{{i18n "admin.wizard.field.content"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=field.content
property='content'
onUpdate=(action 'mappedFieldUpdated')
property="content"
onUpdate=(action "mappedFieldUpdated")
options=contentOptions}}
</div>
</div>
@ -188,10 +188,34 @@
{{#if field.showAdvanced}}
<div class="advanced-settings">
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.condition"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=field.condition
options=fieldConditionOptions}}
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.index"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=field.index
options=fieldIndexOptions}}
</div>
</div>
{{#if isCategory}}
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.property'}}</label>
<label>{{i18n "admin.wizard.field.property"}}</label>
</div>
<div class="setting-value">
@ -200,7 +224,7 @@
content=categoryPropertyTypes
onChange=(action (mut field.property))
options=(hash
none='admin.wizard.selector.placeholder.property'
none="admin.wizard.selector.placeholder.property"
)}}
</div>
</div>
@ -208,7 +232,7 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.translation'}}</label>
<label>{{i18n "admin.wizard.translation"}}</label>
</div>
<div class="setting-value medium">
{{input

Datei anzeigen

@ -1,6 +1,6 @@
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.step.title'}}</label>
<label>{{i18n "admin.wizard.step.title"}}</label>
</div>
<div class="setting-value">
{{input
@ -11,7 +11,7 @@
<div class="setting full">
<div class="setting-label">
<label>{{i18n 'admin.wizard.step.banner'}}</label>
<label>{{i18n "admin.wizard.step.banner"}}</label>
</div>
<div class="setting-value">
{{image-uploader
@ -25,7 +25,7 @@
<div class="setting full">
<div class="setting-label">
<label>{{i18n 'admin.wizard.step.description'}}</label>
<label>{{i18n "admin.wizard.step.description"}}</label>
</div>
<div class="setting-value">
{{wizard-text-editor
@ -40,23 +40,44 @@
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.step.required_data.label'}}</label>
<label>{{i18n "admin.wizard.condition"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=step.condition
options=stepConditionOptions}}
</div>
</div>
<div class="setting full">
<div class="setting-label"></div>
<div class="setting-value force-final">
<h4>{{i18n "admin.wizard.step.force_final.label"}}</h4>
{{input type="checkbox" checked=step.force_final}}
<span>{{i18n "admin.wizard.step.force_final.description"}}</span>
</div>
</div>
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n "admin.wizard.step.required_data.label"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=step.required_data
options=(hash
inputTypes='validation'
inputConnector='and'
wizardFieldSelection='value'
userFieldSelection='value'
inputTypes="validation"
inputConnector="and"
wizardFieldSelection="value"
userFieldSelection="value"
keyPlaceholder="admin.wizard.submission_key"
context='step'
context="step"
)}}
{{#if step.required_data}}
<div class="required-data-message">
<div class="label">
{{i18n 'admin.wizard.step.required_data.not_permitted_message'}}
{{i18n "admin.wizard.step.required_data.not_permitted_message"}}
</div>
{{input value=step.required_data_message}}
</div>
@ -66,24 +87,24 @@
<div class="setting full field-mapper-setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.step.permitted_params.label'}}</label>
<label>{{i18n "admin.wizard.step.permitted_params.label"}}</label>
</div>
<div class="setting-value">
{{wizard-mapper
inputs=step.permitted_params
options=(hash
pairConnector='set'
inputTypes='association'
keyPlaceholder='admin.wizard.param_key'
valuePlaceholder='admin.wizard.submission_key'
context='step'
pairConnector="set"
inputTypes="association"
keyPlaceholder="admin.wizard.param_key"
valuePlaceholder="admin.wizard.submission_key"
context="step"
)}}
</div>
</div>
<div class="setting">
<div class="setting-label">
<label>{{i18n 'admin.wizard.translation'}}</label>
<label>{{i18n "admin.wizard.translation"}}</label>
</div>
<div class="setting-value">
{{input
@ -92,7 +113,6 @@
placeholderKey="admin.wizard.translation_placeholder"}}
</div>
</div>
</div>
{{/if}}
@ -105,6 +125,7 @@
{{#each step.fields as |field|}}
{{wizard-custom-field
field=field
step=step
currentFieldId=currentField.id
fieldTypes=fieldTypes
removeField="removeField"

Datei anzeigen

@ -1,14 +1,14 @@
<div class="wizard-header medium">{{{i18n header}}}</div>
<div class="wizard-header medium">{{html-safe (i18n header)}}</div>
<div class="link-list">
{{#if anyLinks}}
{{#each links as |l|}}
<div data-id='{{l.id}}'>
<div data-id={{l.id}}>
{{d-button action="change" actionParam=l.id translatedLabel=l.label class=l.classes}}
{{d-button action='remove' actionParam=l.id icon='times' class='remove'}}
{{d-button action="remove" actionParam=l.id icon="times" class="remove"}}
</div>
{{/each}}
{{/if}}
{{d-button action='add' label='admin.wizard.add' icon='plus'}}
{{d-button action="add" label="admin.wizard.add" icon="plus"}}
</div>

Datei anzeigen

@ -15,13 +15,13 @@
last=pair.last
inputType=inputType
options=options
removePair=(action 'removePair')
removePair=(action "removePair")
onUpdate=onUpdate}}
{{/each}}
{{#if canAddPair}}
<a {{action 'addPair'}} class="add-pair">
{{d-icon 'plus'}}
<a role="button" {{action "addPair"}} class="add-pair">
{{d-icon "plus"}}
</a>
{{/if}}
</div>
@ -40,7 +40,7 @@
<div class="output mapper-block">
{{wizard-mapper-selector
selectorType='output'
selectorType="output"
inputType=input.type
value=input.output
activeType=input.output_type
@ -49,6 +49,6 @@
</div>
{{/if}}
<a class="remove-input" {{action remove input}}>
{{d-icon 'times'}}
<a role="button" class="remove-input" {{action remove input}}>
{{d-icon "times"}}
</a>

Datei anzeigen

@ -1,6 +1,6 @@
<div class="key mapper-block">
{{wizard-mapper-selector
selectorType='key'
selectorType="key"
inputType=inputType
value=pair.key
activeType=pair.key_type
@ -18,7 +18,7 @@
<div class="value mapper-block">
{{wizard-mapper-selector
selectorType='value'
selectorType="value"
inputType=inputType
value=pair.value
activeType=pair.value_type
@ -31,5 +31,5 @@
{{/if}}
{{#if showRemove}}
<a {{action removePair pair}} class="remove-pair">{{d-icon 'times'}}</a>
<a role="button" {{action removePair pair}} class="remove-pair">{{d-icon "times"}}</a>
{{/if}}

Datei anzeigen

@ -1,6 +1,6 @@
<div class="type-selector">
{{#if hasTypes}}
<a {{action "toggleTypes"}} class="active">
<a role="button" {{action "toggleTypes"}} class="active">
{{activeTypeLabel}}
</a>
@ -10,7 +10,7 @@
{{wizard-mapper-selector-type
activeType=activeType
item=item
toggle=(action 'toggleType')}}
toggle=(action "toggleType")}}
{{/each}}
</div>
{{/if}}
@ -66,7 +66,7 @@
{{#if showUser}}
{{user-selector
includeMessageableGroups='true'
includeMessageableGroups="true"
placeholderKey=placeholderKey
usernames=value
autocomplete="discourse"

Datei anzeigen

@ -3,18 +3,18 @@
{{wizard-mapper-connector
connector=input.connector
connectorType="input"
onUpdate=(action 'inputUpdated')}}
onUpdate=(action "inputUpdated")}}
{{/if}}
{{wizard-mapper-input
input=input
options=inputOptions
remove=(action 'remove')
onUpdate=(action 'inputUpdated')}}
remove=(action "remove")
onUpdate=(action "inputUpdated")}}
{{/each}}
{{#if canAdd}}
<span class="add-mapper-input">
{{d-button action='add' label='admin.wizard.add' icon='plus'}}
{{d-button action="add" label="admin.wizard.add" icon="plus"}}
</span>
{{/if}}

Datei anzeigen

@ -2,13 +2,13 @@
{{#if showIcon}}
{{d-icon icon}}
{{/if}}
<span class="message-content">{{{message}}}</span>
<span class="message-content">{{html-safe message}}</span>
{{#if hasItems}}
<ul>
{{#each items as |item|}}
<li>
<span>{{d-icon item.icon}}</span>
<span>{{{item.html}}}</span>
<span>{{html-safe item.html}}</span>
</li>
{{/each}}
</ul>
@ -17,9 +17,9 @@
{{#if showDocumentation}}
<div class="message-block">
{{d-icon 'question-circle'}}
{{d-icon "question-circle"}}
<a href={{url}} target="_blank">
<a href={{url}} target="_blank" rel="noopener noreferrer">
{{documentation}}
</a>
</div>

Datei anzeigen

@ -1,28 +1,28 @@
<h3>{{i18n 'admin.wizard.field.validations.header'}}</h3>
<h3>{{i18n "admin.wizard.field.validations.header"}}</h3>
<ul>
{{#each-in field.validations as |type props|}}
<li>
<span class="setting-title">
<h4>{{i18n (concat 'admin.wizard.field.validations.' type)}}</h4>
<h4>{{i18n (concat "admin.wizard.field.validations." type)}}</h4>
{{input type="checkbox" checked=props.status}}
{{i18n 'admin.wizard.field.validations.enabled'}}
{{i18n "admin.wizard.field.validations.enabled"}}
</span>
<div class="validation-container">
<div class="validation-section">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.validations.categories'}}</label>
<label>{{i18n "admin.wizard.field.validations.categories"}}</label>
</div>
<div class="setting-value">
{{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"}}
</div>
</div>
<div class="validation-section">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.validations.max_topic_age'}}</label>
<label>{{i18n "admin.wizard.field.validations.max_topic_age"}}</label>
</div>
<div class="setting-value">
{{input type="number" class="time-n-value" value=props.time_n_value}}
@ -35,13 +35,13 @@
</div>
<div class="validation-section">
<div class="setting-label">
<label>{{i18n 'admin.wizard.field.validations.position'}}</label>
<label>{{i18n "admin.wizard.field.validations.position"}}</label>
</div>
<div class="setting-value">
{{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"}}
</div>
</div>
</div>

Datei anzeigen

@ -18,20 +18,20 @@
{{#if showPopover}}
<div class="wizard-editor-gutter-popover">
<label>
{{i18n 'admin.wizard.action.post_builder.user_properties'}}
{{i18n "admin.wizard.action.post_builder.user_properties"}}
{{userPropertyList}}
</label>
{{#if hasWizardFields}}
<label>
{{i18n 'admin.wizard.action.post_builder.wizard_fields'}}
{{i18n "admin.wizard.action.post_builder.wizard_fields"}}
{{wizardFieldList}}
</label>
{{/if}}
{{#if hasWizardActions}}
<label>
{{i18n 'admin.wizard.action.post_builder.wizard_actions'}}
{{i18n "admin.wizard.action.post_builder.wizard_actions"}}
{{wizardActionList}}
</label>
{{/if}}

Datei anzeigen

@ -1,4 +1,5 @@
window.Discourse = {}
/* eslint no-undef: 0*/
window.Discourse = {};
window.Wizard = {};
Wizard.SiteSettings = {};
Discourse.__widget_helpers = {};

Datei anzeigen

@ -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";
})();

Datei anzeigen

@ -1,4 +1,4 @@
(function () {
var wizard = require('discourse/plugins/discourse-custom-wizard/wizard/custom-wizard').default.create();
let wizard = require("discourse/plugins/discourse-custom-wizard/wizard/custom-wizard").default.create();
wizard.start();
})();

Datei anzeigen

@ -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();
}
}

Datei anzeigen

@ -1,5 +1,4 @@
import Component from "@ember/component";
import { observes } from "discourse-common/utils/decorators";
export default Component.extend({
actions: {
perform() {

Datei anzeigen

@ -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;
},

Datei anzeigen

@ -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),
});
},

Datei anzeigen

@ -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;
}, [])
);

Datei anzeigen

@ -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(),

Datei anzeigen

@ -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")) {

Datei anzeigen

@ -1,7 +1,7 @@
/* 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({

Datei anzeigen

@ -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);
}
},

Datei anzeigen

@ -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 = `<div class="body-length" data-length=${bodyLength} data-over-max=${isOverMax}>${bodyLength} / ${I18n.t(
"wizard.x_characters",
{ count: parseInt(maxLength) }
{ count: parseInt(maxLength, 10) }
)}</div>`;
} else {
finalString = `<div class="body-length">${I18n.t("wizard.x_characters", {
count: parseInt(bodyLength),
count: parseInt(bodyLength, 10),
})}</div>`;
}

Datei anzeigen

@ -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") {

Datei anzeigen

@ -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);

Datei anzeigen

@ -1,15 +1,17 @@
import { htmlHelper } from 'discourse-common/lib/helpers';
import { htmlHelper } from "discourse-common/lib/helpers";
function renderSpinner(cssClass) {
var html = "<div class='spinner";
if (cssClass) { html += ' ' + cssClass; }
if (cssClass) {
html += " " + cssClass;
}
return html + "'></div>";
}
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 };

Datei anzeigen

@ -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("");
});

Datei anzeigen

@ -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;
@ -30,7 +32,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"),
});

Datei anzeigen

@ -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");
},

Datei anzeigen

@ -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 });

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Datei anzeigen

@ -1,5 +1,6 @@
import loadScript from "./load-script";
import { default as PrettyText } from "pretty-text/pretty-text";
import Handlebars from "handlebars";
export function cook(text, options) {
return new Handlebars.SafeString(new PrettyText(options).cook(text));

Datei anzeigen

@ -2,7 +2,7 @@ import { CANCELLED_STATUS } from "discourse/lib/autocomplete";
import { debounce } from "@ember/runloop";
import getUrl from "discourse-common/lib/get-url";
var cache = {},
let cache = {},
cacheTopicId,
cacheTime,
currentTerm,
@ -18,7 +18,7 @@ function performSearch(
group,
resultsFn
) {
var cached = cache[term];
let cached = cache[term];
if (cached) {
resultsFn(cached);
return;
@ -37,7 +37,7 @@ function performSearch(
},
});
var returnVal = CANCELLED_STATUS;
let returnVal = CANCELLED_STATUS;
oldSearch
.then(function (r) {
@ -59,7 +59,7 @@ function organizeResults(r, options) {
return r;
}
var exclude = options.exclude || [],
let exclude = options.exclude || [],
limit = options.limit || 5,
users = [],
emails = [],
@ -87,8 +87,9 @@ function organizeResults(r, options) {
if (
results.length > limit &&
options.term.toLowerCase() !== g.name.toLowerCase()
)
) {
return false;
}
if (exclude.indexOf(g.name) === -1) {
groups.push(g);
results.push(g);
@ -104,7 +105,7 @@ function organizeResults(r, options) {
}
export default function userSearch(options) {
var term = options.term || "",
let term = options.term || "",
includeGroups = options.includeGroups,
includeMentionableGroups = options.includeMentionableGroups,
includeMessageableGroups = options.includeMessageableGroups,
@ -131,7 +132,7 @@ export default function userSearch(options) {
cacheTopicId = topicId;
var clearPromise = setTimeout(function () {
let clearPromise = setTimeout(function () {
resolve(CANCELLED_STATUS);
}, 5000);

Datei anzeigen

@ -19,7 +19,9 @@ const translationExists = (key) => {
const WizardI18n = (key, params = {}) => {
const themeId = getThemeId();
if (!themeId) return I18n.t(key, params);
if (!themeId) {
return I18n.t(key, params);
}
const themeKey = `theme_translations.${themeId}.${key}`;

Datei anzeigen

@ -10,7 +10,9 @@ const CustomWizard = EmberObject.extend({
totalSteps: (length) => length,
skip() {
if (this.required && !this.completed && this.permitted) return;
if (this.required && !this.completed && this.permitted) {
return;
}
CustomWizard.skip(this.id);
},
});
@ -29,32 +31,15 @@ CustomWizard.reopenClass({
}
window.location.href = getUrl(url);
},
});
export function findCustomWizard(wizardId, params = {}) {
let url = `/w/${wizardId}`;
let paramKeys = Object.keys(params).filter((k) => {
if (k === "wizard_id") return false;
return !!params[k];
});
if (paramKeys.length) {
url += "?";
paramKeys.forEach((k, i) => {
if (i > 0) {
url += "&";
}
url += `${k}=${params[k]}`;
});
build(wizardJson) {
if (!wizardJson) {
return null;
}
return ajax({ url, cache: false, dataType: "json" }).then((result) => {
const wizard = result;
if (!wizard) return null;
if (!wizard.completed) {
wizard.steps = wizard.steps.map((step) => {
if (!wizardJson.completed && wizardJson.steps) {
wizardJson.steps = wizardJson.steps
.map((step) => {
const stepObj = Step.create(step);
stepObj.fields.sort((a, b) => {
@ -62,7 +47,7 @@ export function findCustomWizard(wizardId, params = {}) {
});
let tabindex = 1;
stepObj.fields.forEach((f, i) => {
stepObj.fields.forEach((f) => {
f.tabindex = tabindex;
if (["date_time"].includes(f.type)) {
@ -75,13 +60,16 @@ export function findCustomWizard(wizardId, params = {}) {
stepObj.fields = stepObj.fields.map((f) => WizardField.create(f));
return stepObj;
})
.sort((a, b) => {
return parseFloat(a.index) - parseFloat(b.index);
});
}
if (wizard.categories) {
if (wizardJson.categories) {
let subcatMap = {};
let categoriesById = {};
let categories = wizard.categories.map((c) => {
let categories = wizardJson.categories.map((c) => {
if (c.parent_category_id) {
subcatMap[c.parent_category_id] =
subcatMap[c.parent_category_id] || [];
@ -110,12 +98,47 @@ export function findCustomWizard(wizardId, params = {}) {
Discourse.Site.currentProp("categoriesById", categoriesById);
Discourse.Site.currentProp(
"uncategorized_category_id",
wizard.uncategorized_category_id
wizardJson.uncategorized_category_id
);
}
return CustomWizard.create(wizard);
return CustomWizard.create(wizardJson);
},
});
export function findCustomWizard(wizardId, params = {}) {
let url = `/w/${wizardId}`;
let paramKeys = Object.keys(params).filter((k) => {
if (k === "wizard_id") {
return false;
}
return !!params[k];
});
if (paramKeys.length) {
url += "?";
paramKeys.forEach((k, i) => {
if (i > 0) {
url += "&";
}
url += `${k}=${params[k]}`;
});
}
return ajax({ url, cache: false, dataType: "json" }).then((result) => {
return CustomWizard.build(result);
});
}
let _wizard_store;
export function updateCachedWizard(wizard) {
_wizard_store = wizard;
}
export function getCachedWizard() {
return _wizard_store;
}
export default CustomWizard;

Datei anzeigen

@ -1,22 +1,19 @@
import { getCachedWizard } from "../models/custom";
export default Ember.Route.extend({
beforeModel() {
const appModel = this.modelFor("custom");
if (
appModel &&
appModel.permitted &&
!appModel.completed &&
appModel.start
) {
this.replaceWith("custom.step", appModel.start);
const wizard = getCachedWizard();
if (wizard && wizard.permitted && !wizard.completed && wizard.start) {
this.replaceWith("custom.step", wizard.start);
}
},
model() {
return this.modelFor("custom");
return getCachedWizard();
},
setupController(controller, model) {
if (model) {
if (model && model.id) {
const completed = model.get("completed");
const permitted = model.get("permitted");
const wizardId = model.get("id");

Datei anzeigen

@ -1,26 +1,33 @@
import WizardI18n from "../lib/wizard-i18n";
import { getCachedWizard } from "../models/custom";
export default Ember.Route.extend({
model(params) {
const appModel = this.modelFor("custom");
const allSteps = appModel.steps;
if (allSteps) {
const step = allSteps.findBy("id", params.step_id);
return step ? step : allSteps[0];
}
beforeModel() {
this.set("wizard", getCachedWizard());
},
return appModel;
model(params) {
const wizard = this.wizard;
if (wizard && wizard.steps) {
const step = wizard.steps.findBy("id", params.step_id);
return step ? step : wizard.steps[0];
} else {
return wizard;
}
},
afterModel(model) {
if (model.completed) return this.transitionTo("index");
return model.set("wizardId", this.modelFor("custom").id);
if (model.completed) {
return this.transitionTo("index");
}
return model.set("wizardId", this.wizard.id);
},
setupController(controller, model) {
let props = {
step: model,
wizard: this.modelFor("custom"),
wizard: this.wizard,
};
if (!model.permitted) {

Datei anzeigen

@ -1,6 +1,6 @@
/* eslint no-undef: 0*/
import { findCustomWizard } from "../models/custom";
import { findCustomWizard, updateCachedWizard } from "../models/custom";
import { ajax } from "wizard/lib/ajax";
export default Ember.Route.extend({
@ -12,7 +12,9 @@ export default Ember.Route.extend({
return findCustomWizard(params.wizard_id, this.get("queryParams"));
},
afterModel() {
afterModel(model) {
updateCachedWizard(model);
return ajax({
url: `/site/settings`,
type: "GET",
@ -25,11 +27,11 @@ export default Ember.Route.extend({
const background = model ? model.get("background") : "AliceBlue";
Ember.run.scheduleOnce("afterRender", this, function () {
$("body.custom-wizard").css("background", background);
if (model) {
$("#custom-wizard-main").addClass(model.get("id").dasherize());
if (model && model.id) {
$("#custom-wizard-main").addClass(model.id.dasherize());
}
});
controller.setProperties({
customWizard: true,
logoUrl: Wizard.SiteSettings.logo_small,

Datei anzeigen

@ -3,7 +3,7 @@
{{component validation.component field=field type=type validation=validation}}
{{/each-in}}
{{yield (hash perform=(action 'perform') autocomplete="off")}}
{{yield (hash perform=(action "perform") autocomplete="off")}}
{{#each-in field.validations.below as |type validation|}}
{{component validation.component field=field type=type validation=validation}}

Datei anzeigen

@ -1,9 +1,9 @@
<label class={{currentStateClass}}>
{{#if currentState}}
{{#if insufficientCharactersCategories}}
{{html-safe (i18n currentStateKey catLinks=catLinks)}}
{{html-safe (wizard-i18n currentStateKey catLinks=catLinks)}}
{{else}}
{{i18n currentStateKey}}
{{wizard-i18n currentStateKey}}
{{/if}}
{{/if}}
</label>

Datei anzeigen

@ -1,5 +1,5 @@
{{#if isValid}}
{{i18n validMessageKey}}
{{wizard-i18n validMessageKey}}
{{else}}
{{i18n invalidMessageKey}}
{{wizard-i18n invalidMessageKey}}
{{/if}}

Datei anzeigen

@ -25,8 +25,8 @@
{{#if showHyperlinkBox}}
{{wizard-composer-hyperlink
addLink=(action 'addLink')
hideBox=(action 'hideBox')}}
addLink=(action "addLink")
hideBox=(action "hideBox")}}
{{/if}}
{{#if isUploading}}

Datei anzeigen

@ -2,20 +2,20 @@
<h3>{{wizard-i18n "composer.link_dialog_title"}}</h3>
{{input
class="composer-link-name"
placeholder=(wizard-i18n 'composer.link_optional_text')
placeholder=(wizard-i18n "composer.link_optional_text")
type="text"
value=linkName}}
{{input
class="composer-link-url"
placeholder=(wizard-i18n 'composer.link_url_placeholder')
placeholder=(wizard-i18n "composer.link_url_placeholder")
type="text"
value=linkUrl}}
{{d-button
label="wizard_composer.modal_ok"
class="add-link btn-primary"
click=(action 'addLink')}}
click=(action "addLink")}}
{{d-button
label="wizard_composer.modal_cancel"
class="hide-hyperlink-box btn-danger"
click=(action 'hideBox')}}
click=(action "hideBox")}}
</div>

Datei anzeigen

@ -1,15 +1,15 @@
<div class='d-editor-overlay hidden'></div>
<div class="d-editor-overlay hidden"></div>
<div class='d-editor-container'>
<div class="d-editor-container">
{{#if showPreview}}
<div class="d-editor-preview-wrapper {{if forcePreview 'force-preview'}}">
<div class="d-editor-preview-wrapper {{if forcePreview "force-preview"}}">
<div class="d-editor-preview">
{{{preview}}}
{{html-safe preview}}
</div>
</div>
{{else}}
<div class="d-editor-textarea-wrapper">
<div class='d-editor-button-bar'>
<div class="d-editor-button-bar">
{{#each toolbar.groups as |group|}}
{{#each group.buttons as |b|}}
{{#if b.popupMenu}}
@ -24,7 +24,7 @@
)}}
{{else}}
<div>{{d.icon}}</div>
<button class='wizard-btn {{b.className}}' {{action b.action b}} title="{{b.title}}">
<button class="wizard-btn {{b.className}}" {{action b.action b}} title={{b.title}} type="button">
{{d-icon b.icon}}
{{#if b.label}}
<span class="d-button-label">{{wizard-i18n b.label}}</span>
@ -34,7 +34,7 @@
{{/each}}
{{#unless group.lastGroup}}
<div class='d-editor-spacer'></div>
<div class="d-editor-spacer"></div>
{{/unless}}
{{/each}}
</div>

Datei anzeigen

@ -1 +1 @@
{{input type='checkbox' id=field.id checked=field.value tabindex=field.tabindex}}
{{input type="checkbox" id=field.id checked=field.value tabindex=field.tabindex}}

Datei anzeigen

@ -8,7 +8,7 @@
afterRefresh=(action "afterRefresh")}}
<div class="bottom-bar">
<button class='wizard-btn toggle-preview' {{action 'togglePreview'}}>
<button class="wizard-btn toggle-preview" {{action "togglePreview"}} type="button">
<span class="d-button-label">{{wizard-i18n togglePreviewLabel}}</span>
</button>

Datei anzeigen

@ -6,5 +6,5 @@
tabindex=field.tabindex
onChange=(action (mut field.value))
options=(hash
none='group.select'
none="group.select"
)}}

Datei anzeigen

@ -1 +1 @@
{{input type='number' step='0.01' id=field.id value=field.value tabindex=field.tabindex}}
{{input type="number" step="0.01" id=field.id value=field.value tabindex=field.tabindex}}

Datei anzeigen

@ -1,4 +1,4 @@
<label class="wizard-btn wizard-btn-upload-file {{if uploading 'disabled'}}" tabindex="{{field.tabindex}}">
<label class="wizard-btn wizard-btn-upload-file {{if uploading "disabled"}}" tabindex={{field.tabindex}}>
{{#if uploading}}
{{wizard-i18n "wizard.uploading"}}
{{else}}
@ -6,13 +6,13 @@
{{d-icon "upload"}}
{{/if}}
<input disabled={{uploading}} type="file" accept="{{field.file_types}}" style="visibility: hidden; position: absolute;" />
<input disabled={{uploading}} type="file" accept={{field.file_types}} style="visibility: hidden; position: absolute;" >
</label>
{{#if field.value}}
{{#unless isImage}}
{{field.value.original_filename}}
{{else}}
{{#if isImage}}
<img src={{field.value.url}} class="wizard-image-preview">
{{/unless}}
{{else}}
{{field.value.original_filename}}
{{/if}}
{{/if}}

Datei anzeigen

@ -1 +1 @@
{{input type='text' id=field.id value=field.value tabindex=field.tabindex}}
{{input type="text" id=field.id value=field.value tabindex=field.tabindex}}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen