Ted Johansson 189d98f3ca
DEV: Convert admin emojis UI to new layout (#29615)
This PR converts the custom emoji UI in the admin pages to follow the new admin UI guidelines.
2024-11-11 15:04:15 +08:00

30 lines
765 B
JavaScript

import Controller from "@ember/controller";
import EmberObject, { action, computed } from "@ember/object";
import { service } from "@ember/service";
const ALL_FILTER = "all";
export default class AdminEmojisNewController extends Controller {
@service router;
@service currentUser;
@computed("model")
get emojiGroups() {
return this.model.mapBy("group").uniq();
}
@computed("emojiGroups.[]")
get sortingGroups() {
return [ALL_FILTER].concat(this.emojiGroups);
}
@action
emojiUploaded(emoji, group) {
emoji.url += "?t=" + new Date().getTime();
emoji.group = group;
emoji.created_by = this.currentUser.username;
this.model.pushObject(EmberObject.create(emoji));
this.router.transitionTo("adminEmojis.index");
}
}