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

28 lines
782 B
Plaintext
Raw Normal View History

2016-07-01 01:55:44 +08:00
import { ajax } from 'discourse/lib/ajax';
export default Ember.Controller.extend({
sortedEmojis: Ember.computed.sort('model', 'emojiSorting'),
emojiSorting: ['name'],
2014-12-23 08:12:26 +08:00
actions: {
emojiUploaded(emoji) {
emoji.url += "?t=" + new Date().getTime();
this.get('model').pushObject(Ember.Object.create(emoji));
2014-12-23 08:12:26 +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"),
destroy => {
if (destroy) {
return ajax("/admin/customize/emojis/" + emoji.get("name"), { type: "DELETE" }).then(() => {
this.get('model').removeObject(emoji);
});
}
2014-12-23 08:12:26 +08:00
}
);
2014-12-23 08:12:26 +08:00
}
}
});