2021-12-16 16:26:44 +08:00
|
|
|
import UppyUploadMixin from "discourse/mixins/uppy-upload";
|
|
|
|
import Component from "@ember/component";
|
|
|
|
import { computed } from "@ember/object";
|
2018-09-09 08:01:02 -05:00
|
|
|
|
2021-12-16 16:26:44 +08:00
|
|
|
export default Component.extend(UppyUploadMixin, {
|
2018-09-15 16:21:02 +10:00
|
|
|
classNames: ["wizard-field-upload"],
|
2019-10-04 22:13:41 +01:00
|
|
|
classNameBindings: ["isImage"],
|
2018-09-09 08:01:02 -05:00
|
|
|
uploading: false,
|
2021-12-16 16:26:44 +08: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 20:06:49 +11:00
|
|
|
},
|
2018-09-09 08:01:02 -05:00
|
|
|
});
|