2018-06-15 23:03:24 +08:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
2016-10-21 01:26:41 +08:00
|
|
|
export default Ember.Controller.extend({
|
2018-06-15 23:03:24 +08:00
|
|
|
sortedEmojis: Ember.computed.sort("model", "emojiSorting"),
|
|
|
|
emojiSorting: ["name"],
|
2014-12-23 08:12:26 +08:00
|
|
|
|
|
|
|
actions: {
|
2015-05-20 22:45:31 +08:00
|
|
|
emojiUploaded(emoji) {
|
2016-04-26 23:23:21 +08:00
|
|
|
emoji.url += "?t=" + new Date().getTime();
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.pushObject(Ember.Object.create(emoji));
|
2014-12-23 08:12:26 +08:00
|
|
|
},
|
|
|
|
|
2015-05-20 22:45:31 +08:00
|
|
|
destroy(emoji) {
|
|
|
|
return bootbox.confirm(
|
|
|
|
I18n.t("admin.emoji.delete_confirm", { name: emoji.get("name") }),
|
|
|
|
I18n.t("no_value"),
|
|
|
|
I18n.t("yes_value"),
|
2016-10-21 01:26:41 +08:00
|
|
|
destroy => {
|
2015-05-20 22:45:31 +08:00
|
|
|
if (destroy) {
|
2018-06-15 23:03:24 +08:00
|
|
|
return ajax("/admin/customize/emojis/" + emoji.get("name"), {
|
|
|
|
type: "DELETE"
|
|
|
|
}).then(() => {
|
2019-05-27 16:15:39 +08:00
|
|
|
this.model.removeObject(emoji);
|
2015-05-20 22:45:31 +08:00
|
|
|
});
|
|
|
|
}
|
2014-12-23 08:12:26 +08:00
|
|
|
}
|
2015-05-20 22:45:31 +08:00
|
|
|
);
|
2014-12-23 08:12:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|