0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +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 { 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}`;

Datei anzeigen

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

Datei anzeigen

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