discourse/app/assets/javascripts/admin/controllers/admin-emojis.js.es6

28 lines
738 B
Plaintext
Raw Normal View History

2016-06-30 13:55:44 -04:00
import { ajax } from 'discourse/lib/ajax';
2014-12-22 19:12:26 -05:00
export default Ember.ArrayController.extend({
sortProperties: ["name"],
actions: {
emojiUploaded(emoji) {
emoji.url += "?t=" + new Date().getTime();
this.pushObject(Ember.Object.create(emoji));
2014-12-22 19:12:26 -05:00
},
destroy(emoji) {
const self = this;
return bootbox.confirm(
I18n.t("admin.emoji.delete_confirm", { name: emoji.get("name") }),
I18n.t("no_value"),
I18n.t("yes_value"),
function(destroy) {
if (destroy) {
2016-06-30 13:55:44 -04:00
return ajax("/admin/customize/emojis/" + emoji.get("name"), { type: "DELETE" }).then(function() {
self.removeObject(emoji);
});
}
2014-12-22 19:12:26 -05:00
}
);
2014-12-22 19:12:26 -05:00
}
}
});