0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-26 02:50:28 +01:00

DEV: Run prettier đź’„

Dieser Commit ist enthalten in:
Keegan George 2021-09-02 15:38:30 -07:00
Ursprung 7b13605c7b
Commit 9fc2092951
4 geänderte Dateien mit 34 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -1,10 +1,9 @@
import { action } from "@ember/object";
import Component from "@ember/component"; import Component from "@ember/component";
import { action } from "@ember/object";
import { equal } from "@ember/object/computed"; import { equal } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n"; import I18n from "I18n";
export default Component.extend({ export default Component.extend({
isText: equal("value.type", "text"), isText: equal("value.type", "text"),
isComposer: equal("value.type", "composer"), isComposer: equal("value.type", "composer"),
@ -25,7 +24,7 @@ export default Component.extend({
isTextArea: equal("value.type", "textarea"), isTextArea: equal("value.type", "textarea"),
isComposerPreview: equal("value.type", "composer_preview"), isComposerPreview: equal("value.type", "composer_preview"),
textState: "text-collapsed", textState: "text-collapsed",
toggleText: I18n.t('admin.wizard.submissions.expand_text'), toggleText: I18n.t("admin.wizard.submissions.expand_text"),
@discourseComputed("value") @discourseComputed("value")
checkboxValue(value) { checkboxValue(value) {
@ -45,14 +44,14 @@ export default Component.extend({
if (state === "text-collapsed") { if (state === "text-collapsed") {
this.set("textState", "text-expanded"); this.set("textState", "text-expanded");
this.set("toggleText", I18n.t('admin.wizard.submissions.collapse_text')); this.set("toggleText", I18n.t("admin.wizard.submissions.collapse_text"));
} else if (state === "text-expanded") { } else if (state === "text-expanded") {
this.set("textState", "text-collapsed"); this.set("textState", "text-collapsed");
this.set("toggleText", I18n.t('admin.wizard.submissions.expand_text')); this.set("toggleText", I18n.t("admin.wizard.submissions.expand_text"));
} }
}, },
@discourseComputed('value') @discourseComputed("value")
file(value) { file(value) {
const isUpload = this.get("isUpload"); const isUpload = this.get("isUpload");
if (isUpload) { if (isUpload) {
@ -60,7 +59,7 @@ export default Component.extend({
} }
}, },
@discourseComputed('value') @discourseComputed("value")
submittedUsers(value) { submittedUsers(value) {
const isUserSelector = this.get("isUserSelector"); const isUserSelector = this.get("isUserSelector");
const users = []; const users = [];
@ -69,13 +68,13 @@ export default Component.extend({
const userData = value.value; const userData = value.value;
const usernames = []; const usernames = [];
if (userData.indexOf(',')) { if (userData.indexOf(",")) {
usernames.push(...userData.split(',')); usernames.push(...userData.split(","));
usernames.forEach(u => { usernames.forEach((u) => {
const user = { const user = {
username: u, username: u,
url: `/u/${u}` url: `/u/${u}`,
}; };
users.push(user); users.push(user);
}); });
@ -84,7 +83,7 @@ export default Component.extend({
return users; return users;
}, },
@discourseComputed('value') @discourseComputed("value")
userProfileUrl(value) { userProfileUrl(value) {
const isUser = this.get("isUser"); const isUser = this.get("isUser");
@ -93,18 +92,18 @@ export default Component.extend({
} }
}, },
@discourseComputed('value') @discourseComputed("value")
categoryUrl(value) { categoryUrl(value) {
const isCategory = this.get('isCategory'); const isCategory = this.get("isCategory");
if (isCategory) { if (isCategory) {
return `/c/${value.value}`; return `/c/${value.value}`;
} }
}, },
@discourseComputed('value') @discourseComputed("value")
groupUrl(value) { groupUrl(value) {
const isGroup = this.get('isGroup'); const isGroup = this.get("isGroup");
if (isGroup) { if (isGroup) {
return `/g/${value.value}`; return `/g/${value.value}`;

Datei anzeigen

@ -1,10 +1,9 @@
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import { fmt } from "discourse/lib/computed";
import { empty } from "@ember/object/computed"; import { empty } from "@ember/object/computed";
import CustomWizard from "../models/custom-wizard";
import showModal from "discourse/lib/show-modal";
import discourseComputed from "discourse-common/utils/decorators"; import discourseComputed from "discourse-common/utils/decorators";
import { fmt } from "discourse/lib/computed";
import showModal from "discourse/lib/show-modal";
import CustomWizard from "../models/custom-wizard";
export default Controller.extend({ export default Controller.extend({
downloadUrl: fmt("wizard.id", "/admin/wizards/submissions/%@/download"), downloadUrl: fmt("wizard.id", "/admin/wizards/submissions/%@/download"),
@ -28,16 +27,15 @@ export default Controller.extend({
}); });
}, },
@discourseComputed("submissions", "fields.@each.enabled")
@discourseComputed('submissions', 'fields.@each.enabled')
displaySubmissions(submissions, fields) { displaySubmissions(submissions, fields) {
let result = []; let result = [];
submissions.forEach(submission => { submissions.forEach((submission) => {
let sub = {}; let sub = {};
Object.keys(submission).forEach(fieldId => { Object.keys(submission).forEach((fieldId) => {
if (fields.some(f => f.id === fieldId && f.enabled)) { if (fields.some((f) => f.id === fieldId && f.enabled)) {
sub[fieldId] = submission[fieldId]; sub[fieldId] = submission[fieldId];
} }
}); });
@ -58,9 +56,9 @@ export default Controller.extend({
showEditColumnsModal() { showEditColumnsModal() {
return showModal("admin-wizards-submissions-columns", { return showModal("admin-wizards-submissions-columns", {
model: { model: {
fields: this.get('fields'), fields: this.get("fields"),
submissions: this.get('submissions') submissions: this.get("submissions"),
} },
}); });
}, },
}, },

Datei anzeigen

@ -1,10 +1,10 @@
import { ajax } from "discourse/lib/ajax";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { buildProperties, mapped, present } from "../lib/wizard-json"; import { ajax } from "discourse/lib/ajax";
import { listProperties, snakeCase } from "../lib/wizard";
import wizardSchema from "../lib/wizard-schema";
import { Promise } from "rsvp";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import { Promise } from "rsvp";
import { listProperties, snakeCase } from "../lib/wizard";
import { buildProperties, mapped, present } from "../lib/wizard-json";
import wizardSchema from "../lib/wizard-schema";
const CustomWizard = EmberObject.extend({ const CustomWizard = EmberObject.extend({
save(opts) { save(opts) {
@ -235,7 +235,7 @@ CustomWizard.reopenClass({
}; };
Object.keys(s.fields).forEach((fieldId) => { Object.keys(s.fields).forEach((fieldId) => {
if (!fields.some(field => field.id === fieldId)) { if (!fields.some((field) => field.id === fieldId)) {
fields.push({ id: fieldId, label: s.fields[fieldId].label }); fields.push({ id: fieldId, label: s.fields[fieldId].label });
} }
submission[fieldId] = s.fields[fieldId]; submission[fieldId] = s.fields[fieldId];
@ -246,7 +246,7 @@ CustomWizard.reopenClass({
let submittedAt = { let submittedAt = {
id: "submitted_at", id: "submitted_at",
label: "Submitted At" label: "Submitted At",
}; };
fields.push(submittedAt); fields.push(submittedAt);