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

27 lines
623 B
Plaintext
Raw Normal View History

2018-07-18 06:57:43 -04:00
import { on, observes } from "ember-addons/ember-computed-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 Ember.Controller.extend(ModalFunctionality, {
@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");
}
}
});