From 9fc2092951bb22a2daf61883552c3dc13f680488 Mon Sep 17 00:00:00 2001 From: Keegan George Date: Thu, 2 Sep 2021 15:38:30 -0700 Subject: [PATCH] =?UTF-8?q?DEV:=20Run=20prettier=20=F0=9F=92=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/submission-field.js.es6 | 31 +++++++++---------- .../admin-wizards-submissions-show.js.es6 | 22 ++++++------- .../discourse/models/custom-wizard.js.es6 | 16 +++++----- .../admin-wizards-submissions-columns.hbs | 2 +- 4 files changed, 34 insertions(+), 37 deletions(-) diff --git a/assets/javascripts/discourse/components/submission-field.js.es6 b/assets/javascripts/discourse/components/submission-field.js.es6 index ea9e34cf..5ebc0ccd 100644 --- a/assets/javascripts/discourse/components/submission-field.js.es6 +++ b/assets/javascripts/discourse/components/submission-field.js.es6 @@ -1,10 +1,9 @@ -import { action } from "@ember/object"; import Component from "@ember/component"; +import { action } from "@ember/object"; import { equal } from "@ember/object/computed"; import discourseComputed from "discourse-common/utils/decorators"; import I18n from "I18n"; - export default Component.extend({ isText: equal("value.type", "text"), isComposer: equal("value.type", "composer"), @@ -25,7 +24,7 @@ export default Component.extend({ isTextArea: equal("value.type", "textarea"), isComposerPreview: equal("value.type", "composer_preview"), textState: "text-collapsed", - toggleText: I18n.t('admin.wizard.submissions.expand_text'), + toggleText: I18n.t("admin.wizard.submissions.expand_text"), @discourseComputed("value") checkboxValue(value) { @@ -45,14 +44,14 @@ export default Component.extend({ if (state === "text-collapsed") { 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") { 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) { const isUpload = this.get("isUpload"); if (isUpload) { @@ -60,7 +59,7 @@ export default Component.extend({ } }, - @discourseComputed('value') + @discourseComputed("value") submittedUsers(value) { const isUserSelector = this.get("isUserSelector"); const users = []; @@ -69,13 +68,13 @@ export default Component.extend({ const userData = value.value; const usernames = []; - if (userData.indexOf(',')) { - usernames.push(...userData.split(',')); + if (userData.indexOf(",")) { + usernames.push(...userData.split(",")); - usernames.forEach(u => { + usernames.forEach((u) => { const user = { username: u, - url: `/u/${u}` + url: `/u/${u}`, }; users.push(user); }); @@ -84,7 +83,7 @@ export default Component.extend({ return users; }, - @discourseComputed('value') + @discourseComputed("value") userProfileUrl(value) { const isUser = this.get("isUser"); @@ -93,18 +92,18 @@ export default Component.extend({ } }, - @discourseComputed('value') + @discourseComputed("value") categoryUrl(value) { - const isCategory = this.get('isCategory'); + const isCategory = this.get("isCategory"); if (isCategory) { return `/c/${value.value}`; } }, - @discourseComputed('value') + @discourseComputed("value") groupUrl(value) { - const isGroup = this.get('isGroup'); + const isGroup = this.get("isGroup"); if (isGroup) { return `/g/${value.value}`; diff --git a/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 index 450f7d53..7ba0050f 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 @@ -1,10 +1,9 @@ import Controller from "@ember/controller"; -import { fmt } from "discourse/lib/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 { fmt } from "discourse/lib/computed"; +import showModal from "discourse/lib/show-modal"; +import CustomWizard from "../models/custom-wizard"; export default Controller.extend({ 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) { let result = []; - submissions.forEach(submission => { + submissions.forEach((submission) => { let sub = {}; - Object.keys(submission).forEach(fieldId => { - if (fields.some(f => f.id === fieldId && f.enabled)) { + Object.keys(submission).forEach((fieldId) => { + if (fields.some((f) => f.id === fieldId && f.enabled)) { sub[fieldId] = submission[fieldId]; } }); @@ -58,9 +56,9 @@ export default Controller.extend({ showEditColumnsModal() { return showModal("admin-wizards-submissions-columns", { model: { - fields: this.get('fields'), - submissions: this.get('submissions') - } + fields: this.get("fields"), + submissions: this.get("submissions"), + }, }); }, }, diff --git a/assets/javascripts/discourse/models/custom-wizard.js.es6 b/assets/javascripts/discourse/models/custom-wizard.js.es6 index 660ba4ee..d0b49079 100644 --- a/assets/javascripts/discourse/models/custom-wizard.js.es6 +++ b/assets/javascripts/discourse/models/custom-wizard.js.es6 @@ -1,10 +1,10 @@ -import { ajax } from "discourse/lib/ajax"; import EmberObject from "@ember/object"; -import { buildProperties, mapped, present } from "../lib/wizard-json"; -import { listProperties, snakeCase } from "../lib/wizard"; -import wizardSchema from "../lib/wizard-schema"; -import { Promise } from "rsvp"; +import { ajax } from "discourse/lib/ajax"; 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({ save(opts) { @@ -224,7 +224,7 @@ CustomWizard.reopenClass({ }) .then((result) => { if (result.wizard) { - let fields = [{ id: "username", label: "User"}]; + let fields = [{ id: "username", label: "User" }]; let submissions = []; let wizard = result.wizard; let total = result.total; @@ -235,7 +235,7 @@ CustomWizard.reopenClass({ }; 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 }); } submission[fieldId] = s.fields[fieldId]; @@ -246,7 +246,7 @@ CustomWizard.reopenClass({ let submittedAt = { id: "submitted_at", - label: "Submitted At" + label: "Submitted At", }; fields.push(submittedAt); diff --git a/assets/javascripts/discourse/templates/modal/admin-wizards-submissions-columns.hbs b/assets/javascripts/discourse/templates/modal/admin-wizards-submissions-columns.hbs index a167a954..24743a92 100644 --- a/assets/javascripts/discourse/templates/modal/admin-wizards-submissions-columns.hbs +++ b/assets/javascripts/discourse/templates/modal/admin-wizards-submissions-columns.hbs @@ -29,4 +29,4 @@ label="directory.edit_columns.reset_to_default" action=(action "resetToDefault") }} - + \ No newline at end of file