0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 10:40:28 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/custom-wizard-field-upload.js.es6

28 Zeilen
760 B
Text

import UppyUploadMixin from "discourse/mixins/uppy-upload";
import Component from "@ember/component";
import { computed } from "@ember/object";
2018-09-09 15:01:02 +02:00
export default Component.extend(UppyUploadMixin, {
classNames: ["wizard-field-upload"],
classNameBindings: ["isImage"],
2018-09-09 15:01:02 +02:00
uploading: false,
type: computed(function () {
return `wizard_${this.field.id}`;
}),
2022-03-16 12:33:34 +01:00
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);
},
2018-09-09 15:01:02 +02:00
});