2019-10-23 13:06:54 -04:00
|
|
|
import Controller from "@ember/controller";
|
2019-11-07 16:38:28 -05:00
|
|
|
import { on, observes } from "discourse-common/utils/decorators";
|
2018-07-18 07:09:16 -04:00
|
|
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
2018-07-18 06:57:43 -04:00
|
|
|
|
2019-10-23 13:06:54 -04:00
|
|
|
export default Controller.extend(ModalFunctionality, {
|
2018-07-18 06:57:43 -04:00
|
|
|
@on("init")
|
|
|
|
@observes("model.value")
|
|
|
|
_setup() {
|
|
|
|
const value = this.get("model.value");
|
|
|
|
this.set("images", value && value.length ? value.split("\n") : []);
|
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
uploadDone({ url }) {
|
2019-05-27 04:15:39 -04:00
|
|
|
this.images.addObject(url);
|
2018-07-18 06:57:43 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
remove(url) {
|
2019-05-27 04:15:39 -04:00
|
|
|
this.images.removeObject(url);
|
2018-07-18 06:57:43 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
close() {
|
2019-05-27 04:15:39 -04:00
|
|
|
this.save(this.images.join("\n"));
|
2018-07-18 06:57:43 -04:00
|
|
|
this.send("closeModal");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|