Commits vergleichen
Keine gemeinsamen Commits. „main“ und „update-compatibility-main“ haben vollständig unterschiedliche Historien.
main
...
update-com
37 geänderte Dateien mit 246 neuen und 423 gelöschten Zeilen
|
@ -23,7 +23,7 @@ class CustomWizard::AdminSubmissionsController < CustomWizard::AdminController
|
||||||
|
|
||||||
def download
|
def download
|
||||||
content = ActiveModel::ArraySerializer.new(
|
content = ActiveModel::ArraySerializer.new(
|
||||||
CustomWizard::Submission.list(@wizard).submissions,
|
submission_list.submissions,
|
||||||
each_serializer: CustomWizard::SubmissionSerializer
|
each_serializer: CustomWizard::SubmissionSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<DModal @closeModal={{@closeModal}} @title={{this.title}}>
|
|
||||||
{{#if loading}}
|
|
||||||
<LoadingSpinner size="large" />
|
|
||||||
{{else}}
|
|
||||||
<div class="edit-directory-columns-container">
|
|
||||||
{{#each @model.columns as |column|}}
|
|
||||||
<div class="edit-directory-column">
|
|
||||||
<div class="left-content">
|
|
||||||
<label class="column-name">
|
|
||||||
<Input @type="checkbox" @checked={{column.enabled}} />
|
|
||||||
{{directory-table-header-title
|
|
||||||
field=column.label
|
|
||||||
translated=true
|
|
||||||
}}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
<div class="modal-footer">
|
|
||||||
<DButton
|
|
||||||
class="btn-primary"
|
|
||||||
@label="directory.edit_columns.save"
|
|
||||||
@action={{action "save"}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DButton
|
|
||||||
class="btn-secondary reset-to-default"
|
|
||||||
@label="directory.edit_columns.reset_to_default"
|
|
||||||
@action={{action "resetToDefault"}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</DModal>
|
|
|
@ -1,15 +0,0 @@
|
||||||
import Component from "@glimmer/component";
|
|
||||||
import { action } from "@ember/object";
|
|
||||||
import I18n from "I18n";
|
|
||||||
|
|
||||||
export default class AdminWizardsColumnComponent extends Component {
|
|
||||||
title = I18n.t("admin.wizard.edit_columns");
|
|
||||||
|
|
||||||
@action save() {
|
|
||||||
this.args.closeModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@action resetToDefault() {
|
|
||||||
this.args.model.reset();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
<DModal
|
|
||||||
@closeModal={{@closeModal}}
|
|
||||||
class="next-session-time-modal"
|
|
||||||
@title={{this.title}}
|
|
||||||
>
|
|
||||||
<DateTimeInput
|
|
||||||
@date={{this.bufferedDateTime}}
|
|
||||||
@onChange={{action "dateTimeChanged"}}
|
|
||||||
@showTime="true"
|
|
||||||
@clearable="true"
|
|
||||||
/>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<DButton
|
|
||||||
@action={{action "submit"}}
|
|
||||||
class="btn-primary"
|
|
||||||
@label="admin.wizard.after_time_modal.done"
|
|
||||||
@disabled={{this.submitDisabled}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</DModal>
|
|
|
@ -1,30 +0,0 @@
|
||||||
import Component from "@glimmer/component";
|
|
||||||
import { tracked } from "@glimmer/tracking";
|
|
||||||
import { action } from "@ember/object";
|
|
||||||
import I18n from "I18n";
|
|
||||||
|
|
||||||
export default class NextSessionScheduledComponent extends Component {
|
|
||||||
@tracked bufferedDateTime;
|
|
||||||
title = I18n.t("admin.wizard.after_time_modal.title");
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super(...arguments);
|
|
||||||
this.bufferedDateTime = this.args.model.dateTime
|
|
||||||
? moment(this.args.model.dateTime)
|
|
||||||
: moment(Date.now());
|
|
||||||
}
|
|
||||||
|
|
||||||
get submitDisabled() {
|
|
||||||
return moment().isAfter(this.bufferedDateTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@action submit() {
|
|
||||||
const dateTime = this.bufferedDateTime;
|
|
||||||
this.args.model.update(moment(dateTime).utc().toISOString());
|
|
||||||
this.args.closeModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@action dateTimeChanged(dateTime) {
|
|
||||||
this.bufferedDateTime = dateTime;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,11 +7,8 @@ import { selectKitContent } from "../lib/wizard";
|
||||||
import { underscore } from "@ember/string";
|
import { underscore } from "@ember/string";
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
queryParams: ["refresh_list"],
|
queryParams: ["refresh_list"],
|
||||||
loadingSubscriptions: false,
|
loadingSubscriptions: false,
|
||||||
notAuthorized: not("api.authorized"),
|
notAuthorized: not("api.authorized"),
|
||||||
|
@ -251,7 +248,7 @@ export default Controller.extend({
|
||||||
.catch(popupAjaxError)
|
.catch(popupAjaxError)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
this.router.transitionTo("adminWizardsApis").then(() => {
|
this.transitionToRoute("adminWizardsApis").then(() => {
|
||||||
this.send("refreshModel");
|
this.send("refreshModel");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
import Controller from "@ember/controller";
|
||||||
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
|
||||||
|
export default Controller.extend(ModalFunctionality, {
|
||||||
|
actions: {
|
||||||
|
save() {
|
||||||
|
this.send("closeModal");
|
||||||
|
},
|
||||||
|
|
||||||
|
resetToDefault() {
|
||||||
|
this.get("model.reset")();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
|
@ -2,13 +2,11 @@ import Controller from "@ember/controller";
|
||||||
import { empty } from "@ember/object/computed";
|
import { empty } from "@ember/object/computed";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import { fmt } from "discourse/lib/computed";
|
import { fmt } from "discourse/lib/computed";
|
||||||
import { inject as service } from "@ember/service";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import AdminWizardsColumnsModal from "../components/modal/admin-wizards-columns";
|
|
||||||
import CustomWizardAdmin from "../models/custom-wizard-admin";
|
import CustomWizardAdmin from "../models/custom-wizard-admin";
|
||||||
import { formatModel } from "../lib/wizard-submission";
|
import { formatModel } from "../lib/wizard-submission";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
modal: service(),
|
|
||||||
downloadUrl: fmt("wizard.id", "/admin/wizards/submissions/%@/download"),
|
downloadUrl: fmt("wizard.id", "/admin/wizards/submissions/%@/download"),
|
||||||
noResults: empty("submissions"),
|
noResults: empty("submissions"),
|
||||||
page: 0,
|
page: 0,
|
||||||
|
@ -59,7 +57,7 @@ export default Controller.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
showEditColumnsModal() {
|
showEditColumnsModal() {
|
||||||
return this.modal.show(AdminWizardsColumnsModal, {
|
return showModal("admin-wizards-columns", {
|
||||||
model: {
|
model: {
|
||||||
columns: this.get("fields"),
|
columns: this.get("fields"),
|
||||||
reset: () => {
|
reset: () => {
|
||||||
|
|
|
@ -3,8 +3,7 @@ import {
|
||||||
observes,
|
observes,
|
||||||
} from "discourse-common/utils/decorators";
|
} from "discourse-common/utils/decorators";
|
||||||
import { notEmpty } from "@ember/object/computed";
|
import { notEmpty } from "@ember/object/computed";
|
||||||
import { inject as service } from "@ember/service";
|
import showModal from "discourse/lib/show-modal";
|
||||||
import NextSessionScheduledModal from "../components/modal/next-session-scheduled";
|
|
||||||
import { generateId, wizardFieldList } from "../lib/wizard";
|
import { generateId, wizardFieldList } from "../lib/wizard";
|
||||||
import { dasherize } from "@ember/string";
|
import { dasherize } from "@ember/string";
|
||||||
import { later, scheduleOnce } from "@ember/runloop";
|
import { later, scheduleOnce } from "@ember/runloop";
|
||||||
|
@ -14,7 +13,6 @@ import I18n from "I18n";
|
||||||
import { filterValues } from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
|
import { filterValues } from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
modal: service(),
|
|
||||||
hasName: notEmpty("wizard.name"),
|
hasName: notEmpty("wizard.name"),
|
||||||
|
|
||||||
@observes("currentStep")
|
@observes("currentStep")
|
||||||
|
@ -128,13 +126,15 @@ export default Controller.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setNextSessionScheduled() {
|
setNextSessionScheduled() {
|
||||||
this.modal.show(NextSessionScheduledModal, {
|
let controller = showModal("next-session-scheduled", {
|
||||||
model: {
|
model: {
|
||||||
dateTime: this.wizard.after_time_scheduled,
|
dateTime: this.wizard.after_time_scheduled,
|
||||||
update: (dateTime) =>
|
update: (dateTime) =>
|
||||||
this.set("wizard.after_time_scheduled", dateTime),
|
this.set("wizard.after_time_scheduled", dateTime),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
controller.setup();
|
||||||
},
|
},
|
||||||
|
|
||||||
copyUrl() {
|
copyUrl() {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import getUrl from "discourse-common/lib/get-url";
|
import getUrl from "discourse-common/lib/get-url";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
router: service(),
|
|
||||||
wizard: null,
|
wizard: null,
|
||||||
step: null,
|
step: null,
|
||||||
|
|
||||||
|
@ -17,12 +15,12 @@ export default Controller.extend({
|
||||||
const wizardId = this.get("wizard.id");
|
const wizardId = this.get("wizard.id");
|
||||||
window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`);
|
window.location.href = getUrl(`/w/${wizardId}/steps/${nextStepId}`);
|
||||||
} else {
|
} else {
|
||||||
this.router.transitionTo("customWizardStep", nextStepId);
|
this.transitionToRoute("customWizardStep", nextStepId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
goBack() {
|
goBack() {
|
||||||
this.router.transitionTo("customWizardStep", this.get("step.previous"));
|
this.transitionToRoute("customWizardStep", this.get("step.previous"));
|
||||||
},
|
},
|
||||||
|
|
||||||
showMessage(message) {
|
showMessage(message) {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||||
|
import Controller from "@ember/controller";
|
||||||
|
|
||||||
|
export default Controller.extend({
|
||||||
|
title: "admin.wizard.after_time_modal.title",
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
this.set(
|
||||||
|
"bufferedDateTime",
|
||||||
|
this.model.dateTime ? moment(this.model.dateTime) : moment(Date.now())
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
@discourseComputed("bufferedDateTime")
|
||||||
|
submitDisabled(dateTime) {
|
||||||
|
return moment().isAfter(dateTime);
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
submit() {
|
||||||
|
const dateTime = this.get("bufferedDateTime");
|
||||||
|
this.get("model.update")(moment(dateTime).utc().toISOString());
|
||||||
|
this.send("closeModal");
|
||||||
|
},
|
||||||
|
|
||||||
|
dateTimeChanged(dateTime) {
|
||||||
|
this.set("bufferedDateTime", dateTime);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
|
@ -83,16 +83,6 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
api.modifyClass("component:category-chooser", {
|
|
||||||
categoriesByScope(options = {}) {
|
|
||||||
let categories = this._super(options);
|
|
||||||
|
|
||||||
return categories.filter((category) => {
|
|
||||||
return !category.custom_fields?.create_topic_wizard;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import CustomWizardApi from "../models/custom-wizard-api";
|
import CustomWizardApi from "../models/custom-wizard-api";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (params.name === "create") {
|
if (params.name === "create") {
|
||||||
return CustomWizardApi.create({ isNew: true });
|
return CustomWizardApi.create({ isNew: true });
|
||||||
|
@ -15,7 +12,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (model === null) {
|
if (model === null) {
|
||||||
return this.router.transitionTo("adminWizardsApi");
|
return this.transitionTo("adminWizardsApi");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import CustomWizardApi from "../models/custom-wizard-api";
|
import CustomWizardApi from "../models/custom-wizard-api";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return CustomWizardApi.list();
|
return CustomWizardApi.list();
|
||||||
},
|
},
|
||||||
|
@ -28,11 +25,11 @@ export default DiscourseRoute.extend({
|
||||||
actions: {
|
actions: {
|
||||||
changeApi(apiName) {
|
changeApi(apiName) {
|
||||||
this.controllerFor("adminWizardsApi").set("apiName", apiName);
|
this.controllerFor("adminWizardsApi").set("apiName", apiName);
|
||||||
this.router.transitionTo("adminWizardsApiShow", apiName);
|
this.transitionTo("adminWizardsApiShow", apiName);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterDestroy() {
|
afterDestroy() {
|
||||||
this.router.transitionTo("adminWizardsApi").then(() => this.refresh());
|
this.transitionTo("adminWizardsApi").then(() => this.refresh());
|
||||||
},
|
},
|
||||||
|
|
||||||
afterSave(apiName) {
|
afterSave(apiName) {
|
||||||
|
@ -41,7 +38,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
createApi() {
|
createApi() {
|
||||||
this.controllerFor("adminWizardsApi").set("apiName", "create");
|
this.controllerFor("adminWizardsApi").set("apiName", "create");
|
||||||
this.router.transitionTo("adminWizardsApiShow", "create");
|
this.transitionTo("adminWizardsApiShow", "create");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
import CustomWizardLogs from "../models/custom-wizard-logs";
|
import CustomWizardLogs from "../models/custom-wizard-logs";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { A } from "@ember/array";
|
import { A } from "@ember/array";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return CustomWizardLogs.list(params.wizardId);
|
return CustomWizardLogs.list(params.wizardId);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (model === null) {
|
if (model === null) {
|
||||||
return this.router.transitionTo("adminWizardsLogs");
|
return this.transitionTo("adminWizardsLogs");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return ajax(`/admin/wizards/wizard`);
|
return ajax(`/admin/wizards/wizard`);
|
||||||
},
|
},
|
||||||
|
@ -21,7 +18,7 @@ export default DiscourseRoute.extend({
|
||||||
actions: {
|
actions: {
|
||||||
changeWizard(wizardId) {
|
changeWizard(wizardId) {
|
||||||
this.controllerFor("adminWizardsLogs").set("wizardId", wizardId);
|
this.controllerFor("adminWizardsLogs").set("wizardId", wizardId);
|
||||||
this.router.transitionTo("adminWizardsLogsShow", wizardId);
|
this.transitionTo("adminWizardsLogsShow", wizardId);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,18 +2,15 @@ import { A } from "@ember/array";
|
||||||
import CustomWizardAdmin from "../models/custom-wizard-admin";
|
import CustomWizardAdmin from "../models/custom-wizard-admin";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { formatModel } from "../lib/wizard-submission";
|
import { formatModel } from "../lib/wizard-submission";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
return CustomWizardAdmin.submissions(params.wizardId);
|
return CustomWizardAdmin.submissions(params.wizardId);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (model === null) {
|
if (model === null) {
|
||||||
return this.router.transitionTo("adminWizardsSubmissions");
|
return this.transitionTo("adminWizardsSubmissions");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return ajax(`/admin/wizards/wizard`);
|
return ajax(`/admin/wizards/wizard`);
|
||||||
},
|
},
|
||||||
|
@ -21,7 +18,7 @@ export default DiscourseRoute.extend({
|
||||||
actions: {
|
actions: {
|
||||||
changeWizard(wizardId) {
|
changeWizard(wizardId) {
|
||||||
this.controllerFor("adminWizardsSubmissions").set("wizardId", wizardId);
|
this.controllerFor("adminWizardsSubmissions").set("wizardId", wizardId);
|
||||||
this.router.transitionTo("adminWizardsSubmissionsShow", wizardId);
|
this.transitionTo("adminWizardsSubmissionsShow", wizardId);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,11 +2,8 @@ import CustomWizardAdmin from "../models/custom-wizard-admin";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model(params) {
|
model(params) {
|
||||||
if (params.wizardId === "create") {
|
if (params.wizardId === "create") {
|
||||||
return { create: true };
|
return { create: true };
|
||||||
|
@ -17,7 +14,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (model.none) {
|
if (model.none) {
|
||||||
return this.router.transitionTo("adminWizardsWizard");
|
return this.transitionTo("adminWizardsWizard");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,8 @@ import EmberObject, { set } from "@ember/object";
|
||||||
import { A } from "@ember/array";
|
import { A } from "@ember/array";
|
||||||
import { all } from "rsvp";
|
import { all } from "rsvp";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return ajax("/admin/wizards/wizard");
|
return ajax("/admin/wizards/wizard");
|
||||||
},
|
},
|
||||||
|
@ -83,14 +80,14 @@ export default DiscourseRoute.extend({
|
||||||
this.controllerFor("adminWizardsWizard").set("wizardId", wizardId);
|
this.controllerFor("adminWizardsWizard").set("wizardId", wizardId);
|
||||||
|
|
||||||
if (wizardId) {
|
if (wizardId) {
|
||||||
this.router.transitionTo("adminWizardsWizardShow", wizardId);
|
this.transitionTo("adminWizardsWizardShow", wizardId);
|
||||||
} else {
|
} else {
|
||||||
this.router.transitionTo("adminWizardsWizard");
|
this.transitionTo("adminWizardsWizard");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
afterDestroy() {
|
afterDestroy() {
|
||||||
this.router.transitionTo("adminWizardsWizard").then(() => this.refresh());
|
this.transitionTo("adminWizardsWizard").then(() => this.refresh());
|
||||||
},
|
},
|
||||||
|
|
||||||
afterSave(wizardId) {
|
afterSave(wizardId) {
|
||||||
|
@ -99,7 +96,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
createWizard() {
|
createWizard() {
|
||||||
this.controllerFor("adminWizardsWizard").set("wizardId", "create");
|
this.controllerFor("adminWizardsWizard").set("wizardId", "create");
|
||||||
this.router.transitionTo("adminWizardsWizardShow", "create");
|
this.transitionTo("adminWizardsWizardShow", "create");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
import { ajax } from "discourse/lib/ajax";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
return ajax("/admin/wizards");
|
return ajax("/admin/wizards");
|
||||||
},
|
},
|
||||||
|
@ -20,7 +17,7 @@ export default DiscourseRoute.extend({
|
||||||
|
|
||||||
afterModel(model, transition) {
|
afterModel(model, transition) {
|
||||||
if (transition.targetName === "adminWizards.index") {
|
if (transition.targetName === "adminWizards.index") {
|
||||||
this.router.transitionTo("adminWizardsWizard");
|
this.transitionTo("adminWizardsWizard");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
import { getCachedWizard } from "../models/custom-wizard";
|
import { getCachedWizard } from "../models/custom-wizard";
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
const wizard = getCachedWizard();
|
const wizard = getCachedWizard();
|
||||||
if (wizard && wizard.permitted && !wizard.completed && wizard.start) {
|
if (wizard && wizard.permitted && !wizard.completed && wizard.start) {
|
||||||
this.router.replaceWith("customWizardStep", wizard.start);
|
this.replaceWith("customWizardStep", wizard.start);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,14 @@ import { getCachedWizard } from "../models/custom-wizard";
|
||||||
import Route from "@ember/routing/route";
|
import Route from "@ember/routing/route";
|
||||||
import { scrollTop } from "discourse/mixins/scroll-top";
|
import { scrollTop } from "discourse/mixins/scroll-top";
|
||||||
import { action } from "@ember/object";
|
import { action } from "@ember/object";
|
||||||
import { inject as service } from "@ember/service";
|
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
router: service(),
|
|
||||||
|
|
||||||
beforeModel() {
|
beforeModel() {
|
||||||
const wizard = getCachedWizard();
|
const wizard = getCachedWizard();
|
||||||
this.set("wizard", wizard);
|
this.set("wizard", wizard);
|
||||||
|
|
||||||
if (!wizard || !wizard.permitted || wizard.completed) {
|
if (!wizard || !wizard.permitted || wizard.completed) {
|
||||||
this.router.replaceWith("customWizard");
|
this.replaceWith("customWizard");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -30,7 +27,7 @@ export default Route.extend({
|
||||||
|
|
||||||
afterModel(model) {
|
afterModel(model) {
|
||||||
if (model.completed) {
|
if (model.completed) {
|
||||||
return this.router.transitionTo("wizard.index");
|
return this.transitionTo("wizard.index");
|
||||||
}
|
}
|
||||||
return model.set("wizardId", this.wizard.id);
|
return model.set("wizardId", this.wizard.id);
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-subscription-selector
|
{{wizard-subscription-selector
|
||||||
value=this.action.type
|
value=action.type
|
||||||
feature="action"
|
feature="action"
|
||||||
attribute="type"
|
attribute="type"
|
||||||
onChange=(action "changeType")
|
onChange=(action "changeType")
|
||||||
|
@ -31,9 +31,9 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.run_after
|
value=action.run_after
|
||||||
content=runAfterContent
|
content=runAfterContent
|
||||||
onChange=(action (mut this.action.run_after))
|
onChange=(action (mut action.run_after))
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.title
|
inputs=action.title
|
||||||
property="title"
|
property="title"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -67,10 +67,10 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.post
|
value=action.post
|
||||||
content=wizardFields
|
content=wizardFields
|
||||||
nameProperty="label"
|
nameProperty="label"
|
||||||
onChange=(action (mut this.action.post))
|
onChange=(action (mut action.post))
|
||||||
options=(hash
|
options=(hash
|
||||||
none="admin.wizard.selector.placeholder.wizard_field"
|
none="admin.wizard.selector.placeholder.wizard_field"
|
||||||
isDisabled=showPostBuilder
|
isDisabled=showPostBuilder
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if this.action.post_builder}}
|
{{#if action.post_builder}}
|
||||||
<div class="setting full">
|
<div class="setting full">
|
||||||
<div class="setting-label">
|
<div class="setting-label">
|
||||||
<label>{{i18n "admin.wizard.action.post_builder.label"}}</label>
|
<label>{{i18n "admin.wizard.action.post_builder.label"}}</label>
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
|
|
||||||
<div class="setting-value editor">
|
<div class="setting-value editor">
|
||||||
{{wizard-text-editor
|
{{wizard-text-editor
|
||||||
value=this.action.post_template
|
value=action.post_template
|
||||||
wizardFields=wizardFields
|
wizardFields=wizardFields
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.category
|
inputs=action.category
|
||||||
property="category"
|
property="category"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.tags
|
inputs=action.tags
|
||||||
property="tags"
|
property="tags"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -153,7 +153,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.visible
|
inputs=action.visible
|
||||||
property="visible"
|
property="visible"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.add_event
|
inputs=action.add_event
|
||||||
property="add_event"
|
property="add_event"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash wizardFieldSelection=true context="action")
|
options=(hash wizardFieldSelection=true context="action")
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.add_location
|
inputs=action.add_location
|
||||||
property="add_location"
|
property="add_location"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash wizardFieldSelection=true context="action")
|
options=(hash wizardFieldSelection=true context="action")
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.recipient
|
inputs=action.recipient
|
||||||
property="recipient"
|
property="recipient"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.profile_updates
|
inputs=action.profile_updates
|
||||||
property="profile_updates"
|
property="profile_updates"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -254,11 +254,11 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.api
|
value=action.api
|
||||||
content=availableApis
|
content=availableApis
|
||||||
onChange=(action (mut this.action.api))
|
onChange=(action (mut action.api))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=this.action.custom_title_enabled
|
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"
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
@ -272,9 +272,9 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.api_endpoint
|
value=action.api_endpoint
|
||||||
content=availableEndpoints
|
content=availableEndpoints
|
||||||
onChange=(action (mut this.action.api_endpoint))
|
onChange=(action (mut action.api_endpoint))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=apiEmpty
|
isDisabled=apiEmpty
|
||||||
none="admin.wizard.action.send_to_api.select_an_endpoint"
|
none="admin.wizard.action.send_to_api.select_an_endpoint"
|
||||||
|
@ -290,7 +290,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-text-editor
|
{{wizard-text-editor
|
||||||
value=this.action.api_body
|
value=action.api_body
|
||||||
previewEnabled=false
|
previewEnabled=false
|
||||||
barEnabled=false
|
barEnabled=false
|
||||||
wizardFields=wizardFields
|
wizardFields=wizardFields
|
||||||
|
@ -308,7 +308,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.group
|
inputs=action.group
|
||||||
property="group"
|
property="group"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -333,7 +333,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.url
|
inputs=action.url
|
||||||
property="url"
|
property="url"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -357,7 +357,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.categories
|
inputs=action.categories
|
||||||
property="categories"
|
property="categories"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -381,7 +381,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.mute_remainder
|
inputs=action.mute_remainder
|
||||||
property="mute_remainder"
|
property="mute_remainder"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -402,11 +402,11 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.notification_level
|
value=action.notification_level
|
||||||
content=availableNotificationLevels
|
content=availableNotificationLevels
|
||||||
onChange=(action (mut this.action.notification_level))
|
onChange=(action (mut action.notification_level))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=this.action.custom_title_enabled
|
isDisabled=action.custom_title_enabled
|
||||||
none="admin.wizard.action.watch_x.select_a_notification_level"
|
none="admin.wizard.action.watch_x.select_a_notification_level"
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
@ -430,7 +430,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.usernames
|
inputs=action.usernames
|
||||||
property="usernames"
|
property="usernames"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -452,7 +452,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.tags
|
inputs=action.tags
|
||||||
property="tags"
|
property="tags"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -476,11 +476,11 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{combo-box
|
{{combo-box
|
||||||
value=this.action.notification_level
|
value=action.notification_level
|
||||||
content=availableNotificationLevels
|
content=availableNotificationLevels
|
||||||
onChange=(action (mut this.action.notification_level))
|
onChange=(action (mut action.notification_level))
|
||||||
options=(hash
|
options=(hash
|
||||||
isDisabled=this.action.custom_title_enabled
|
isDisabled=action.custom_title_enabled
|
||||||
none="admin.wizard.action.watch_x.select_a_notification_level"
|
none="admin.wizard.action.watch_x.select_a_notification_level"
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
@ -504,7 +504,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.usernames
|
inputs=action.usernames
|
||||||
property="usernames"
|
property="usernames"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -526,7 +526,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.name
|
inputs=action.name
|
||||||
property="name"
|
property="name"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -545,7 +545,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.full_name
|
inputs=action.full_name
|
||||||
property="full_name"
|
property="full_name"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -564,7 +564,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.title
|
inputs=action.title
|
||||||
property="title"
|
property="title"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -583,7 +583,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.bio_raw
|
inputs=action.bio_raw
|
||||||
property="bio_raw"
|
property="bio_raw"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -602,7 +602,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.owner_usernames
|
inputs=action.owner_usernames
|
||||||
property="owner_usernames"
|
property="owner_usernames"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -622,7 +622,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.usernames
|
inputs=action.usernames
|
||||||
property="usernames"
|
property="usernames"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -644,7 +644,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.grant_trust_level
|
inputs=action.grant_trust_level
|
||||||
property="grant_trust_level"
|
property="grant_trust_level"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -665,7 +665,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.mentionable_level
|
inputs=action.mentionable_level
|
||||||
property="mentionable_level"
|
property="mentionable_level"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -686,7 +686,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.messageable_level
|
inputs=action.messageable_level
|
||||||
property="messageable_level"
|
property="messageable_level"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -707,7 +707,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.visibility_level
|
inputs=action.visibility_level
|
||||||
property="visibility_level"
|
property="visibility_level"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -728,7 +728,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.members_visibility_level
|
inputs=action.members_visibility_level
|
||||||
property="members_visibility_level"
|
property="members_visibility_level"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -750,7 +750,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.name
|
inputs=action.name
|
||||||
property="name"
|
property="name"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -770,7 +770,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.slug
|
inputs=action.slug
|
||||||
property="slug"
|
property="slug"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -790,7 +790,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.color
|
inputs=action.color
|
||||||
property="color"
|
property="color"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -810,7 +810,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.text_color
|
inputs=action.text_color
|
||||||
property="text_color"
|
property="text_color"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -832,7 +832,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.parent_category_id
|
inputs=action.parent_category_id
|
||||||
property="parent_category_id"
|
property="parent_category_id"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -853,7 +853,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.permissions
|
inputs=action.permissions
|
||||||
property="permissions"
|
property="permissions"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -878,7 +878,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.custom_fields
|
inputs=action.custom_fields
|
||||||
property="custom_fields"
|
property="custom_fields"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
@ -903,7 +903,7 @@
|
||||||
|
|
||||||
<div class="setting-value">
|
<div class="setting-value">
|
||||||
{{wizard-mapper
|
{{wizard-mapper
|
||||||
inputs=this.action.required
|
inputs=action.required
|
||||||
property="required"
|
property="required"
|
||||||
onUpdate=(action "mappedFieldUpdated")
|
onUpdate=(action "mappedFieldUpdated")
|
||||||
options=(hash
|
options=(hash
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
{{wizard-mapper-connector
|
{{wizard-mapper-connector
|
||||||
connector=this.input.type
|
connector=input.type
|
||||||
connectors=this.inputTypes
|
connectors=inputTypes
|
||||||
inputTypes=true
|
inputTypes=true
|
||||||
inputType=this.inputType
|
inputType=inputType
|
||||||
connectorType="type"
|
connectorType="type"
|
||||||
options=this.options
|
options=options
|
||||||
onUpdate=this.onUpdate
|
onUpdate=onUpdate
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{{#if hasPairs}}
|
{{#if hasPairs}}
|
||||||
<div class="mapper-pairs mapper-block">
|
<div class="mapper-pairs mapper-block">
|
||||||
{{#each this.input.pairs as |pair|}}
|
{{#each input.pairs as |pair|}}
|
||||||
{{wizard-mapper-pair
|
{{wizard-mapper-pair
|
||||||
pair=pair
|
pair=pair
|
||||||
last=pair.last
|
last=pair.last
|
||||||
inputType=this.inputType
|
inputType=inputType
|
||||||
options=this.options
|
options=options
|
||||||
removePair=(action "removePair")
|
removePair=(action "removePair")
|
||||||
onUpdate=this.onUpdate
|
onUpdate=onUpdate
|
||||||
}}
|
}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
|
@ -32,27 +32,27 @@
|
||||||
{{#if hasOutput}}
|
{{#if hasOutput}}
|
||||||
{{#if hasPairs}}
|
{{#if hasPairs}}
|
||||||
{{wizard-mapper-connector
|
{{wizard-mapper-connector
|
||||||
connector=this.input.output_connector
|
connector=input.output_connector
|
||||||
connectors=this.connectors
|
connectors=connectors
|
||||||
connectorType="output"
|
connectorType="output"
|
||||||
inputType=this.inputType
|
inputType=inputType
|
||||||
options=this.options
|
options=options
|
||||||
onUpdate=this.onUpdate
|
onUpdate=onUpdate
|
||||||
}}
|
}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="output mapper-block">
|
<div class="output mapper-block">
|
||||||
{{wizard-mapper-selector
|
{{wizard-mapper-selector
|
||||||
selectorType="output"
|
selectorType="output"
|
||||||
inputType=this.input.type
|
inputType=input.type
|
||||||
value=this.input.output
|
value=input.output
|
||||||
activeType=this.input.output_type
|
activeType=input.output_type
|
||||||
options=this.options
|
options=options
|
||||||
onUpdate=this.onUpdate
|
onUpdate=onUpdate
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<a role="button" class="remove-input" {{action remove this.input}}>
|
<a role="button" class="remove-input" {{action remove input}}>
|
||||||
{{d-icon "times"}}
|
{{d-icon "times"}}
|
||||||
</a>
|
</a>
|
|
@ -0,0 +1,35 @@
|
||||||
|
{{#d-modal-body title="admin.wizard.edit_columns"}}
|
||||||
|
{{#if loading}}
|
||||||
|
{{loading-spinner size="large"}}
|
||||||
|
{{else}}
|
||||||
|
<div class="edit-directory-columns-container">
|
||||||
|
{{#each model.columns as |column|}}
|
||||||
|
<div class="edit-directory-column">
|
||||||
|
<div class="left-content">
|
||||||
|
<label class="column-name">
|
||||||
|
{{input type="checkbox" checked=column.enabled}}
|
||||||
|
{{directory-table-header-title
|
||||||
|
field=column.label
|
||||||
|
translated=true
|
||||||
|
}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/d-modal-body}}
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
{{d-button
|
||||||
|
class="btn-primary"
|
||||||
|
label="directory.edit_columns.save"
|
||||||
|
action=(action "save")
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{d-button
|
||||||
|
class="btn-secondary reset-to-default"
|
||||||
|
label="directory.edit_columns.reset_to_default"
|
||||||
|
action=(action "resetToDefault")
|
||||||
|
}}
|
||||||
|
</div>
|
|
@ -0,0 +1,17 @@
|
||||||
|
{{#d-modal-body class="next-session-time-modal" title=title}}
|
||||||
|
{{date-time-input
|
||||||
|
date=bufferedDateTime
|
||||||
|
onChange=(action "dateTimeChanged")
|
||||||
|
showTime=true
|
||||||
|
clearable=true
|
||||||
|
}}
|
||||||
|
{{/d-modal-body}}
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
{{d-button
|
||||||
|
action=(action "submit")
|
||||||
|
class="btn-primary"
|
||||||
|
label="admin.wizard.after_time_modal.done"
|
||||||
|
disabled=submitDisabled
|
||||||
|
}}
|
||||||
|
</div>
|
|
@ -55,8 +55,6 @@ en:
|
||||||
liquid_syntax_error: "Liquid syntax error in %{attribute}: %{message}"
|
liquid_syntax_error: "Liquid syntax error in %{attribute}: %{message}"
|
||||||
subscription: "%{type} %{property} usage is not supported on your subscription"
|
subscription: "%{type} %{property} usage is not supported on your subscription"
|
||||||
not_permitted_for_guests: "%{object_id} is not permitted when guests can access the wizard"
|
not_permitted_for_guests: "%{object_id} is not permitted when guests can access the wizard"
|
||||||
error_messages:
|
|
||||||
wizard_replacing_composer: "Category not allowed for topic creation."
|
|
||||||
|
|
||||||
site_settings:
|
site_settings:
|
||||||
custom_wizard_enabled: "Enable custom wizards."
|
custom_wizard_enabled: "Enable custom wizards."
|
||||||
|
|
|
@ -10,19 +10,19 @@ class CustomWizard::Subscription
|
||||||
{
|
{
|
||||||
wizard: {
|
wizard: {
|
||||||
required: {
|
required: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
permitted: {
|
permitted: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*', "!#{CustomWizard::Wizard::GUEST_GROUP_ID}"]
|
community: ['*', "!#{CustomWizard::Wizard::GUEST_GROUP_ID}"]
|
||||||
},
|
},
|
||||||
restart_on_revisit: {
|
restart_on_revisit: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -30,19 +30,19 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
required_data: {
|
required_data: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
permitted_params: {
|
permitted_params: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -50,19 +50,19 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
field: {
|
field: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ['text', 'textarea', 'text_only', 'date', 'time', 'date_time', 'number', 'checkbox', 'dropdown', 'upload'],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
realtime_validations: {
|
realtime_validations: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -70,7 +70,7 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ['create_topic', 'update_profile', 'open_composer', 'route_to'],
|
||||||
standard: ['create_topic', 'update_profile', 'open_composer', 'route_to', 'send_message', 'watch_categories', 'watch_tags', 'add_to_group'],
|
standard: ['create_topic', 'update_profile', 'open_composer', 'route_to', 'send_message', 'watch_categories', 'watch_tags', 'add_to_group'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -78,13 +78,13 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
custom_field: {
|
custom_field: {
|
||||||
klass: {
|
klass: {
|
||||||
none: ['*'],
|
none: ['topic', 'post'],
|
||||||
standard: ['topic', 'post'],
|
standard: ['topic', 'post'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ['string', 'boolean', 'integer'],
|
||||||
standard: ['string', 'boolean', 'integer'],
|
standard: ['string', 'boolean', 'integer'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -92,7 +92,7 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
all: {
|
all: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: [],
|
standard: [],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -154,11 +154,14 @@ class CustomWizard::Subscription
|
||||||
end
|
end
|
||||||
|
|
||||||
def type
|
def type
|
||||||
return :business
|
return :none unless subscribed?
|
||||||
|
return :business if business?
|
||||||
|
return :standard if standard?
|
||||||
|
return :community if community?
|
||||||
end
|
end
|
||||||
|
|
||||||
def subscribed?
|
def subscribed?
|
||||||
true
|
standard? || business? || community?
|
||||||
end
|
end
|
||||||
|
|
||||||
def standard?
|
def standard?
|
||||||
|
@ -166,7 +169,7 @@ class CustomWizard::Subscription
|
||||||
end
|
end
|
||||||
|
|
||||||
def business?
|
def business?
|
||||||
true
|
product_slug === "business"
|
||||||
end
|
end
|
||||||
|
|
||||||
def community?
|
def community?
|
||||||
|
|
11
plugin.rb
11
plugin.rb
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||||
# version: 2.4.23
|
# version: 2.4.20
|
||||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
|
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
|
||||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||||
# contact_emails: development@pavilion.tech
|
# contact_emails: development@pavilion.tech
|
||||||
|
@ -236,13 +236,4 @@ after_initialize do
|
||||||
end
|
end
|
||||||
|
|
||||||
DiscourseEvent.trigger(:custom_wizard_ready)
|
DiscourseEvent.trigger(:custom_wizard_ready)
|
||||||
|
|
||||||
on(:before_create_topic) do |topic_params, user|
|
|
||||||
category = topic_params.category
|
|
||||||
if category&.custom_fields&.[]('create_topic_wizard').present?
|
|
||||||
raise Discourse::InvalidParameters.new(
|
|
||||||
I18n.t('wizard.error_messages.wizard_replacing_composer')
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe CustomWizard::Subscription do
|
||||||
|
|
||||||
context "without a subscription client" do
|
context "without a subscription client" do
|
||||||
it "is not subscribed" do
|
it "is not subscribed" do
|
||||||
expect(described_class.subscribed?).to eq(true)
|
expect(described_class.subscribed?).to eq(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "has none type" do
|
it "has none type" do
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
describe Topic, type: :model do
|
|
||||||
fab!(:category_with_wizard) do
|
|
||||||
Fabricate(:category, custom_fields: { create_topic_wizard: 'true' })
|
|
||||||
end
|
|
||||||
fab!(:category_without_wizard) { Fabricate(:category) }
|
|
||||||
fab!(:user) { Fabricate(:user) }
|
|
||||||
let(:valid_attrs) { Fabricate.attributes_for(:topic) }
|
|
||||||
|
|
||||||
context 'with a create_topic_wizard custom field in the category' do
|
|
||||||
it 'will not allow creating a topic directly' do
|
|
||||||
expect do
|
|
||||||
TopicCreator.create(
|
|
||||||
user,
|
|
||||||
Guardian.new(user),
|
|
||||||
valid_attrs.merge(
|
|
||||||
title: 'A valid and sufficiently long title for testing',
|
|
||||||
category: category_with_wizard.id,
|
|
||||||
raw: 'hello this is a test topic with category with custom fields'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end.to raise_error(
|
|
||||||
Discourse::InvalidParameters,
|
|
||||||
'Category not allowed for topic creation.'
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'without a create_topic_wizard custom field in the category' do
|
|
||||||
it 'will allow creating a topic directly' do
|
|
||||||
expect do
|
|
||||||
TopicCreator.create(
|
|
||||||
user,
|
|
||||||
Guardian.new(user),
|
|
||||||
valid_attrs.merge(
|
|
||||||
category: category_without_wizard.id,
|
|
||||||
title: 'Another valid and sufficiently long title for testing',
|
|
||||||
raw: 'This is the body of a valid topic'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end.not_to raise_error
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -24,7 +24,7 @@ describe CustomWizard::SubmissionSerializer do
|
||||||
|
|
||||||
it 'should return submission attributes' do
|
it 'should return submission attributes' do
|
||||||
wizard = CustomWizard::Wizard.create(template_json["id"])
|
wizard = CustomWizard::Wizard.create(template_json["id"])
|
||||||
list = CustomWizard::Submission.list(wizard, page: 0, order_by: 'id')
|
list = CustomWizard::Submission.list(wizard, page: 0)
|
||||||
|
|
||||||
json_array = ActiveModel::ArraySerializer.new(
|
json_array = ActiveModel::ArraySerializer.new(
|
||||||
list.submissions,
|
list.submissions,
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
import { Promise } from "rsvp";
|
import { Promise } from "rsvp";
|
||||||
|
|
||||||
acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
acceptance("Admin | Custom Fields Unsuscribed", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
needs.settings({
|
needs.settings({
|
||||||
custom_wizard_enabled: true,
|
custom_wizard_enabled: true,
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
acceptance("Admin | Custom Wizard Unsuscribed", function (needs) {
|
||||||
needs.user();
|
needs.user();
|
||||||
needs.settings({
|
needs.settings({
|
||||||
custom_wizard_enabled: true,
|
custom_wizard_enabled: true,
|
||||||
|
@ -257,7 +257,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
".wizard-custom-step .wizard-text-editor .d-editor button.local-dates"
|
".wizard-custom-step .wizard-text-editor .d-editor button.local-dates"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists(".discourse-local-dates-create-modal .modal-body"),
|
exists(".discourse-local-dates-create-modal.modal-body"),
|
||||||
"Insert date-time modal visible"
|
"Insert date-time modal visible"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
|
@ -269,7 +269,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
await click(".modal-footer button.advanced-mode-btn");
|
await click(".modal-footer button.advanced-mode-btn");
|
||||||
assert.ok(
|
assert.ok(
|
||||||
exists(
|
exists(
|
||||||
".discourse-local-dates-create-modal .modal-body .advanced-options"
|
".discourse-local-dates-create-modal.modal-body .advanced-options"
|
||||||
),
|
),
|
||||||
"Advanced mode is visible"
|
"Advanced mode is visible"
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
import { click, visit } from "@ember/test-helpers";
|
|
||||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
|
||||||
import { test } from "qunit";
|
|
||||||
|
|
||||||
acceptance("Category Chooser Initializer", function (needs) {
|
|
||||||
needs.user();
|
|
||||||
needs.settings({
|
|
||||||
allow_uncategorized_topics: false,
|
|
||||||
});
|
|
||||||
needs.site({
|
|
||||||
can_tag_topics: true,
|
|
||||||
categories: [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: "General",
|
|
||||||
slug: "general",
|
|
||||||
permission: 1,
|
|
||||||
topic_template: null,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "Category with custom field",
|
|
||||||
slug: "category-custom-field",
|
|
||||||
permission: 1,
|
|
||||||
topic_template: "",
|
|
||||||
custom_fields: {
|
|
||||||
create_topic_wizard: "21",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "Category 1",
|
|
||||||
slug: "category-1",
|
|
||||||
permission: 1,
|
|
||||||
topic_template: "",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: "Category 2",
|
|
||||||
slug: "category-2",
|
|
||||||
permission: 1,
|
|
||||||
topic_template: "",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
test("does not display category with create_topic_wizard custom field", async function (assert) {
|
|
||||||
const categoryChooser = selectKit(".category-chooser");
|
|
||||||
|
|
||||||
await visit("/");
|
|
||||||
await click("#create-topic");
|
|
||||||
await categoryChooser.expand();
|
|
||||||
let categories = Array.from(
|
|
||||||
document.querySelectorAll(".category-chooser .category-row")
|
|
||||||
).filter((category) => category.getAttribute("data-name")); // Filter elements with a data-name attribute
|
|
||||||
assert.equal(
|
|
||||||
categories.length,
|
|
||||||
3,
|
|
||||||
"Correct number of categories are displayed"
|
|
||||||
);
|
|
||||||
const categoryNames = ["General", "Category 1", "Category 2"];
|
|
||||||
|
|
||||||
categoryNames.forEach((categoryName) => {
|
|
||||||
assert.ok(
|
|
||||||
categories.some(
|
|
||||||
(category) => category.getAttribute("data-name") === categoryName
|
|
||||||
),
|
|
||||||
`Category '${categoryName}' is displayed`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const categoryNameWithCustomField = "Category with custom field";
|
|
||||||
assert.notOk(
|
|
||||||
categories.some(
|
|
||||||
(category) =>
|
|
||||||
category.getAttribute("data-name") === categoryNameWithCustomField
|
|
||||||
),
|
|
||||||
`Category '${categoryNameWithCustomField}' is not displayed`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -121,19 +121,19 @@ const getUnsubscribedAdminWizards = {
|
||||||
subscription_attributes: {
|
subscription_attributes: {
|
||||||
wizard: {
|
wizard: {
|
||||||
required: {
|
required: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
permitted: {
|
permitted: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
restart_on_revisit: {
|
restart_on_revisit: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
|
@ -141,19 +141,19 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
required_data: {
|
required_data: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
permitted_params: {
|
permitted_params: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
|
@ -161,19 +161,30 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
field: {
|
field: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: [
|
||||||
|
"text",
|
||||||
|
"textarea",
|
||||||
|
"text_only",
|
||||||
|
"date",
|
||||||
|
"time",
|
||||||
|
"date_time",
|
||||||
|
"number",
|
||||||
|
"checkbox",
|
||||||
|
"dropdown",
|
||||||
|
"upload",
|
||||||
|
],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
realtime_validations: {
|
realtime_validations: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
|
@ -181,7 +192,7 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ["create_topic", "update_profile", "open_composer", "route_to"],
|
||||||
standard: [
|
standard: [
|
||||||
"create_topic",
|
"create_topic",
|
||||||
"update_profile",
|
"update_profile",
|
||||||
|
@ -197,20 +208,20 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
custom_field: {
|
custom_field: {
|
||||||
klass: {
|
klass: {
|
||||||
none: ['*'],
|
none: ["topic", "post"],
|
||||||
standard: ["topic", "post"],
|
standard: ["topic", "post"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ["string", "boolean", "integer"],
|
||||||
standard: ["string", "boolean", "integer"],
|
standard: ["string", "boolean", "integer"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
all: { none: ["*"], standard: [], business: ["*"], community: ["*"] },
|
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
subscription_client_installed: false,
|
subscription_client_installed: false,
|
||||||
|
|
Laden …
In neuem Issue referenzieren