2021-12-16 09:26:44 +01:00
|
|
|
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
|
|
|
|
2021-12-16 09:26:44 +01:00
|
|
|
export default Component.extend(UppyUploadMixin, {
|
2018-09-15 08:21:02 +02:00
|
|
|
classNames: ["wizard-field-upload"],
|
2019-10-04 23:13:41 +02:00
|
|
|
classNameBindings: ["isImage"],
|
2018-09-09 15:01:02 +02:00
|
|
|
uploading: false,
|
2021-12-16 09:26:44 +01:00
|
|
|
type: computed(function () {
|
|
|
|
return `wizard_${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);
|
2021-03-28 11:06:49 +02:00
|
|
|
},
|
2018-09-09 15:01:02 +02:00
|
|
|
});
|