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 () {
return {
// Functions
emojiAddr: this.emojiAddr,
displayError: this.displayError
}
return { emojiAddr: this.emojiAddr }
},
computed: {

View File

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

View File

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

View File

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