discourse/app/assets/javascripts/admin/controllers/modals/admin-uploaded-image-list.j...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
656 B
Plaintext
Raw Normal View History

import Controller from "@ember/controller";
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
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 }) {
this.images.addObject(url);
2018-07-18 06:57:43 -04:00
},
remove(url) {
this.images.removeObject(url);
2018-07-18 06:57:43 -04:00
},
close() {
this.save(this.images.join("\n"));
2018-07-18 06:57:43 -04:00
this.send("closeModal");
}
}
});