0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-26 19:10:29 +01:00
discourse-custom-wizard/assets/javascripts/wizard/components/wizard-field-upload.js.es6
2022-06-15 08:59:09 +02:00

28 Zeilen
825 B
JavaScript

import UppyUploadMixin from "discourse/mixins/uppy-upload";
import Component from "@ember/component";
import { computed } from "@ember/object";
export default Component.extend(UppyUploadMixin, {
layoutName: "wizard/templates/components/wizard-field-upload",
classNames: ["wizard-field-upload"],
classNameBindings: ["isImage"],
uploading: false,
type: computed(function () {
return `wizard_${this.field.id}`;
}),
id: computed(function () {
return `wizard_field_upload_${this.field.id}`;
}),
isImage: computed("field.value.extension", function () {
return (
this.field.value &&
this.siteSettings.wizard_recognised_image_upload_formats
.split("|")
.includes(this.field.value.extension)
);
}),
uploadDone(upload) {
this.set("field.value", upload);
},
});