displayError event, 'emits', "Edit pack" label

This commit is contained in:
Ekaterina Vaartis 2024-01-22 23:14:49 +03:00
parent 8a030d935b
commit 4d7a915154
4 changed files with 12 additions and 11 deletions

View File

@ -36,11 +36,7 @@ const EmojiTab = {
}, },
provide () { provide () {
return { return { emojiAddr: this.emojiAddr }
// Functions
emojiAddr: this.emojiAddr,
displayError: this.displayError
}
}, },
computed: { computed: {

View File

@ -59,6 +59,8 @@
<h3>{{ $t('admin_dash.emoji.emoji_packs') }}</h3> <h3>{{ $t('admin_dash.emoji.emoji_packs') }}</h3>
<li> <li>
<h4>{{ $t('admin_dash.emoji.edit_pack') }}</h4>
<Select class="form-control" v-model="packName"> <Select class="form-control" v-model="packName">
<option value="" disabled hidden>{{ $t('admin_dash.emoji.emoji_pack') }}</option> <option value="" disabled hidden>{{ $t('admin_dash.emoji.emoji_pack') }}</option>
<option v-for="(pack, listPackName) in knownPacks" :label="listPackName" :key="listPackName"> <option v-for="(pack, listPackName) in knownPacks" :label="listPackName" :key="listPackName">
@ -233,7 +235,8 @@
v-if="pack.remote === undefined" v-if="pack.remote === undefined"
placement="bottom" new-upload placement="bottom" new-upload
:title="$t('admin_dash.emoji.adding_new')" :title="$t('admin_dash.emoji.adding_new')"
:packName="packName" @updatePackFiles="updatePackFiles" :packName="packName"
@updatePackFiles="updatePackFiles" @displayError="displayError"
> >
<template #trigger> <template #trigger>
<FAIcon icon="plus" size="2x" :title="$t('admin_dash.emoji.add_file')" /> <FAIcon icon="plus" size="2x" :title="$t('admin_dash.emoji.add_file')" />
@ -246,7 +249,7 @@
:title="$t('admin_dash.emoji.editing', [shortcode])" :title="$t('admin_dash.emoji.editing', [shortcode])"
:disabled="pack.remote !== undefined" :disabled="pack.remote !== undefined"
:shortcode="shortcode" :file="file" :packName="packName" :shortcode="shortcode" :file="file" :packName="packName"
@updatePackFiles="updatePackFiles" @updatePackFiles="updatePackFiles" @displayError="displayError"
> >
<template #trigger> <template #trigger>
<StillImage <StillImage

View File

@ -113,7 +113,7 @@ export default {
return !this.newUpload && (this.editedShortcode !== this.shortcode || this.editedFile !== this.file) return !this.newUpload && (this.editedShortcode !== this.shortcode || this.editedFile !== this.file)
} }
}, },
inject: ['emojiAddr', 'displayError'], inject: ['emojiAddr'],
methods: { methods: {
saveEditedEmoji () { saveEditedEmoji () {
if (!this.isEdited) return if (!this.isEdited) return
@ -122,7 +122,7 @@ export default {
{ packName: this.packName, shortcode: this.shortcode, newShortcode: this.editedShortcode, newFilename: this.editedFile, force: false } { packName: this.packName, shortcode: this.shortcode, newShortcode: this.editedShortcode, newFilename: this.editedFile, force: false }
).then(resp => { ).then(resp => {
if (resp.error !== undefined) { if (resp.error !== undefined) {
this.displayError(resp.error) this.$emit('displayError', resp.error)
return Promise.reject(resp.error) return Promise.reject(resp.error)
} }
@ -137,7 +137,7 @@ export default {
filename: this.editedFile filename: this.editedFile
}).then(resp => resp.json()).then(resp => { }).then(resp => resp.json()).then(resp => {
if (resp.error !== undefined) { if (resp.error !== undefined) {
this.displayError(resp.error) this.$emit('displayError', resp.error)
return return
} }
@ -160,7 +160,7 @@ export default {
{ packName: this.packName, shortcode: this.editedShortcode } { packName: this.packName, shortcode: this.editedShortcode }
).then(resp => resp.json()).then(resp => { ).then(resp => resp.json()).then(resp => {
if (resp.error !== undefined) { if (resp.error !== undefined) {
this.displayError(resp.error) this.$emit('displayError', resp.error)
return return
} }
@ -168,6 +168,7 @@ export default {
}) })
} }
}, },
emits: ['updatePackFiles', 'displaError'],
props: { props: {
placement: String, placement: String,
disabled: { disabled: {

View File

@ -947,6 +947,7 @@
"do_list": "List", "do_list": "List",
"remote_pack_instance": "Remote pack instance", "remote_pack_instance": "Remote pack instance",
"emoji_pack": "Emoji pack", "emoji_pack": "Emoji pack",
"edit_pack": "Edit pack",
"description": "Description", "description": "Description",
"homepage": "Homepage", "homepage": "Homepage",
"fallback_src": "Fallback source", "fallback_src": "Fallback source",