Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-24 02:10:29 +01:00
Merge pull request #297 from paviliondev/fix_tests_and_deprecations
FIX: tests and deprecations
Dieser Commit ist enthalten in:
Commit
86bd86bca5
229 geänderte Dateien mit 5068 neuen und 9505 gelöschten Zeilen
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "eslint-config-discourse"
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
{}
|
|
1
.prettierrc.cjs
Normale Datei
1
.prettierrc.cjs
Normale Datei
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require("@discourse/lint-configs/prettier");
|
1
.template-lintrc.cjs
Normale Datei
1
.template-lintrc.cjs
Normale Datei
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require("@discourse/lint-configs/template-lint");
|
|
@ -1,4 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
plugins: ["ember-template-lint-plugin-discourse"],
|
|
||||||
extends: "discourse:recommended",
|
|
||||||
};
|
|
10
.travis.yml
10
.travis.yml
|
@ -1,10 +0,0 @@
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- git clone --depth=1 https://github.com/discourse/discourse-plugin-ci
|
|
||||||
|
|
||||||
install: true
|
|
||||||
|
|
||||||
script:
|
|
||||||
- discourse-plugin-ci/script.sh
|
|
|
@ -1,19 +1,19 @@
|
||||||
{{#if showInputs}}
|
{{#if this.showInputs}}
|
||||||
<td>
|
<td>
|
||||||
{{wizard-subscription-selector
|
{{wizard-subscription-selector
|
||||||
value=field.klass
|
value=this.field.klass
|
||||||
feature="custom_field"
|
feature="custom_field"
|
||||||
attribute="klass"
|
attribute="klass"
|
||||||
onChange=(action (mut field.klass))
|
onChange=(action (mut this.field.klass))
|
||||||
options=(hash none="admin.wizard.custom_field.klass.select")
|
options=(hash none="admin.wizard.custom_field.klass.select")
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{wizard-subscription-selector
|
{{wizard-subscription-selector
|
||||||
value=field.type
|
value=this.field.type
|
||||||
feature="custom_field"
|
feature="custom_field"
|
||||||
attribute="type"
|
attribute="type"
|
||||||
onChange=(action (mut field.type))
|
onChange=(action (mut this.field.type))
|
||||||
options=(hash none="admin.wizard.custom_field.type.select")
|
options=(hash none="admin.wizard.custom_field.type.select")
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
|
@ -25,48 +25,52 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="multi-select">
|
<td class="multi-select">
|
||||||
{{multi-select
|
{{multi-select
|
||||||
value=field.serializers
|
value=this.field.serializers
|
||||||
content=serializerContent
|
content=this.serializerContent
|
||||||
onChange=(action (mut field.serializers))
|
onChange=(action (mut this.field.serializers))
|
||||||
options=(hash none="admin.wizard.custom_field.serializers.select")
|
options=(hash none="admin.wizard.custom_field.serializers.select")
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{{#if loading}}
|
{{#if this.loading}}
|
||||||
{{loading-spinner size="small"}}
|
{{loading-spinner size="small"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if saveIcon}}
|
{{#if this.saveIcon}}
|
||||||
{{d-icon saveIcon}}
|
{{d-icon this.saveIcon}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{d-button
|
{{d-button
|
||||||
action=(action "destroy")
|
action=(action "destroy")
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
class="destroy"
|
class="destroy"
|
||||||
disabled=destroyDisabled
|
disabled=this.destroyDisabled
|
||||||
}}
|
}}
|
||||||
{{d-button
|
{{d-button
|
||||||
icon="save"
|
icon="save"
|
||||||
action=(action "save")
|
action=(action "save")
|
||||||
disabled=saveDisabled
|
disabled=this.saveDisabled
|
||||||
class="save"
|
class="save"
|
||||||
}}
|
}}
|
||||||
{{d-button action=(action "close") icon="times" disabled=closeDisabled}}
|
{{d-button
|
||||||
|
action=(action "close")
|
||||||
|
icon="times"
|
||||||
|
disabled=this.closeDisabled
|
||||||
|
}}
|
||||||
</td>
|
</td>
|
||||||
{{else}}
|
{{else}}
|
||||||
<td><label>{{field.klass}}</label></td>
|
<td><label>{{this.field.klass}}</label></td>
|
||||||
<td><label>{{field.type}}</label></td>
|
<td><label>{{this.field.type}}</label></td>
|
||||||
<td class="input"><label>{{field.name}}</label></td>
|
<td class="input"><label>{{this.field.name}}</label></td>
|
||||||
<td class="multi-select">
|
<td class="multi-select">
|
||||||
{{#if isExternal}}
|
{{#if this.isExternal}}
|
||||||
—
|
—
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each field.serializers as |serializer|}}
|
{{#each this.field.serializers as |serializer|}}
|
||||||
<label>{{serializer}}</label>
|
<label>{{serializer}}</label>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
{{#if isExternal}}
|
{{#if this.isExternal}}
|
||||||
<td class="external">
|
<td class="external">
|
||||||
<label title={{i18n "admin.wizard.custom_field.external.title"}}>
|
<label title={{i18n "admin.wizard.custom_field.external.title"}}>
|
||||||
{{i18n "admin.wizard.custom_field.external.label"}}
|
{{i18n "admin.wizard.custom_field.external.label"}}
|
|
@ -1,6 +1,6 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
|
||||||
import { alias, equal, or } from "@ember/object/computed";
|
import { alias, equal, or } from "@ember/object/computed";
|
||||||
|
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
@ -17,6 +17,7 @@ export default Component.extend({
|
||||||
isExternal: equal("field.id", "external"),
|
isExternal: equal("field.id", "external"),
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
this.set("originalField", JSON.parse(JSON.stringify(this.field)));
|
this.set("originalField", JSON.parse(JSON.stringify(this.field)));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -119,7 +120,12 @@ export default Component.extend({
|
||||||
} else {
|
} else {
|
||||||
this.set("saveIcon", "times");
|
this.set("saveIcon", "times");
|
||||||
}
|
}
|
||||||
setTimeout(() => this.set("saveIcon", null), 10000);
|
setTimeout(() => {
|
||||||
|
if (this.isDestroyed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.set("saveIcon", null);
|
||||||
|
}, 10000);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
|
@ -1,13 +1,14 @@
|
||||||
|
import { isEmpty } from "@ember/utils";
|
||||||
|
import Handlebars from "handlebars";
|
||||||
|
import $ from "jquery";
|
||||||
|
import TextField from "discourse/components/text-field";
|
||||||
|
import { renderAvatar } from "discourse/helpers/user-avatar";
|
||||||
|
import userSearch from "discourse/lib/user-search";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
observes,
|
observes,
|
||||||
} from "discourse-common/utils/decorators";
|
} from "discourse-common/utils/decorators";
|
||||||
import { renderAvatar } from "discourse/helpers/user-avatar";
|
|
||||||
import userSearch from "discourse/lib/user-search";
|
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Handlebars from "handlebars";
|
|
||||||
import { isEmpty } from "@ember/utils";
|
|
||||||
import TextField from "discourse/components/text-field";
|
|
||||||
|
|
||||||
const template = function (params) {
|
const template = function (params) {
|
||||||
const options = params.options;
|
const options = params.options;
|
|
@ -1,6 +1,6 @@
|
||||||
import CategorySelector from "select-kit/components/category-selector";
|
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import CategorySelector from "select-kit/components/category-selector";
|
||||||
|
|
||||||
export default CategorySelector.extend({
|
export default CategorySelector.extend({
|
||||||
classNames: ["category-selector", "wizard-category-selector"],
|
classNames: ["category-selector", "wizard-category-selector"],
|
|
@ -1,21 +1,21 @@
|
||||||
<div class={{this.fieldClass}}>
|
<div class={{this.fieldClass}}>
|
||||||
<DEditor
|
<DEditor
|
||||||
@tabindex={{field.tabindex}}
|
@tabindex={{this.field.tabindex}}
|
||||||
@value={{composer.reply}}
|
@value={{this.composer.reply}}
|
||||||
@placeholderOverride={{replyPlaceholder}}
|
@placeholderOverride={{this.replyPlaceholder}}
|
||||||
@previewUpdated={{this.previewUpdated}}
|
@previewUpdated={{this.previewUpdated}}
|
||||||
@markdownOptions={{markdownOptions}}
|
@markdownOptions={{this.markdownOptions}}
|
||||||
@extraButtons={{this.extraButtons}}
|
@extraButtons={{this.extraButtons}}
|
||||||
@importQuote={{this.importQuote}}
|
@importQuote={{this.importQuote}}
|
||||||
@showUploadModal={{this.showUploadModal}}
|
@showUploadModal={{this.showUploadModal}}
|
||||||
@togglePreview={{this.togglePreview}}
|
@togglePreview={{this.togglePreview}}
|
||||||
@validation={{validation}}
|
@validation={{this.validation}}
|
||||||
@loading={{composer.loading}}
|
@loading={{this.composer.loading}}
|
||||||
@showLink={{showLink}}
|
@showLink={{this.showLink}}
|
||||||
@wizardComposer={{true}}
|
@wizardComposer={{true}}
|
||||||
@fieldId={{field.id}}
|
@fieldId={{this.field.id}}
|
||||||
@disabled={{disableTextarea}}
|
@disabled={{this.disableTextarea}}
|
||||||
@outletArgs={{hash composer=composer editorType="composer"}}
|
@outletArgs={{hash composer=this.composer editorType="composer"}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<input
|
<input
|
|
@ -1,11 +1,11 @@
|
||||||
import ComposerEditor from "discourse/components/composer-editor";
|
|
||||||
import discourseComputed, { bind } from "discourse-common/utils/decorators";
|
|
||||||
import { alias } from "@ember/object/computed";
|
|
||||||
import { uploadIcon } from "discourse/lib/uploads";
|
|
||||||
import { dasherize } from "@ember/string";
|
|
||||||
import InsertHyperlink from "discourse/components/modal/insert-hyperlink";
|
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
|
import { alias } from "@ember/object/computed";
|
||||||
|
import { service } from "@ember/service";
|
||||||
|
import { dasherize } from "@ember/string";
|
||||||
|
import ComposerEditor from "discourse/components/composer-editor";
|
||||||
|
import InsertHyperlink from "discourse/components/modal/insert-hyperlink";
|
||||||
|
import { uploadIcon } from "discourse/lib/uploads";
|
||||||
|
import discourseComputed, { bind } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export const wizardComposerEdtiorEventPrefix = "wizard-editor";
|
export const wizardComposerEdtiorEventPrefix = "wizard-editor";
|
||||||
|
|
||||||
|
@ -33,6 +33,9 @@ export default class CustomWizardComposerEditor extends ComposerEditor {
|
||||||
this.field.type
|
this.field.type
|
||||||
)}-${dasherize(this.field.id)} .d-editor-input`;
|
)}-${dasherize(this.field.id)} .d-editor-input`;
|
||||||
this.uppyComposerUpload.composerModel = this.composer;
|
this.uppyComposerUpload.composerModel = this.composer;
|
||||||
|
if (!this.currentUser) {
|
||||||
|
this.currentUser = {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@discourseComputed
|
@discourseComputed
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
{{#unless this.timeFirst}}
|
||||||
|
{{custom-wizard-date-input
|
||||||
|
date=this.date
|
||||||
|
relativeDate=this.relativeDate
|
||||||
|
onChange=(action "onChangeDate")
|
||||||
|
tabindex=this.dateTabindex
|
||||||
|
}}
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
|
{{#if this.showTime}}
|
||||||
|
{{custom-wizard-time-input
|
||||||
|
date=this.date
|
||||||
|
relativeDate=this.relativeDate
|
||||||
|
onChange=(action "onChangeTime")
|
||||||
|
tabindex=this.timeTabindex
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if this.timeFirst}}
|
||||||
|
{{custom-wizard-date-input
|
||||||
|
date=this.date
|
||||||
|
relativeDate=this.relativeDate
|
||||||
|
onChange=(action "onChangeDate")
|
||||||
|
tabindex=this.dateTabindex
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if this.clearable}}
|
||||||
|
{{d-button class="clear-date-time" icon="times" action=(action "onClear")}}
|
||||||
|
{{/if}}
|
|
@ -1,27 +1,29 @@
|
||||||
<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}}
|
{{#if this.showPreview}}
|
||||||
<div class="d-editor-preview-wrapper {{if forcePreview 'force-preview'}}">
|
<div
|
||||||
|
class="d-editor-preview-wrapper {{if this.forcePreview 'force-preview'}}"
|
||||||
|
>
|
||||||
<div class="d-editor-preview">
|
<div class="d-editor-preview">
|
||||||
{{html-safe preview}}
|
{{html-safe this.preview}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="d-editor-textarea-wrapper">
|
<div class="d-editor-textarea-wrapper">
|
||||||
<div class="d-editor-button-bar">
|
<div class="d-editor-button-bar">
|
||||||
{{#each toolbar.groups as |group|}}
|
{{#each this.toolbar.groups as |group|}}
|
||||||
{{#each group.buttons as |b|}}
|
{{#each group.buttons as |b|}}
|
||||||
{{#if b.popupMenu}}
|
{{#if b.popupMenu}}
|
||||||
{{toolbar-popup-menu-options
|
{{toolbar-popup-menu-options
|
||||||
onPopupMenuAction=onPopupMenuAction
|
onPopupMenuAction=this.onPopupMenuAction
|
||||||
onExpand=(action b.action b)
|
onExpand=(action b.action b)
|
||||||
class=b.className
|
class=b.className
|
||||||
content=popupMenuOptions
|
content=this.popupMenuOptions
|
||||||
options=(hash popupTitle=b.title icon=b.icon)
|
options=(hash popupTitle=b.title icon=b.icon)
|
||||||
}}
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<div>{{d.icon}}</div>
|
<div>{{b.icon}}</div>
|
||||||
<button
|
<button
|
||||||
class="wizard-btn {{b.className}}"
|
class="wizard-btn {{b.className}}"
|
||||||
{{action b.action b}}
|
{{action b.action b}}
|
||||||
|
@ -42,7 +44,7 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{conditional-loading-spinner condition=loading}}
|
{{conditional-loading-spinner condition=this.loading}}
|
||||||
<Textarea
|
<Textarea
|
||||||
tabindex={{this.tabindex}}
|
tabindex={{this.tabindex}}
|
||||||
@value={{this.value}}
|
@value={{this.value}}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{{custom-wizard-category-selector
|
||||||
|
categories=this.categories
|
||||||
|
class=this.fieldClass
|
||||||
|
whitelist=this.field.content
|
||||||
|
onChange=(action (mut this.categories))
|
||||||
|
tabindex=this.field.tabindex
|
||||||
|
options=(hash maximum=this.field.limit)
|
||||||
|
}}
|
|
@ -1,11 +1,12 @@
|
||||||
import { observes } from "discourse-common/utils/decorators";
|
|
||||||
import Category from "discourse/models/category";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import Category from "discourse/models/category";
|
||||||
|
import { observes } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
categories: [],
|
categories: [],
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
const property = this.field.property || "id";
|
const property = this.field.property || "id";
|
||||||
const value = this.field.value;
|
const value = this.field.value;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="wizard-composer-preview d-editor-preview-wrapper">
|
<div class="wizard-composer-preview d-editor-preview-wrapper">
|
||||||
<div class="d-editor-preview">
|
<div class="d-editor-preview">
|
||||||
{{html-safe field.preview_template}}
|
{{html-safe this.field.preview_template}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,9 +1,10 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { loadOneboxes } from "discourse/lib/load-oneboxes";
|
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import $ from "jquery";
|
||||||
import { resolveAllShortUrls } from "pretty-text/upload-short-url";
|
import { resolveAllShortUrls } from "pretty-text/upload-short-url";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
import { loadOneboxes } from "discourse/lib/load-oneboxes";
|
||||||
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
import { on } from "discourse-common/utils/decorators";
|
import { on } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
|
@ -14,10 +14,10 @@
|
||||||
<DButton
|
<DButton
|
||||||
@action={{this.togglePreview}}
|
@action={{this.togglePreview}}
|
||||||
class="wizard-btn toggle-preview"
|
class="wizard-btn toggle-preview"
|
||||||
@label={{togglePreviewLabel}}
|
@label={{this.togglePreviewLabel}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{{#if this.field.char_counter}}
|
{{#if this.field.char_counter}}
|
||||||
{{wizard-char-counter this.field.value field.max_length}}
|
{{wizard-char-counter this.field.value this.field.max_length}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
|
@ -1,9 +1,9 @@
|
||||||
|
import Component from "@ember/component";
|
||||||
|
import EmberObject, { action } from "@ember/object";
|
||||||
import {
|
import {
|
||||||
default as computed,
|
default as computed,
|
||||||
observes,
|
observes,
|
||||||
} from "discourse-common/utils/decorators";
|
} from "discourse-common/utils/decorators";
|
||||||
import Component from "@ember/component";
|
|
||||||
import EmberObject, { action } from "@ember/object";
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
showPreview: false,
|
showPreview: false,
|
||||||
|
@ -19,6 +19,7 @@ export default Component.extend({
|
||||||
EmberObject.create({
|
EmberObject.create({
|
||||||
loading: false,
|
loading: false,
|
||||||
reply: this.get("field.value") || "",
|
reply: this.get("field.value") || "",
|
||||||
|
afterRefresh: () => {},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
},
|
},
|
|
@ -1,5 +1,5 @@
|
||||||
{{custom-wizard-date-time-input
|
{{custom-wizard-date-time-input
|
||||||
date=dateTime
|
date=this.dateTime
|
||||||
onChange=(action "onChange")
|
onChange=(action "onChange")
|
||||||
tabindex=field.tabindex
|
tabindex=this.field.tabindex
|
||||||
}}
|
}}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{{custom-wizard-date-input
|
||||||
|
date=this.date
|
||||||
|
onChange=(action "onChange")
|
||||||
|
tabindex=this.field.tabindex
|
||||||
|
format=this.field.format
|
||||||
|
}}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{{combo-box
|
||||||
|
class=this.fieldClass
|
||||||
|
value=this.field.value
|
||||||
|
content=this.field.content
|
||||||
|
tabindex=this.field.tabindex
|
||||||
|
onChange=(action "onChangeValue")
|
||||||
|
options=(hash none="select_kit.default_header_text")
|
||||||
|
}}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{{custom-wizard-group-selector
|
||||||
|
groups=this.site.groups
|
||||||
|
class=this.fieldClass
|
||||||
|
field=this.field
|
||||||
|
whitelist=this.field.content
|
||||||
|
value=this.field.value
|
||||||
|
tabindex=this.field.tabindex
|
||||||
|
onChange=(action (mut this.field.value))
|
||||||
|
options=(hash none="select_kit.default_header_text")
|
||||||
|
}}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{{custom-wizard-tag-chooser
|
||||||
|
tags=this.field.value
|
||||||
|
class=this.fieldClass
|
||||||
|
tabindex=this.field.tabindex
|
||||||
|
tagGroups=this.field.tag_groups
|
||||||
|
everyTag=true
|
||||||
|
options=(hash maximum=this.field.limit allowAny=this.field.can_create_tag)
|
||||||
|
}}
|
|
@ -1,5 +1,5 @@
|
||||||
{{custom-wizard-time-input
|
{{custom-wizard-time-input
|
||||||
date=time
|
date=this.time
|
||||||
onChange=(action "onChange")
|
onChange=(action "onChange")
|
||||||
tabindex=field.tabindex
|
tabindex=this.field.tabindex
|
||||||
}}
|
}}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{{custom-wizard-topic-selector
|
||||||
|
topics=this.topics
|
||||||
|
category=this.field.category
|
||||||
|
onChange=(action "setValue")
|
||||||
|
options=(hash maximum=this.field.limit)
|
||||||
|
}}
|
|
@ -4,6 +4,7 @@ export default Component.extend({
|
||||||
topics: [],
|
topics: [],
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
const value = this.field.value;
|
const value = this.field.value;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
|
@ -1,10 +1,10 @@
|
||||||
import UppyUpload from "discourse/lib/uppy/uppy-upload";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { action } from "@ember/object";
|
||||||
import { getOwner } from "@ember/owner";
|
import { getOwner } from "@ember/owner";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
|
import UppyUpload from "discourse/lib/uppy/uppy-upload";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "discourse-i18n";
|
import I18n from "discourse-i18n";
|
||||||
import { action } from "@ember/object";
|
|
||||||
|
|
||||||
export default class CustomWizardFieldUpload extends Component {
|
export default class CustomWizardFieldUpload extends Component {
|
||||||
@service siteSettings;
|
@service siteSettings;
|
|
@ -0,0 +1,5 @@
|
||||||
|
{{custom-user-selector
|
||||||
|
usernames=this.field.value
|
||||||
|
placeholderKey=this.field.placeholder
|
||||||
|
tabindex=this.field.tabindex
|
||||||
|
}}
|
38
assets/javascripts/discourse/components/custom-wizard-field.hbs
Normale Datei
38
assets/javascripts/discourse/components/custom-wizard-field.hbs
Normale Datei
|
@ -0,0 +1,38 @@
|
||||||
|
<label for={{this.field.id}} class="field-label">
|
||||||
|
{{html-safe this.field.translatedLabel}}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
{{#if this.field.image}}
|
||||||
|
<div class="field-image"><img src={{this.field.image}} /></div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if this.field.description}}
|
||||||
|
<div class="field-description">{{this.cookedDescription}}</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#field-validators field=this.field as |validators|}}
|
||||||
|
{{#if this.inputComponentName}}
|
||||||
|
<div class="input-area">
|
||||||
|
{{component
|
||||||
|
this.inputComponentName
|
||||||
|
field=this.field
|
||||||
|
step=this.step
|
||||||
|
fieldClass=this.fieldClass
|
||||||
|
wizard=this.wizard
|
||||||
|
autocomplete=validators.autocomplete
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/field-validators}}
|
||||||
|
|
||||||
|
{{#if this.field.char_counter}}
|
||||||
|
{{#if this.textType}}
|
||||||
|
{{wizard-char-counter this.field.value this.field.max_length}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if this.field.errorDescription}}
|
||||||
|
<div class="field-error-description">{{html-safe
|
||||||
|
this.field.errorDescription
|
||||||
|
}}</div>
|
||||||
|
{{/if}}
|
|
@ -1,7 +1,7 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { dasherize } from "@ember/string";
|
import { dasherize } from "@ember/string";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import { cook } from "discourse/lib/text";
|
import { cook } from "discourse/lib/text";
|
||||||
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [
|
classNameBindings: [
|
|
@ -1,6 +1,6 @@
|
||||||
import ComboBox from "select-kit/components/combo-box";
|
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import ComboBox from "select-kit/components/combo-box";
|
||||||
|
|
||||||
export default ComboBox.extend({
|
export default ComboBox.extend({
|
||||||
content: computed("groups.[]", "field.content.[]", function () {
|
content: computed("groups.[]", "field.content.[]", function () {
|
|
@ -1,9 +1,9 @@
|
||||||
<div>{{text}}</div>
|
<div>{{this.text}}</div>
|
||||||
<div class="no-access-gutter">
|
<div class="no-access-gutter">
|
||||||
<a class="return-to-site" {{action "skip"}} role="button">
|
<a class="return-to-site" {{action "skip"}} role="button">
|
||||||
{{i18n "wizard.return_to_site" siteName=siteName}}
|
{{i18n "wizard.return_to_site" siteName=this.siteName}}
|
||||||
</a>
|
</a>
|
||||||
{{#if showLoginButton}}
|
{{#if this.showLoginButton}}
|
||||||
<DButton
|
<DButton
|
||||||
class="btn-primary btn-small login-button"
|
class="btn-primary btn-small login-button"
|
||||||
@action={{action "showLogin"}}
|
@action={{action "showLogin"}}
|
|
@ -1,10 +1,10 @@
|
||||||
import CustomWizard from "../models/custom-wizard";
|
import { getOwner } from "@ember/application";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { dasherize } from "@ember/string";
|
import { dasherize } from "@ember/string";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
|
||||||
import cookie from "discourse/lib/cookie";
|
import cookie from "discourse/lib/cookie";
|
||||||
import { getOwner } from "@ember/application";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
import CustomWizard from "../models/custom-wizard";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [":wizard-no-access", "reasonClass"],
|
classNameBindings: [":wizard-no-access", "reasonClass"],
|
|
@ -0,0 +1,6 @@
|
||||||
|
<a href={{this.topic.url}} target="_blank" rel="noopener noreferrer">
|
||||||
|
<span class="title">{{html-safe this.topic.fancy_title}}</span>
|
||||||
|
<div class="blurb"><RelativeDate @date={{@topic.created_at}} />
|
||||||
|
-
|
||||||
|
{{html-safe this.topic.blurb}}</div>
|
||||||
|
</a>
|
|
@ -1,6 +1,6 @@
|
||||||
{{#if showTopics}}
|
{{#if this.showTopics}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#each topics as |topic|}}
|
{{#each this.topics as |topic|}}
|
||||||
<li>{{custom-wizard-similar-topic topic=topic}}</li>
|
<li>{{custom-wizard-similar-topic topic=topic}}</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
|
@ -1,5 +1,6 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { bind } from "@ember/runloop";
|
import { bind } from "@ember/runloop";
|
||||||
|
import $ from "jquery";
|
||||||
import { observes } from "discourse-common/utils/decorators";
|
import { observes } from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
|
@ -7,10 +8,12 @@ export default Component.extend({
|
||||||
showTopics: true,
|
showTopics: true,
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
$(document).on("click", bind(this, this.documentClick));
|
$(document).on("click", bind(this, this.documentClick));
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
$(document).off("click", bind(this, this.documentClick));
|
$(document).off("click", bind(this, this.documentClick));
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
<div class="wizard-step-contents">
|
<div class="wizard-step-contents">
|
||||||
{{#if step.title}}
|
{{#if this.step.title}}
|
||||||
<h1 class="wizard-step-title">{{cookedTitle}}</h1>
|
<h1 class="wizard-step-title">{{this.cookedTitle}}</h1>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if bannerImage}}
|
{{#if this.bannerImage}}
|
||||||
<div class="wizard-step-banner">
|
<div class="wizard-step-banner">
|
||||||
<img src={{bannerImage}} />
|
<img src={{this.bannerImage}} />
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if step.description}}
|
{{#if this.step.description}}
|
||||||
<div class="wizard-step-description">{{cookedDescription}}</div>
|
<div class="wizard-step-description">{{this.cookedDescription}}</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#custom-wizard-step-form step=step}}
|
{{#custom-wizard-step-form step=this.step}}
|
||||||
{{#each step.fields as |field|}}
|
{{#each this.step.fields as |field|}}
|
||||||
{{custom-wizard-field field=field step=step wizard=wizard}}
|
{{custom-wizard-field field=field step=this.step wizard=this.wizard}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/custom-wizard-step-form}}
|
{{/custom-wizard-step-form}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,57 +24,57 @@
|
||||||
|
|
||||||
<div class="wizard-progress">
|
<div class="wizard-progress">
|
||||||
<div class="white"></div>
|
<div class="white"></div>
|
||||||
<div class="black" style={{barStyle}}></div>
|
<div class="black" style={{this.barStyle}}></div>
|
||||||
<div class="screen"></div>
|
<div class="screen"></div>
|
||||||
<span>{{i18n
|
<span>{{i18n
|
||||||
"wizard.step"
|
"wizard.step"
|
||||||
current=step.displayIndex
|
current=this.step.displayIndex
|
||||||
total=wizard.totalSteps
|
total=this.wizard.totalSteps
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="wizard-buttons">
|
<div class="wizard-buttons">
|
||||||
{{#if saving}}
|
{{#if this.saving}}
|
||||||
{{loading-spinner size="small"}}
|
{{loading-spinner size="small"}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if showQuitButton}}
|
{{#if this.showQuitButton}}
|
||||||
<a
|
<a
|
||||||
href
|
href
|
||||||
{{action "quit"}}
|
{{action "quit"}}
|
||||||
class="action-link quit"
|
class="action-link quit"
|
||||||
tabindex={{secondaryButtonIndex}}
|
tabindex={{this.secondaryButtonIndex}}
|
||||||
>{{i18n "wizard.quit"}}</a>
|
>{{i18n "wizard.quit"}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if showBackButton}}
|
{{#if this.showBackButton}}
|
||||||
<a
|
<a
|
||||||
href
|
href
|
||||||
{{action "backStep"}}
|
{{action "backStep"}}
|
||||||
class="action-link back"
|
class="action-link back"
|
||||||
tabindex={{secondaryButtonIndex}}
|
tabindex={{this.secondaryButtonIndex}}
|
||||||
>{{i18n "wizard.back"}}</a>
|
>{{i18n "wizard.back"}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showNextButton}}
|
{{#if this.showNextButton}}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="wizard-btn next primary"
|
class="wizard-btn next primary"
|
||||||
{{action "nextStep"}}
|
{{action "nextStep"}}
|
||||||
disabled={{btnsDisabled}}
|
disabled={{this.btnsDisabled}}
|
||||||
tabindex={{primaryButtonIndex}}
|
tabindex={{this.primaryButtonIndex}}
|
||||||
>
|
>
|
||||||
{{i18n "wizard.next"}}
|
{{i18n "wizard.next"}}
|
||||||
{{d-icon "chevron-right"}}
|
{{d-icon "chevron-right"}}
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showDoneButton}}
|
{{#if this.showDoneButton}}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="wizard-btn done"
|
class="wizard-btn done"
|
||||||
{{action "done"}}
|
{{action "done"}}
|
||||||
disabled={{btnsDisabled}}
|
disabled={{this.btnsDisabled}}
|
||||||
tabindex={{primaryButtonIndex}}
|
tabindex={{this.primaryButtonIndex}}
|
||||||
>
|
>
|
||||||
{{i18n "wizard.done_custom"}}
|
{{i18n "wizard.done_custom"}}
|
||||||
</button>
|
</button>
|
|
@ -1,14 +1,15 @@
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import getUrl from "discourse-common/lib/get-url";
|
import { alias, not, or } from "@ember/object/computed";
|
||||||
import { htmlSafe } from "@ember/template";
|
|
||||||
import { schedule } from "@ember/runloop";
|
import { schedule } from "@ember/runloop";
|
||||||
|
import { htmlSafe } from "@ember/template";
|
||||||
|
import $ from "jquery";
|
||||||
import { cook } from "discourse/lib/text";
|
import { cook } from "discourse/lib/text";
|
||||||
|
import getUrl from "discourse-common/lib/get-url";
|
||||||
|
import discourseLater from "discourse-common/lib/later";
|
||||||
|
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||||
import CustomWizard, {
|
import CustomWizard, {
|
||||||
updateCachedWizard,
|
updateCachedWizard,
|
||||||
} from "discourse/plugins/discourse-custom-wizard/discourse/models/custom-wizard";
|
} from "discourse/plugins/discourse-custom-wizard/discourse/models/custom-wizard";
|
||||||
import { alias, not, or } from "@ember/object/computed";
|
|
||||||
import discourseLater from "discourse-common/lib/later";
|
|
||||||
import { wizardComposerEdtiorEventPrefix } from "./custom-wizard-composer-editor";
|
import { wizardComposerEdtiorEventPrefix } from "./custom-wizard-composer-editor";
|
||||||
|
|
||||||
const uploadStartedEventKeys = ["upload-started"];
|
const uploadStartedEventKeys = ["upload-started"];
|
||||||
|
@ -181,7 +182,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
showMessage(message) {
|
showMessage(message) {
|
||||||
this.sendAction(message);
|
this.showMessage(message);
|
||||||
},
|
},
|
||||||
|
|
||||||
stylingDropdownChanged(id, value) {
|
stylingDropdownChanged(id, value) {
|
|
@ -1,5 +1,5 @@
|
||||||
import TagChooser from "select-kit/components/tag-chooser";
|
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import TagChooser from "select-kit/components/tag-chooser";
|
||||||
|
|
||||||
export default TagChooser.extend({
|
export default TagChooser.extend({
|
||||||
_transformJson(context, json) {
|
_transformJson(context, json) {
|
|
@ -1,7 +1,7 @@
|
||||||
import computed from "discourse-common/utils/decorators";
|
|
||||||
import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction";
|
|
||||||
import I18n from "I18n";
|
|
||||||
import TextField from "discourse/components/text-field";
|
import TextField from "discourse/components/text-field";
|
||||||
|
import { isLTR, isRTL, siteDir } from "discourse/lib/text-direction";
|
||||||
|
import computed from "discourse-common/utils/decorators";
|
||||||
|
import I18n from "I18n";
|
||||||
|
|
||||||
export default TextField.extend({
|
export default TextField.extend({
|
||||||
attributeBindings: [
|
attributeBindings: [
|
|
@ -0,0 +1,40 @@
|
||||||
|
import TextareaEditor from "discourse/components/composer/textarea-editor";
|
||||||
|
|
||||||
|
export default class CustomWizardTextareaEditor extends TextareaEditor {
|
||||||
|
setupSmartList() {
|
||||||
|
// These must be bound manually because itsatrap does not support
|
||||||
|
// beforeinput or input events.
|
||||||
|
//
|
||||||
|
// beforeinput is better used to detect line breaks because it is
|
||||||
|
// fired before the actual value of the textarea is changed,
|
||||||
|
// and sometimes in the input event no `insertLineBreak` event type
|
||||||
|
// is fired.
|
||||||
|
//
|
||||||
|
// c.f. https://developer.mozilla.org/en-US/docs/Web/API/Element/beforeinput_event
|
||||||
|
if (this.currentUser?.user_option.enable_smart_lists) {
|
||||||
|
this.textarea.addEventListener(
|
||||||
|
"beforeinput",
|
||||||
|
this.onBeforeInputSmartList
|
||||||
|
);
|
||||||
|
this.textarea.addEventListener(
|
||||||
|
"keydown",
|
||||||
|
this.onBeforeInputSmartListShiftDetect
|
||||||
|
);
|
||||||
|
this.textarea.addEventListener("input", this.onInputSmartList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
destroySmartList() {
|
||||||
|
if (this.currentUser?.user_option.enable_smart_lists) {
|
||||||
|
this.textarea.removeEventListener(
|
||||||
|
"beforeinput",
|
||||||
|
this.onBeforeInputSmartList
|
||||||
|
);
|
||||||
|
this.textarea.removeEventListener(
|
||||||
|
"keydown",
|
||||||
|
this.onBeforeInputSmartListShiftDetect
|
||||||
|
);
|
||||||
|
this.textarea.removeEventListener("input", this.onInputSmartList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=time
|
value=this.time
|
||||||
content=timeOptions
|
content=this.timeOptions
|
||||||
tabindex=tabindex
|
tabindex=this.tabindex
|
||||||
onChange=(action "onChangeTime")
|
onChange=(action "onChangeTime")
|
||||||
options=(hash
|
options=(hash
|
||||||
translatedNone="--:--"
|
translatedNone="--:--"
|
|
@ -1,7 +1,7 @@
|
||||||
import MultiSelectComponent from "select-kit/components/multi-select";
|
|
||||||
import { isEmpty } from "@ember/utils";
|
import { isEmpty } from "@ember/utils";
|
||||||
import { searchForTerm } from "discourse/lib/search";
|
import { searchForTerm } from "discourse/lib/search";
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
|
import MultiSelectComponent from "select-kit/components/multi-select";
|
||||||
|
|
||||||
export default MultiSelectComponent.extend({
|
export default MultiSelectComponent.extend({
|
||||||
classNames: ["topic-selector", "wizard-topic-selector"],
|
classNames: ["topic-selector", "wizard-topic-selector"],
|
|
@ -1,8 +1,8 @@
|
||||||
{{#if field.validations}}
|
{{#if this.field.validations}}
|
||||||
{{#each-in field.validations.above as |type validation|}}
|
{{#each-in this.field.validations.above as |type validation|}}
|
||||||
{{component
|
{{component
|
||||||
validation.component
|
validation.component
|
||||||
field=field
|
field=this.field
|
||||||
type=type
|
type=type
|
||||||
validation=validation
|
validation=validation
|
||||||
}}
|
}}
|
||||||
|
@ -10,10 +10,10 @@
|
||||||
|
|
||||||
{{yield (hash perform=(action "perform") autocomplete="off")}}
|
{{yield (hash perform=(action "perform") autocomplete="off")}}
|
||||||
|
|
||||||
{{#each-in field.validations.below as |type validation|}}
|
{{#each-in this.field.validations.below as |type validation|}}
|
||||||
{{component
|
{{component
|
||||||
validation.component
|
validation.component
|
||||||
field=field
|
field=this.field
|
||||||
type=type
|
type=type
|
||||||
validation=validation
|
validation=validation
|
||||||
}}
|
}}
|
|
@ -1,5 +1,5 @@
|
||||||
<DModal @closeModal={{@closeModal}} @title={{this.title}}>
|
<DModal @closeModal={{@closeModal}} @title={{this.title}}>
|
||||||
{{#if loading}}
|
{{#if this.loading}}
|
||||||
<LoadingSpinner size="large" />
|
<LoadingSpinner size="large" />
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="edit-directory-columns-container">
|
<div class="edit-directory-columns-container">
|
||||||
|
|
13
assets/javascripts/discourse/components/similar-topics-validator.hbs
Normale Datei
13
assets/javascripts/discourse/components/similar-topics-validator.hbs
Normale Datei
|
@ -0,0 +1,13 @@
|
||||||
|
<label class={{this.currentStateClass}}>
|
||||||
|
{{#if this.currentState}}
|
||||||
|
{{#if this.insufficientCharactersCategories}}
|
||||||
|
{{html-safe (i18n this.currentStateKey catLinks=this.catLinks)}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n this.currentStateKey}}
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
{{#if this.showSimilarTopics}}
|
||||||
|
{{custom-wizard-similar-topics topics=this.similarTopics}}
|
||||||
|
{{/if}}
|
|
@ -1,12 +1,12 @@
|
||||||
import WizardFieldValidator from "discourse/plugins/discourse-custom-wizard/discourse/components/validator";
|
|
||||||
import { deepMerge } from "discourse-common/lib/object";
|
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
|
||||||
import { cancel, later } from "@ember/runloop";
|
|
||||||
import { A } from "@ember/array";
|
import { A } from "@ember/array";
|
||||||
import EmberObject, { computed } from "@ember/object";
|
import EmberObject, { computed } from "@ember/object";
|
||||||
import { and, equal, notEmpty } from "@ember/object/computed";
|
import { and, equal, notEmpty } from "@ember/object/computed";
|
||||||
import { categoryBadgeHTML } from "discourse/helpers/category-link";
|
import { cancel, later } from "@ember/runloop";
|
||||||
import { dasherize } from "@ember/string";
|
import { dasherize } from "@ember/string";
|
||||||
|
import { categoryBadgeHTML } from "discourse/helpers/category-link";
|
||||||
|
import { deepMerge } from "discourse-common/lib/object";
|
||||||
|
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
||||||
|
import WizardFieldValidator from "discourse/plugins/discourse-custom-wizard/discourse/components/validator";
|
||||||
|
|
||||||
export default WizardFieldValidator.extend({
|
export default WizardFieldValidator.extend({
|
||||||
classNames: ["similar-topics-validator"],
|
classNames: ["similar-topics-validator"],
|
5
assets/javascripts/discourse/components/validator.hbs
Normale Datei
5
assets/javascripts/discourse/components/validator.hbs
Normale Datei
|
@ -0,0 +1,5 @@
|
||||||
|
{{#if this.isValid}}
|
||||||
|
{{i18n this.validMessageKey}}
|
||||||
|
{{else}}
|
||||||
|
{{i18n this.invalidMessageKey}}
|
||||||
|
{{/if}}
|
|
@ -28,10 +28,12 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
this.appEvents.on("custom-wizard:validate", this, this.checkIsValid);
|
this.appEvents.on("custom-wizard:validate", this, this.checkIsValid);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
this.appEvents.off("custom-wizard:validate", this, this.checkIsValid);
|
this.appEvents.off("custom-wizard:validate", this, this.checkIsValid);
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{{#if showUndo}}
|
{{#if this.showUndo}}
|
||||||
{{d-button
|
{{d-button
|
||||||
action=(action "undoChanges")
|
action=(action "undoChanges")
|
||||||
icon=undoIcon
|
icon=this.undoIcon
|
||||||
label=undoKey
|
label=this.undoKey
|
||||||
class="undo-changes"
|
class="undo-changes"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
feature="action"
|
feature="action"
|
||||||
attribute="type"
|
attribute="type"
|
||||||
onChange=(action "changeType")
|
onChange=(action "changeType")
|
||||||
wizard=wizard
|
wizard=this.wizard
|
||||||
options=(hash none="admin.wizard.select_type")
|
options=(hash none="admin.wizard.select_type")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -32,15 +32,15 @@
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.run_after
|
value=this.action.run_after
|
||||||
content=runAfterContent
|
content=this.runAfterContent
|
||||||
onChange=(action (mut this.action.run_after))
|
onChange=(action (mut this.action.run_after))
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{wizard-message key=messageKey url=messageUrl component="action"}}
|
{{wizard-message key=this.messageKey url=this.messageUrl component="action"}}
|
||||||
|
|
||||||
{{#if basicTopicFields}}
|
{{#if this.basicTopicFields}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.title"}}</label>
|
<label>{{i18n "admin.wizard.action.title"}}</label>
|
||||||
|
@ -68,12 +68,12 @@
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.post
|
value=this.action.post
|
||||||
content=wizardFields
|
content=this.wizardFields
|
||||||
nameProperty="label"
|
nameProperty="label"
|
||||||
onChange=(action (mut this.action.post))
|
onChange=(action (mut this.action.post))
|
||||||
options=(hash
|
options=(hash
|
||||||
none="admin.wizard.selector.placeholder.wizard_field"
|
none="admin.wizard.selector.placeholder.wizard_field"
|
||||||
isDisabled=showPostBuilder
|
isDisabled=this.showPostBuilder
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -93,14 +93,14 @@
|
||||||
<div class="setting-value editor">
|
<div class="setting-value editor">
|
||||||
{{wizard-text-editor
|
{{wizard-text-editor
|
||||||
value=this.action.post_template
|
value=this.action.post_template
|
||||||
wizardFields=wizardFields
|
wizardFields=this.wizardFields
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if publicTopicFields}}
|
{{#if this.publicTopicFields}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.create_topic.category"}}</label>
|
<label>{{i18n "admin.wizard.action.create_topic.category"}}</label>
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if hasEventField}}
|
{{#if this.hasEventField}}
|
||||||
<div class="setting full">
|
<div class="setting full">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.create_topic.add_event"}}</label>
|
<label>{{i18n "admin.wizard.action.create_topic.add_event"}}</label>
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if hasLocationField}}
|
{{#if this.hasLocationField}}
|
||||||
<div class="setting full">
|
<div class="setting full">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.create_topic.add_location"}}</label>
|
<label>{{i18n "admin.wizard.action.create_topic.add_location"}}</label>
|
||||||
|
@ -198,7 +198,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if sendMessage}}
|
{{#if this.sendMessage}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.send_message.recipient"}}</label>
|
<label>{{i18n "admin.wizard.action.send_message.recipient"}}</label>
|
||||||
|
@ -224,7 +224,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if updateProfile}}
|
{{#if this.updateProfile}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.update_profile.setting"}}</label>
|
<label>{{i18n "admin.wizard.action.update_profile.setting"}}</label>
|
||||||
|
@ -247,7 +247,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if sendToApi}}
|
{{#if this.sendToApi}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.send_to_api.api"}}</label>
|
<label>{{i18n "admin.wizard.action.send_to_api.api"}}</label>
|
||||||
|
@ -256,7 +256,7 @@
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.api
|
value=this.action.api
|
||||||
content=availableApis
|
content=this.availableApis
|
||||||
onChange=(action (mut this.action.api))
|
onChange=(action (mut this.action.api))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=this.action.custom_title_enabled
|
isDisabled=this.action.custom_title_enabled
|
||||||
|
@ -274,10 +274,10 @@
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.api_endpoint
|
value=this.action.api_endpoint
|
||||||
content=availableEndpoints
|
content=this.availableEndpoints
|
||||||
onChange=(action (mut this.action.api_endpoint))
|
onChange=(action (mut this.action.api_endpoint))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=apiEmpty
|
isDisabled=this.apiEmpty
|
||||||
none="admin.wizard.action.send_to_api.select_an_endpoint"
|
none="admin.wizard.action.send_to_api.select_an_endpoint"
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
@ -294,14 +294,14 @@
|
||||||
value=this.action.api_body
|
value=this.action.api_body
|
||||||
previewEnabled=false
|
previewEnabled=false
|
||||||
barEnabled=false
|
barEnabled=false
|
||||||
wizardFields=wizardFields
|
wizardFields=this.wizardFields
|
||||||
placeholder="admin.wizard.action.send_to_api.body_placeholder"
|
placeholder="admin.wizard.action.send_to_api.body_placeholder"
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if addToGroup}}
|
{{#if this.addToGroup}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.group"}}</label>
|
<label>{{i18n "admin.wizard.group"}}</label>
|
||||||
|
@ -326,7 +326,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if routeTo}}
|
{{#if this.routeTo}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.route_to.url"}}</label>
|
<label>{{i18n "admin.wizard.action.route_to.url"}}</label>
|
||||||
|
@ -350,7 +350,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if watchCategories}}
|
{{#if this.watchCategories}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.watch_categories.categories"}}</label>
|
<label>{{i18n "admin.wizard.action.watch_categories.categories"}}</label>
|
||||||
|
@ -404,7 +404,7 @@
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.notification_level
|
value=this.action.notification_level
|
||||||
content=availableNotificationLevels
|
content=this.availableNotificationLevels
|
||||||
onChange=(action (mut this.action.notification_level))
|
onChange=(action (mut this.action.notification_level))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=this.action.custom_title_enabled
|
isDisabled=this.action.custom_title_enabled
|
||||||
|
@ -445,7 +445,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if watchTags}}
|
{{#if this.watchTags}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.watch_tags.tags"}}</label>
|
<label>{{i18n "admin.wizard.action.watch_tags.tags"}}</label>
|
||||||
|
@ -478,7 +478,7 @@
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.notification_level
|
value=this.action.notification_level
|
||||||
content=availableNotificationLevels
|
content=this.availableNotificationLevels
|
||||||
onChange=(action (mut this.action.notification_level))
|
onChange=(action (mut this.action.notification_level))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=this.action.custom_title_enabled
|
isDisabled=this.action.custom_title_enabled
|
||||||
|
@ -519,7 +519,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if createGroup}}
|
{{#if this.createGroup}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.create_group.name"}}</label>
|
<label>{{i18n "admin.wizard.action.create_group.name"}}</label>
|
||||||
|
@ -743,7 +743,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if createCategory}}
|
{{#if this.createCategory}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.create_category.name"}}</label>
|
<label>{{i18n "admin.wizard.action.create_category.name"}}</label>
|
||||||
|
@ -871,7 +871,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if hasCustomFields}}
|
{{#if this.hasCustomFields}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.custom_fields.label"}}</label>
|
<label>{{i18n "admin.wizard.action.custom_fields.label"}}</label>
|
||||||
|
@ -889,14 +889,14 @@
|
||||||
wizardActionSelection="value"
|
wizardActionSelection="value"
|
||||||
userFieldSelection="value"
|
userFieldSelection="value"
|
||||||
keyPlaceholder="admin.wizard.action.custom_fields.key"
|
keyPlaceholder="admin.wizard.action.custom_fields.key"
|
||||||
context=customFieldsContext
|
context=this.customFieldsContext
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if sendMessage}}
|
{{#if this.sendMessage}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.required"}}</label>
|
<label>{{i18n "admin.wizard.required"}}</label>
|
||||||
|
@ -919,7 +919,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showPostAdvanced}}
|
{{#if this.showPostAdvanced}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.poster.label"}}</label>
|
<label>{{i18n "admin.wizard.action.poster.label"}}</label>
|
||||||
|
@ -994,7 +994,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if routeTo}}
|
{{#if this.routeTo}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.route_to.code"}}</label>
|
<label>{{i18n "admin.wizard.action.route_to.code"}}</label>
|
|
@ -1,10 +1,10 @@
|
||||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
|
||||||
import { empty, equal, or } from "@ember/object/computed";
|
|
||||||
import { notificationLevels, selectKitContent } from "../lib/wizard";
|
|
||||||
import { computed } from "@ember/object";
|
|
||||||
import UndoChanges from "../mixins/undo-changes";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { computed } from "@ember/object";
|
||||||
|
import { empty, equal, or } from "@ember/object/computed";
|
||||||
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { notificationLevels, selectKitContent } from "../lib/wizard";
|
||||||
|
import UndoChanges from "../mixins/undo-changes";
|
||||||
|
|
||||||
export default Component.extend(UndoChanges, {
|
export default Component.extend(UndoChanges, {
|
||||||
componentType: "action",
|
componentType: "action",
|
|
@ -1,8 +1,8 @@
|
||||||
{{#if showUndo}}
|
{{#if this.showUndo}}
|
||||||
{{d-button
|
{{d-button
|
||||||
action=(action "undoChanges")
|
action=(action "undoChanges")
|
||||||
icon=undoIcon
|
icon=this.undoIcon
|
||||||
label=undoKey
|
label=this.undoKey
|
||||||
class="undo-changes"
|
class="undo-changes"
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -42,12 +42,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{uppy-image-uploader
|
{{uppy-image-uploader
|
||||||
imageUrl=field.image
|
imageUrl=this.field.image
|
||||||
onUploadDone=(action "imageUploadDone")
|
onUploadDone=(action "imageUploadDone")
|
||||||
onUploadDeleted=(action "imageUploadDeleted")
|
onUploadDeleted=(action "imageUploadDeleted")
|
||||||
type="wizard-field-image"
|
type="wizard-field-image"
|
||||||
class="no-repeat contain-image"
|
class="no-repeat contain-image"
|
||||||
id=(concat "wizard-field-" field.id "-image-upload")
|
id=(concat "wizard-field-" this.field.id "-image-upload")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,19 +59,19 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-subscription-selector
|
{{wizard-subscription-selector
|
||||||
value=field.type
|
value=this.field.type
|
||||||
feature="field"
|
feature="field"
|
||||||
attribute="type"
|
attribute="type"
|
||||||
onChange=(action "changeType")
|
onChange=(action "changeType")
|
||||||
wizard=wizard
|
wizard=this.wizard
|
||||||
options=(hash none="admin.wizard.select_type")
|
options=(hash none="admin.wizard.select_type")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{wizard-message key=messageKey url=messageUrl component="field"}}
|
{{wizard-message key=this.messageKey url=this.messageUrl component="field"}}
|
||||||
|
|
||||||
{{#if isTextType}}
|
{{#if this.isTextType}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.min_length"}}</label>
|
<label>{{i18n "admin.wizard.field.min_length"}}</label>
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isComposerPreview}}
|
{{#if this.isComposerPreview}}
|
||||||
<div class="setting full">
|
<div class="setting full">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.preview_template"}}</label>
|
<label>{{i18n "admin.wizard.field.preview_template"}}</label>
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isUpload}}
|
{{#if this.isUpload}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.file_types"}}</label>
|
<label>{{i18n "admin.wizard.field.file_types"}}</label>
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showLimit}}
|
{{#if this.showLimit}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.limit"}}</label>
|
<label>{{i18n "admin.wizard.field.limit"}}</label>
|
||||||
|
@ -168,7 +168,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isDateTime}}
|
{{#if this.isDateTime}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{html-safe
|
<label>{{html-safe
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showPrefill}}
|
{{#if this.showPrefill}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.prefill"}}</label>
|
<label>{{i18n "admin.wizard.field.prefill"}}</label>
|
||||||
|
@ -193,16 +193,16 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=field.prefill
|
inputs=this.field.prefill
|
||||||
property="prefill"
|
property="prefill"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=prefillOptions
|
options=this.prefillOptions
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showContent}}
|
{{#if this.showContent}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.content"}}</label>
|
<label>{{i18n "admin.wizard.field.content"}}</label>
|
||||||
|
@ -210,16 +210,16 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=field.content
|
inputs=this.field.content
|
||||||
property="content"
|
property="content"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=contentOptions
|
options=this.contentOptions
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isTag}}
|
{{#if this.isTag}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.tag_groups"}}</label>
|
<label>{{i18n "admin.wizard.field.tag_groups"}}</label>
|
||||||
|
@ -227,9 +227,9 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{tag-group-chooser
|
{{tag-group-chooser
|
||||||
id=(concat field.id "-tag-groups")
|
id=(concat this.field.id "-tag-groups")
|
||||||
tagGroups=field.tag_groups
|
tagGroups=this.field.tag_groups
|
||||||
onChange=(action (mut field.tag_groups))
|
onChange=(action (mut this.field.tag_groups))
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -245,7 +245,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isTopic}}
|
{{#if this.isTopic}}
|
||||||
<div class="setting full field-mapper-setting">
|
<div class="setting full field-mapper-setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.category.label"}}</label>
|
<label>{{i18n "admin.wizard.field.category.label"}}</label>
|
||||||
|
@ -271,7 +271,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper inputs=field.condition options=fieldConditionOptions}}
|
{{wizard-mapper
|
||||||
|
inputs=this.field.condition
|
||||||
|
options=this.fieldConditionOptions
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -281,11 +284,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper inputs=field.index options=fieldIndexOptions}}
|
{{wizard-mapper inputs=this.field.index options=this.fieldIndexOptions}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if isCategory}}
|
{{#if this.isCategory}}
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.field.property"}}</label>
|
<label>{{i18n "admin.wizard.field.property"}}</label>
|
||||||
|
@ -293,16 +296,19 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=field.property
|
value=this.field.property
|
||||||
content=categoryPropertyTypes
|
content=this.categoryPropertyTypes
|
||||||
onChange=(action (mut field.property))
|
onChange=(action (mut this.field.property))
|
||||||
options=(hash none="admin.wizard.selector.placeholder.property")
|
options=(hash none="admin.wizard.selector.placeholder.property")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if validations}}
|
{{#if this.validations}}
|
||||||
{{wizard-realtime-validations field=field validations=validations}}
|
{{wizard-realtime-validations
|
||||||
|
field=this.field
|
||||||
|
validations=this.validations
|
||||||
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/wizard-subscription-container}}
|
{{/wizard-subscription-container}}
|
|
@ -1,10 +1,10 @@
|
||||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
|
||||||
import { equal, or } from "@ember/object/computed";
|
|
||||||
import { computed } from "@ember/object";
|
|
||||||
import { selectKitContent } from "../lib/wizard";
|
|
||||||
import UndoChanges from "../mixins/undo-changes";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { computed } from "@ember/object";
|
||||||
|
import { equal, or } from "@ember/object/computed";
|
||||||
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
|
import { selectKitContent } from "../lib/wizard";
|
||||||
import wizardSchema from "../lib/wizard-schema";
|
import wizardSchema from "../lib/wizard-schema";
|
||||||
|
import UndoChanges from "../mixins/undo-changes";
|
||||||
|
|
||||||
export default Component.extend(UndoChanges, {
|
export default Component.extend(UndoChanges, {
|
||||||
componentType: "field",
|
componentType: "field",
|
|
@ -13,12 +13,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{uppy-image-uploader
|
{{uppy-image-uploader
|
||||||
imageUrl=step.banner
|
imageUrl=this.step.banner
|
||||||
onUploadDone=(action "bannerUploadDone")
|
onUploadDone=(action "bannerUploadDone")
|
||||||
onUploadDeleted=(action "bannerUploadDeleted")
|
onUploadDeleted=(action "bannerUploadDeleted")
|
||||||
type="wizard-step-banner"
|
type="wizard-step-banner"
|
||||||
class="no-repeat contain-image"
|
class="no-repeat contain-image"
|
||||||
id=(concat "wizard-step-" step.id "-banner-upload")
|
id=(concat "wizard-step-" this.step.id "-banner-upload")
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<label>{{i18n "admin.wizard.step.description"}}</label>
|
<label>{{i18n "admin.wizard.step.description"}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-text-editor value=step.raw_description}}
|
{{wizard-text-editor value=this.step.raw_description}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -39,7 +39,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper inputs=step.condition options=stepConditionOptions}}
|
{{wizard-mapper
|
||||||
|
inputs=this.step.condition
|
||||||
|
options=this.stepConditionOptions
|
||||||
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -59,7 +62,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=step.required_data
|
inputs=this.step.required_data
|
||||||
options=(hash
|
options=(hash
|
||||||
inputTypes="validation"
|
inputTypes="validation"
|
||||||
inputConnector="and"
|
inputConnector="and"
|
||||||
|
@ -69,7 +72,7 @@
|
||||||
context="step"
|
context="step"
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
{{#if step.required_data}}
|
{{#if this.step.required_data}}
|
||||||
<div class="required-data-message">
|
<div class="required-data-message">
|
||||||
<div class="label">
|
<div class="label">
|
||||||
{{i18n "admin.wizard.step.required_data.not_permitted_message"}}
|
{{i18n "admin.wizard.step.required_data.not_permitted_message"}}
|
||||||
|
@ -86,7 +89,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=step.permitted_params
|
inputs=this.step.permitted_params
|
||||||
options=(hash
|
options=(hash
|
||||||
pairConnector="set"
|
pairConnector="set"
|
||||||
inputTypes="association"
|
inputTypes="association"
|
||||||
|
@ -101,20 +104,20 @@
|
||||||
|
|
||||||
{{wizard-links
|
{{wizard-links
|
||||||
itemType="field"
|
itemType="field"
|
||||||
current=currentField
|
current=this.currentField
|
||||||
items=step.fields
|
items=this.step.fields
|
||||||
parentId=step.id
|
parentId=this.step.id
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{#each step.fields as |field|}}
|
{{#each this.step.fields as |field|}}
|
||||||
{{wizard-custom-field
|
{{wizard-custom-field
|
||||||
field=field
|
field=field
|
||||||
step=step
|
step=this.step
|
||||||
wizard=wizard
|
wizard=this.wizard
|
||||||
currentFieldId=currentField.id
|
currentFieldId=this.currentField.id
|
||||||
fieldTypes=fieldTypes
|
fieldTypes=this.fieldTypes
|
||||||
removeField="removeField"
|
removeField="removeField"
|
||||||
wizardFields=wizardFields
|
wizardFields=this.wizardFields
|
||||||
subscribed=subscribed
|
subscribed=this.subscribed
|
||||||
}}
|
}}
|
||||||
{{/each}}
|
{{/each}}
|
|
@ -1,8 +1,8 @@
|
||||||
<div class="wizard-header medium">{{html-safe (i18n header)}}</div>
|
<div class="wizard-header medium">{{html-safe (i18n this.header)}}</div>
|
||||||
|
|
||||||
<div class="link-list">
|
<div class="link-list">
|
||||||
{{#if anyLinks}}
|
{{#if this.anyLinks}}
|
||||||
{{#each links as |link|}}
|
{{#each this.links as |link|}}
|
||||||
<div data-id={{link.id}}>
|
<div data-id={{link.id}}>
|
||||||
{{d-button
|
{{d-button
|
||||||
action=(action "change")
|
action=(action "change")
|
|
@ -1,13 +1,13 @@
|
||||||
|
import { A } from "@ember/array";
|
||||||
|
import Component from "@ember/component";
|
||||||
|
import EmberObject from "@ember/object";
|
||||||
|
import { notEmpty } from "@ember/object/computed";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { generateName } from "../lib/wizard";
|
import { generateName } from "../lib/wizard";
|
||||||
import {
|
import {
|
||||||
setWizardDefaults,
|
|
||||||
default as wizardSchema,
|
default as wizardSchema,
|
||||||
|
setWizardDefaults,
|
||||||
} from "../lib/wizard-schema";
|
} from "../lib/wizard-schema";
|
||||||
import { notEmpty } from "@ember/object/computed";
|
|
||||||
import EmberObject from "@ember/object";
|
|
||||||
import Component from "@ember/component";
|
|
||||||
import { A } from "@ember/array";
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [":wizard-links", "itemType"],
|
classNameBindings: [":wizard-links", "itemType"],
|
|
@ -1,13 +1,13 @@
|
||||||
{{#if hasMultiple}}
|
{{#if this.hasMultiple}}
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=connector
|
value=this.connector
|
||||||
content=connectors
|
content=this.connectors
|
||||||
onChange=(action "changeConnector")
|
onChange=(action "changeConnector")
|
||||||
}}
|
}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if connector}}
|
{{#if this.connector}}
|
||||||
<span class="connector-single">
|
<span class="connector-single">
|
||||||
{{connectorLabel}}
|
{{this.connectorLabel}}
|
||||||
</span>
|
</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
|
@ -1,9 +1,9 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { gt } from "@ember/object/computed";
|
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
import { defaultConnector } from "../lib/wizard-mapper";
|
import { gt } from "@ember/object/computed";
|
||||||
import { later } from "@ember/runloop";
|
import { later } from "@ember/runloop";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { defaultConnector } from "../lib/wizard-mapper";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [
|
classNameBindings: [
|
||||||
|
@ -19,6 +19,7 @@ export default Component.extend({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
this._super();
|
||||||
if (!this.connector) {
|
if (!this.connector) {
|
||||||
later(() => {
|
later(() => {
|
||||||
this.set(
|
this.set(
|
|
@ -8,7 +8,7 @@
|
||||||
onUpdate=this.onUpdate
|
onUpdate=this.onUpdate
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{#if hasPairs}}
|
{{#if this.hasPairs}}
|
||||||
<div class="mapper-pairs mapper-block">
|
<div class="mapper-pairs mapper-block">
|
||||||
{{#each this.input.pairs as |pair|}}
|
{{#each this.input.pairs as |pair|}}
|
||||||
{{wizard-mapper-pair
|
{{wizard-mapper-pair
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
}}
|
}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if canAddPair}}
|
{{#if this.canAddPair}}
|
||||||
<a role="button" {{action "addPair"}} class="add-pair">
|
<a role="button" {{action "addPair"}} class="add-pair">
|
||||||
{{d-icon "plus"}}
|
{{d-icon "plus"}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -29,8 +29,8 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if hasOutput}}
|
{{#if this.hasOutput}}
|
||||||
{{#if hasPairs}}
|
{{#if this.hasPairs}}
|
||||||
{{wizard-mapper-connector
|
{{wizard-mapper-connector
|
||||||
connector=this.input.output_connector
|
connector=this.input.output_connector
|
||||||
connectors=this.connectors
|
connectors=this.connectors
|
||||||
|
@ -53,6 +53,6 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<a role="button" class="remove-input" {{action remove this.input}}>
|
<a role="button" class="remove-input" {{action this.remove this.input}}>
|
||||||
{{d-icon "times"}}
|
{{d-icon "times"}}
|
||||||
</a>
|
</a>
|
|
@ -1,5 +1,8 @@
|
||||||
|
import { A } from "@ember/array";
|
||||||
|
import Component from "@ember/component";
|
||||||
import { computed, set } from "@ember/object";
|
import { computed, set } from "@ember/object";
|
||||||
import { alias, equal, not, or } from "@ember/object/computed";
|
import { alias, equal, not, or } from "@ember/object/computed";
|
||||||
|
import { observes } from "discourse-common/utils/decorators";
|
||||||
import {
|
import {
|
||||||
connectorContent,
|
connectorContent,
|
||||||
defaultConnector,
|
defaultConnector,
|
||||||
|
@ -7,9 +10,6 @@ import {
|
||||||
inputTypesContent,
|
inputTypesContent,
|
||||||
newPair,
|
newPair,
|
||||||
} from "../lib/wizard-mapper";
|
} from "../lib/wizard-mapper";
|
||||||
import Component from "@ember/component";
|
|
||||||
import { observes } from "discourse-common/utils/decorators";
|
|
||||||
import { A } from "@ember/array";
|
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [":mapper-input", "inputType"],
|
classNameBindings: [":mapper-input", "inputType"],
|
43
assets/javascripts/discourse/components/wizard-mapper-pair.hbs
Normale Datei
43
assets/javascripts/discourse/components/wizard-mapper-pair.hbs
Normale Datei
|
@ -0,0 +1,43 @@
|
||||||
|
<div class="key mapper-block">
|
||||||
|
{{wizard-mapper-selector
|
||||||
|
selectorType="key"
|
||||||
|
inputType=this.inputType
|
||||||
|
value=this.pair.key
|
||||||
|
activeType=this.pair.key_type
|
||||||
|
options=this.options
|
||||||
|
onUpdate=this.onUpdate
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{wizard-mapper-connector
|
||||||
|
connector=this.pair.connector
|
||||||
|
connectors=this.connectors
|
||||||
|
connectorType="pair"
|
||||||
|
inputType=this.inputType
|
||||||
|
options=this.options
|
||||||
|
onUpdate=this.onUpdate
|
||||||
|
}}
|
||||||
|
|
||||||
|
<div class="value mapper-block">
|
||||||
|
{{wizard-mapper-selector
|
||||||
|
selectorType="value"
|
||||||
|
inputType=this.inputType
|
||||||
|
value=this.pair.value
|
||||||
|
activeType=this.pair.value_type
|
||||||
|
options=this.options
|
||||||
|
onUpdate=this.onUpdate
|
||||||
|
connector=this.pair.connector
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#if this.showJoin}}
|
||||||
|
<span class="join-pair">&</span>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if this.showRemove}}
|
||||||
|
<a
|
||||||
|
role="button"
|
||||||
|
{{action this.removePair this.pair}}
|
||||||
|
class="remove-pair"
|
||||||
|
>{{d-icon "times"}}</a>
|
||||||
|
{{/if}}
|
|
@ -1,7 +1,7 @@
|
||||||
import { connectorContent } from "../lib/wizard-mapper";
|
|
||||||
import { alias, gt } from "@ember/object/computed";
|
|
||||||
import { computed } from "@ember/object";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { computed } from "@ember/object";
|
||||||
|
import { alias, gt } from "@ember/object/computed";
|
||||||
|
import { connectorContent } from "../lib/wizard-mapper";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNameBindings: [":mapper-pair", "hasConnector::no-connector"],
|
classNameBindings: [":mapper-pair", "hasConnector::no-connector"],
|
|
@ -0,0 +1 @@
|
||||||
|
{{this.item.label}}
|
|
@ -1,5 +1,5 @@
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
tagName: "a",
|
tagName: "a",
|
|
@ -1,14 +1,14 @@
|
||||||
<div class="type-selector">
|
<div class="type-selector">
|
||||||
{{#if hasTypes}}
|
{{#if this.hasTypes}}
|
||||||
<a role="button" {{action "toggleTypes"}} class="active">
|
<a role="button" {{action "toggleTypes"}} class="active">
|
||||||
{{activeTypeLabel}}
|
{{this.activeTypeLabel}}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{{#if showTypes}}
|
{{#if this.showTypes}}
|
||||||
<div class="selector-types">
|
<div class="selector-types">
|
||||||
{{#each selectorTypes as |item|}}
|
{{#each this.selectorTypes as |item|}}
|
||||||
{{wizard-mapper-selector-type
|
{{wizard-mapper-selector-type
|
||||||
activeType=activeType
|
activeType=this.activeType
|
||||||
item=item
|
item=item
|
||||||
toggle=(action "toggleType")
|
toggle=(action "toggleType")
|
||||||
}}
|
}}
|
||||||
|
@ -16,62 +16,62 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<span>{{activeTypeLabel}}</span>
|
<span>{{this.activeTypeLabel}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
{{#if showText}}
|
{{#if this.showText}}
|
||||||
<Input
|
<Input
|
||||||
@type="text"
|
@type="text"
|
||||||
@value={{this.value}}
|
@value={{this.value}}
|
||||||
placeholder={{i18n placeholderKey}}
|
placeholder={{i18n this.placeholderKey}}
|
||||||
{{on "change" (action "changeInputValue")}}
|
{{on "change" (action "changeInputValue")}}
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showComboBox}}
|
{{#if this.showComboBox}}
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=value
|
value=this.value
|
||||||
content=comboBoxContent
|
content=this.comboBoxContent
|
||||||
onChange=(action "changeValue")
|
onChange=(action "changeValue")
|
||||||
options=(hash none=placeholderKey allowAny=comboBoxAllowAny)
|
options=(hash none=this.placeholderKey allowAny=this.comboBoxAllowAny)
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showMultiSelect}}
|
{{#if this.showMultiSelect}}
|
||||||
{{multi-select
|
{{multi-select
|
||||||
content=multiSelectContent
|
content=this.multiSelectContent
|
||||||
value=value
|
value=this.value
|
||||||
onChange=(action "changeValue")
|
onChange=(action "changeValue")
|
||||||
options=multiSelectOptions
|
options=this.multiSelectOptions
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showList}}
|
{{#if this.showList}}
|
||||||
{{wizard-value-list
|
{{wizard-value-list
|
||||||
values=value
|
values=this.value
|
||||||
addKey=placeholderKey
|
addKey=this.placeholderKey
|
||||||
onChange=(action "changeValue")
|
onChange=(action "changeValue")
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showTag}}
|
{{#if this.showTag}}
|
||||||
{{tag-chooser
|
{{tag-chooser
|
||||||
tags=value
|
tags=this.value
|
||||||
onChange=(action "changeValue")
|
onChange=(action "changeValue")
|
||||||
everyTag=true
|
everyTag=true
|
||||||
options=(hash none=placeholderKey filterable=true)
|
options=(hash none=this.placeholderKey filterable=true)
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showUser}}
|
{{#if this.showUser}}
|
||||||
{{wizard-user-chooser
|
{{wizard-user-chooser
|
||||||
placeholderKey=placeholderKey
|
placeholderKey=this.placeholderKey
|
||||||
value=value
|
value=this.value
|
||||||
autocomplete="discourse"
|
autocomplete="discourse"
|
||||||
onChange=(action "changeUserValue")
|
onChange=(action "changeUserValue")
|
||||||
options=userOptions
|
options=this.userOptions
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
|
@ -1,21 +1,22 @@
|
||||||
import { alias, gt, or } from "@ember/object/computed";
|
import { getOwner } from "@ember/application";
|
||||||
|
import Component from "@ember/component";
|
||||||
import { computed } from "@ember/object";
|
import { computed } from "@ember/object";
|
||||||
|
import { alias, equal, gt, or } from "@ember/object/computed";
|
||||||
|
import { bind, later } from "@ember/runloop";
|
||||||
|
import { service } from "@ember/service";
|
||||||
|
import $ from "jquery";
|
||||||
import {
|
import {
|
||||||
default as discourseComputed,
|
default as discourseComputed,
|
||||||
observes,
|
observes,
|
||||||
} from "discourse-common/utils/decorators";
|
} from "discourse-common/utils/decorators";
|
||||||
import { getOwner } from "@ember/application";
|
import I18n from "I18n";
|
||||||
import { defaultSelectionType, selectionTypes } from "../lib/wizard-mapper";
|
|
||||||
import {
|
import {
|
||||||
generateName,
|
generateName,
|
||||||
sentenceCase,
|
sentenceCase,
|
||||||
snakeCase,
|
snakeCase,
|
||||||
userProperties,
|
userProperties,
|
||||||
} from "../lib/wizard";
|
} from "../lib/wizard";
|
||||||
import Component from "@ember/component";
|
import { defaultSelectionType, selectionTypes } from "../lib/wizard-mapper";
|
||||||
import { bind, later } from "@ember/runloop";
|
|
||||||
import I18n from "I18n";
|
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
const customFieldActionMap = {
|
const customFieldActionMap = {
|
||||||
topic: ["create_topic", "send_message"],
|
topic: ["create_topic", "send_message"],
|
||||||
|
@ -134,9 +135,7 @@ export default Component.extend({
|
||||||
listEnabled: computed("options.listSelection", "inputType", function () {
|
listEnabled: computed("options.listSelection", "inputType", function () {
|
||||||
return this.optionEnabled("listSelection");
|
return this.optionEnabled("listSelection");
|
||||||
}),
|
}),
|
||||||
valueEnabled: computed("connector", function () {
|
valueEnabled: equal("connector", "is"),
|
||||||
return this.connector === "is";
|
|
||||||
}),
|
|
||||||
|
|
||||||
@discourseComputed(
|
@discourseComputed(
|
||||||
"site.groups",
|
"site.groups",
|
||||||
|
@ -179,6 +178,7 @@ export default Component.extend({
|
||||||
showTypes: false,
|
showTypes: false,
|
||||||
|
|
||||||
didInsertElement() {
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
if (
|
if (
|
||||||
!this.activeType ||
|
!this.activeType ||
|
||||||
(this.activeType && !this[`${this.activeType}Enabled`])
|
(this.activeType && !this[`${this.activeType}Enabled`])
|
||||||
|
@ -190,6 +190,7 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
$(document).off("click", bind(this, this.documentClick));
|
$(document).off("click", bind(this, this.documentClick));
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{#each inputs as |input|}}
|
{{#each this.inputs as |input|}}
|
||||||
{{#if input.connector}}
|
{{#if input.connector}}
|
||||||
{{wizard-mapper-connector
|
{{wizard-mapper-connector
|
||||||
connector=input.connector
|
connector=input.connector
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
|
|
||||||
{{wizard-mapper-input
|
{{wizard-mapper-input
|
||||||
input=input
|
input=input
|
||||||
options=inputOptions
|
options=this.inputOptions
|
||||||
remove=(action "remove")
|
remove=(action "remove")
|
||||||
onUpdate=(action "inputUpdated")
|
onUpdate=(action "inputUpdated")
|
||||||
}}
|
}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if canAdd}}
|
{{#if this.canAdd}}
|
||||||
<span class="add-mapper-input">
|
<span class="add-mapper-input">
|
||||||
{{d-button action=(action "add") label="admin.wizard.add" icon="plus"}}
|
{{d-button action=(action "add") label="admin.wizard.add" icon="plus"}}
|
||||||
</span>
|
</span>
|
|
@ -1,13 +1,14 @@
|
||||||
import { newInput, selectionTypes } from "../lib/wizard-mapper";
|
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import { later } from "@ember/runloop";
|
|
||||||
import Component from "@ember/component";
|
|
||||||
import { A } from "@ember/array";
|
import { A } from "@ember/array";
|
||||||
|
import Component from "@ember/component";
|
||||||
|
import { later } from "@ember/runloop";
|
||||||
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
|
import { newInput, selectionTypes } from "../lib/wizard-mapper";
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
classNames: "wizard-mapper",
|
classNames: "wizard-mapper",
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
this._super();
|
||||||
if (this.inputs && this.inputs.constructor !== Array) {
|
if (this.inputs && this.inputs.constructor !== Array) {
|
||||||
later(() => this.set("inputs", null));
|
later(() => this.set("inputs", null));
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
<div class="message-block primary">
|
<div class="message-block primary">
|
||||||
{{#if showIcon}}
|
{{#if this.showIcon}}
|
||||||
{{d-icon icon}}
|
{{d-icon this.icon}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<span class="message-content">{{html-safe message}}</span>
|
<span class="message-content">{{html-safe this.message}}</span>
|
||||||
{{#if hasItems}}
|
{{#if this.hasItems}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#each items as |item|}}
|
{{#each this.items as |item|}}
|
||||||
<li>
|
<li>
|
||||||
<span>{{d-icon item.icon}}</span>
|
<span>{{d-icon item.icon}}</span>
|
||||||
<span>{{html-safe item.html}}</span>
|
<span>{{html-safe item.html}}</span>
|
||||||
|
@ -15,12 +15,12 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if showDocumentation}}
|
{{#if this.showDocumentation}}
|
||||||
<div class="message-block">
|
<div class="message-block">
|
||||||
{{d-icon "question-circle"}}
|
{{d-icon "question-circle"}}
|
||||||
|
|
||||||
<a href={{url}} target="_blank" rel="noopener noreferrer">
|
<a href={{this.url}} target="_blank" rel="noopener noreferrer">
|
||||||
{{documentation}}
|
{{this.documentation}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
|
@ -1,6 +1,6 @@
|
||||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
|
||||||
import { not, notEmpty } from "@ember/object/computed";
|
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
|
import { not, notEmpty } from "@ember/object/computed";
|
||||||
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
|
@ -3,7 +3,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value full">
|
<div class="setting-value full">
|
||||||
<ul>
|
<ul>
|
||||||
{{#each-in field.validations as |type props|}}
|
{{#each-in this.field.validations as |type props|}}
|
||||||
<li>
|
<li>
|
||||||
<span class="setting-title">
|
<span class="setting-title">
|
||||||
<h4>{{i18n (concat "admin.wizard.field.validations." type)}}</h4>
|
<h4>{{i18n (concat "admin.wizard.field.validations." type)}}</h4>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
/>
|
/>
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=(readonly props.time_unit)
|
value=(readonly props.time_unit)
|
||||||
content=timeUnits
|
content=this.timeUnits
|
||||||
class="time-unit-selector"
|
class="time-unit-selector"
|
||||||
onChange=(action (mut props.time_unit))
|
onChange=(action (mut props.time_unit))
|
||||||
}}
|
}}
|
||||||
|
@ -54,13 +54,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{radio-button
|
{{radio-button
|
||||||
name=(concat type field.id)
|
name=(concat type this.field.id)
|
||||||
value="above"
|
value="above"
|
||||||
selection=props.position
|
selection=props.position
|
||||||
}}
|
}}
|
||||||
<span>{{i18n "admin.wizard.field.validations.above"}}</span>
|
<span>{{i18n "admin.wizard.field.validations.above"}}</span>
|
||||||
{{radio-button
|
{{radio-button
|
||||||
name=(concat type field.id)
|
name=(concat type this.field.id)
|
||||||
value="below"
|
value="below"
|
||||||
selection=props.position
|
selection=props.position
|
||||||
}}
|
}}
|
|
@ -1,7 +1,7 @@
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import EmberObject from "@ember/object";
|
import EmberObject from "@ember/object";
|
||||||
import { cloneJSON } from "discourse-common/lib/object";
|
|
||||||
import Category from "discourse/models/category";
|
import Category from "discourse/models/category";
|
||||||
|
import { cloneJSON } from "discourse-common/lib/object";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden …
In neuem Issue referenzieren