This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/emoji-uploader.js.es6
2019-11-07 15:38:28 -06:00

32 lines
735 B
JavaScript

import { notEmpty, not } from "@ember/object/computed";
import Component from "@ember/component";
import { default as discourseComputed } from "discourse-common/utils/decorators";
import UploadMixin from "discourse/mixins/upload";
export default Component.extend(UploadMixin, {
type: "emoji",
uploadUrl: "/admin/customize/emojis",
hasName: notEmpty("name"),
addDisabled: not("hasName"),
uploadOptions() {
return {
sequentialUploads: true
};
},
@discourseComputed("hasName", "name")
data(hasName, name) {
return hasName ? { name } : {};
},
validateUploadedFilesOptions() {
return { imagesOnly: true };
},
uploadDone(upload) {
this.set("name", null);
this.done(upload);
}
});