DEV: refactoring emoji-uploader (#6926)
This commit is contained in:
parent
035c330457
commit
31a700daf8
|
@ -1,15 +1,16 @@
|
|||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
|
||||
export default Ember.Component.extend(UploadMixin, {
|
||||
type: "emoji",
|
||||
uploadUrl: "/admin/customize/emojis",
|
||||
|
||||
hasName: Ember.computed.notEmpty("name"),
|
||||
addDisabled: Ember.computed.not("hasName"),
|
||||
|
||||
data: function() {
|
||||
return Ember.isBlank(this.get("name")) ? {} : { name: this.get("name") };
|
||||
}.property("name"),
|
||||
@computed("hasName", "name")
|
||||
data(hasName, name) {
|
||||
return hasName ? { name } : {};
|
||||
},
|
||||
|
||||
validateUploadedFilesOptions() {
|
||||
return { imagesOnly: true };
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
{{text-field name="name" placeholderKey="admin.emoji.name" value=name}}
|
||||
|
||||
<label class="btn btn-primary {{if addDisabled 'disabled'}}">
|
||||
{{d-icon "plus"}}
|
||||
{{i18n 'admin.emoji.add'}}
|
||||
<input class="hidden-upload-field" disabled={{addDisabled}} type="file" accept=".png,.gif" />
|
||||
{{i18n "admin.emoji.add"}}
|
||||
<input
|
||||
class="hidden-upload-field"
|
||||
disabled={{addDisabled}}
|
||||
type="file"
|
||||
accept=".png,.gif" />
|
||||
</label>
|
||||
|
|
Loading…
Reference in New Issue