This commit is contained in:
mattyatea 2023-12-23 23:14:51 +09:00
parent e5f81c02a1
commit 868cd2860d
3 changed files with 16 additions and 25 deletions

View File

@ -13,7 +13,7 @@
<MkButton inline @click="addTagBulk">Add tag</MkButton> <MkButton inline @click="addTagBulk">Add tag</MkButton>
<MkButton inline @click="removeTagBulk">Remove tag</MkButton> <MkButton inline @click="removeTagBulk">Remove tag</MkButton>
<MkButton inline @click="setLisenceBulk">Set Lisence</MkButton> <MkButton inline @click="setLisenceBulk">Set Lisence</MkButton>
<MkButton inline @click="setisSensitiveBulk">Set isSensitive</MkButton> <MkButton inline @click="isSensitiveBulk">Set isSensitive</MkButton>
<MkButton inline @click="setlocalOnlyBulk">Set localOnly</MkButton> <MkButton inline @click="setlocalOnlyBulk">Set localOnly</MkButton>
<MkButton inline danger @click="delBulk">Delete</MkButton> <MkButton inline danger @click="delBulk">Delete</MkButton>
</div> </div>
@ -22,14 +22,14 @@
<template #default="{items}"> <template #default="{items}">
<div :class="$style.root"> <div :class="$style.root">
<div v-for="emoji in items" :key="emoji.id"> <div v-for="emoji in items" :key="emoji.id">
<button v-if="emoji.request" class="_panel _button" :class="[{ selected: selectedEmojis.includes(emoji.id) },$style.emoji,$style.emojirequest]" @click="selectMode ? toggleSelect(emoji) : edit(emoji)"> <button v-if="emoji.request" class="_panel _button" :class="[{ [$style.selected]: selectedEmojis.includes(emoji.id) },$style.emoji,$style.emojirequest]" @click="selectMode ? toggleSelect(emoji) : edit(emoji)">
<img :src="emoji.url" class="img" :alt="emoji.name"/> <img :src="emoji.url" class="img" :alt="emoji.name"/>
<div class="body"> <div class="body">
<div class="name _monospace">{{ emoji.name }}</div> <div class="name _monospace">{{ emoji.name }}</div>
<div class="info">{{ emoji.category }}</div> <div class="info">{{ emoji.category }}</div>
</div> </div>
</button> </button>
<button v-else class="_panel _button" :class="[{ selected: selectedEmojis.includes(emoji.id) },$style.emoji]" @click="selectMode ? toggleSelect(emoji) : edit(emoji)"> <button v-else class="_panel _button" :class="[{ [$style.selected]: selectedEmojis.includes(emoji.id) },$style.emoji]" @click="selectMode ? toggleSelect(emoji) : edit(emoji)">
<img :src="emoji.url" :class="$style.img" :alt="emoji.name"/> <img :src="emoji.url" :class="$style.img" :alt="emoji.name"/>
<div :class="$style.body"> <div :class="$style.body">
<div :class="$style.name" class="_monospace">{{ emoji.name }}</div> <div :class="$style.name" class="_monospace">{{ emoji.name }}</div>
@ -66,11 +66,12 @@ const pagination = {
}; };
const selectAll = () => { const selectAll = () => {
if (selectedEmojis.value.length > 0) {
selectedEmojis.value = []; if (selectedEmojis.value.length > 0) {
} else { selectedEmojis.value = [];
selectedEmojis.value = emojisPaginationComponent.value.items.map(item => item.id); } else {
} selectedEmojis.value = Array.from(emojisPaginationComponent.value.items.values(), item => item.id);
}
}; };
const setisSensitiveBulk = async () => { const setisSensitiveBulk = async () => {
const { canceled, result } = await os.switch1({ const { canceled, result } = await os.switch1({
@ -99,6 +100,7 @@ const setlocalOnlyBulk = async () => {
const toggleSelect = (emoji) => { const toggleSelect = (emoji) => {
console.log(selectedEmojis.value)
if (selectedEmojis.value.includes(emoji.id)) { if (selectedEmojis.value.includes(emoji.id)) {
selectedEmojis.value = selectedEmojis.value.filter(x => x !== emoji.id); selectedEmojis.value = selectedEmojis.value.filter(x => x !== emoji.id);
} else { } else {
@ -149,18 +151,6 @@ const setLisenceBulk = async () => {
emojisPaginationComponent.value.reload(); emojisPaginationComponent.value.reload();
}; };
const isLocalBulk = async () => {
const { canceled, result } = await os.inputText({
title: 'License',
});
if (canceled) return;
await os.apiWithDialog('admin/emoji/set-islocal-bulk', {
ids: selectedEmojis.value,
isLocal: result,
});
emojisPaginationComponent.value.reload();
};
const isSensitiveBulk = async () => { const isSensitiveBulk = async () => {
const { canceled, result } = await os.inputText({ const { canceled, result } = await os.inputText({
title: 'License', title: 'License',
@ -240,9 +230,10 @@ const delBulk = async () => {
border-color: var(--inputBorderHover); border-color: var(--inputBorderHover);
} }
&.selected {
border-color: var(--accent); }
} .selected {
border-color: var(--accent);
} }
.img { .img {
width: 42px; width: 42px;

View File

@ -189,7 +189,7 @@ async function done() {
dialog.value.close(); dialog.value.close();
} else { } else {
const created = isRequest const created = isRequest.value
? await os.apiWithDialog('admin/emoji/add-request', params) ? await os.apiWithDialog('admin/emoji/add-request', params)
: await os.apiWithDialog('admin/emoji/add', params); : await os.apiWithDialog('admin/emoji/add', params);

View File

@ -50,7 +50,7 @@ function menu(ev) {
text: i18n.ts.info, text: i18n.ts.info,
icon: 'ti ti-info-circle', icon: 'ti ti-info-circle',
action: () => { action: () => {
os.apiGet('emoji-requests', { name: props.emoji.name }).then(res => { os.apiGet('emoji', { name: props.emoji.name }).then(res => {
os.alert({ os.alert({
type: 'info', type: 'info',
text: `License: ${res.license}`, text: `License: ${res.license}`,