2016-06-30 13:55:44 -04:00
|
|
|
import { ajax } from 'discourse/lib/ajax';
|
2016-10-20 13:26:41 -04:00
|
|
|
export default Ember.Controller.extend({
|
|
|
|
sortedEmojis: Ember.computed.sort('model', 'emojiSorting'),
|
|
|
|
emojiSorting: ['name'],
|
2014-12-22 19:12:26 -05:00
|
|
|
|
|
|
|
actions: {
|
2015-05-20 10:45:31 -04:00
|
|
|
emojiUploaded(emoji) {
|
2016-04-26 11:23:21 -04:00
|
|
|
emoji.url += "?t=" + new Date().getTime();
|
2016-10-20 13:26:41 -04:00
|
|
|
this.get('model').pushObject(Ember.Object.create(emoji));
|
2014-12-22 19:12:26 -05:00
|
|
|
},
|
|
|
|
|
2015-05-20 10:45:31 -04: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-20 13:26:41 -04:00
|
|
|
destroy => {
|
2015-05-20 10:45:31 -04:00
|
|
|
if (destroy) {
|
2016-10-20 13:26:41 -04:00
|
|
|
return ajax("/admin/customize/emojis/" + emoji.get("name"), { type: "DELETE" }).then(() => {
|
|
|
|
this.get('model').removeObject(emoji);
|
2015-05-20 10:45:31 -04:00
|
|
|
});
|
|
|
|
}
|
2014-12-22 19:12:26 -05:00
|
|
|
}
|
2015-05-20 10:45:31 -04:00
|
|
|
);
|
2014-12-22 19:12:26 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|