mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
edit and delete rom dialog migrated to rdialog
This commit is contained in:
@@ -11,7 +11,7 @@ import { useDisplay, useTheme } from "vuetify";
|
||||
|
||||
// Props
|
||||
const theme = useTheme();
|
||||
const { xs, mdAndDown, lgAndUp } = useDisplay();
|
||||
const { mdAndDown, lgAndUp } = useDisplay();
|
||||
const router = useRouter();
|
||||
const show = ref(false);
|
||||
const romsStore = storeRoms();
|
||||
@@ -69,8 +69,8 @@ function closeDialog() {
|
||||
scroll-content
|
||||
:width="lgAndUp ? '900px' : mdAndDown ? '570px' : '85vw'"
|
||||
>
|
||||
<template #toolbar>
|
||||
<v-row class="justify-center">
|
||||
<template #prepend>
|
||||
<v-row class="justify-center my-2 px-6">
|
||||
<v-list-item>
|
||||
<span>Deleting the following</span>
|
||||
<span class="text-romm-accent-1 mx-1">{{ roms.length }}</span>
|
||||
@@ -97,12 +97,16 @@ function closeDialog() {
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</template>
|
||||
<template #footer>
|
||||
<v-row no-gutters class="justify-center align-center bg-primary">
|
||||
<v-btn @click="closeDialog" class="bg-terciary"> Cancel </v-btn>
|
||||
<v-btn class="text-romm-red ml-2 bg-terciary" @click="deleteRoms()">
|
||||
<template #append>
|
||||
<v-row class="justify-center my-2">
|
||||
<v-btn class="bg-terciary" @click="closeDialog" variant="flat"> Cancel </v-btn>
|
||||
<v-btn class="text-romm-red ml-2 bg-terciary" variant="flat" @click="deleteRoms">
|
||||
Confirm
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</template>
|
||||
<template #footer>
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-checkbox
|
||||
v-model="deleteFromFs"
|
||||
label="Remove from filesystem"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import GameCard from "@/components/Game/Card/Base.vue";
|
||||
import RDialog from "@/components/common/Dialog.vue";
|
||||
import romApi, { type UpdateRom } from "@/services/api/rom";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
@@ -9,7 +10,7 @@ import { useDisplay, useTheme } from "vuetify";
|
||||
|
||||
// Props
|
||||
const theme = useTheme();
|
||||
const { xs, mdAndDown, smAndDown, md, lgAndUp } = useDisplay();
|
||||
const { mdAndDown, lgAndUp } = useDisplay();
|
||||
const show = ref(false);
|
||||
const rom = ref<UpdateRom>();
|
||||
const romsStore = storeRoms();
|
||||
@@ -102,141 +103,96 @@ function closeDialog() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-dialog
|
||||
<r-dialog
|
||||
v-if="rom"
|
||||
:model-value="show"
|
||||
scroll-strategy="none"
|
||||
width="auto"
|
||||
:scrim="true"
|
||||
no-click-animation
|
||||
persistent
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
@close="closeDialog"
|
||||
v-model="show"
|
||||
icon="mdi-pencil-box"
|
||||
:width="lgAndUp ? '900px' : mdAndDown ? '570px' : '85vw'"
|
||||
>
|
||||
<v-card
|
||||
rounded="0"
|
||||
:class="{
|
||||
'content-desktop': lgAndUp,
|
||||
'content-tablet': mdAndDown,
|
||||
'content-mobile': xs,
|
||||
}"
|
||||
>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="9" sm="10" lg="11">
|
||||
<v-icon icon="mdi-pencil-box" class="ml-5" />
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn
|
||||
class="bg-terciary"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
block
|
||||
@click="closeDialog"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-toolbar>
|
||||
<v-divider />
|
||||
|
||||
<v-card-text>
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="12" lg="9">
|
||||
<v-text-field
|
||||
v-model="rom.name"
|
||||
class="py-2"
|
||||
:class="{ 'pr-4': lgAndUp }"
|
||||
label="Name"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
@keyup.enter="updateRom()"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="rom.file_name"
|
||||
class="py-2"
|
||||
:class="{ 'pr-4': lgAndUp }"
|
||||
:rules="[
|
||||
fileNameInputRules.newFileName,
|
||||
fileNameInputRules.required,
|
||||
]"
|
||||
label="File name"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
@keyup.enter="updateRom()"
|
||||
/>
|
||||
<v-textarea
|
||||
v-model="rom.summary"
|
||||
class="py-2"
|
||||
:class="{ 'pr-4': lgAndUp }"
|
||||
label="Summary"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
@keyup.enter="updateRom()"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
cols="12"
|
||||
lg="3"
|
||||
:class="{
|
||||
'my-4': mdAndDown,
|
||||
'px-10': mdAndDown,
|
||||
}"
|
||||
>
|
||||
<game-card :rom="rom" :src="imagePreviewUrl">
|
||||
<template #append-inner>
|
||||
<v-chip-group class="pa-0">
|
||||
<v-chip
|
||||
class="translucent-dark"
|
||||
:size="mdAndDown ? 'large' : 'small'"
|
||||
@click="triggerFileInput"
|
||||
label
|
||||
>
|
||||
<v-icon>mdi-pencil</v-icon>
|
||||
<v-file-input
|
||||
id="file-input"
|
||||
v-model="rom.artwork"
|
||||
accept="image/*"
|
||||
hide-details
|
||||
class="file-input"
|
||||
@change="previewImage"
|
||||
/>
|
||||
</v-chip>
|
||||
<v-chip
|
||||
class="translucent-dark"
|
||||
:size="mdAndDown ? 'large' : 'small'"
|
||||
@click="removeArtwork"
|
||||
label
|
||||
>
|
||||
<v-icon class="text-red"> mdi-delete </v-icon>
|
||||
</v-chip>
|
||||
</v-chip-group>
|
||||
</template>
|
||||
</game-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="justify-center pa-2" no-gutters>
|
||||
<v-btn class="bg-terciary" @click="closeDialog"> Cancel </v-btn>
|
||||
<v-btn class="text-romm-green ml-5 bg-terciary" @click="updateRom()">
|
||||
Apply
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<template #content>
|
||||
<v-row class="align-center pa-4" no-gutters>
|
||||
<v-col cols="12" lg="9" :class="{ 'pr-4': lgAndUp }">
|
||||
<v-text-field
|
||||
v-model="rom.name"
|
||||
class="py-2"
|
||||
label="Name"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
@keyup.enter="updateRom()"
|
||||
/>
|
||||
<v-text-field
|
||||
v-model="rom.file_name"
|
||||
class="py-2"
|
||||
:rules="[
|
||||
fileNameInputRules.newFileName,
|
||||
fileNameInputRules.required,
|
||||
]"
|
||||
label="File name"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
@keyup.enter="updateRom()"
|
||||
/>
|
||||
<v-textarea
|
||||
v-model="rom.summary"
|
||||
class="py-2"
|
||||
label="Summary"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
@keyup.enter="updateRom()"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col
|
||||
cols="12"
|
||||
lg="3"
|
||||
:class="{
|
||||
'my-4': mdAndDown,
|
||||
'px-16': mdAndDown,
|
||||
}"
|
||||
>
|
||||
<game-card :rom="rom" :src="imagePreviewUrl">
|
||||
<template #append-inner>
|
||||
<v-chip-group class="pa-0">
|
||||
<v-chip
|
||||
class="translucent-dark"
|
||||
:size="mdAndDown ? 'large' : 'small'"
|
||||
@click="triggerFileInput"
|
||||
label
|
||||
>
|
||||
<v-icon>mdi-pencil</v-icon>
|
||||
<v-file-input
|
||||
id="file-input"
|
||||
v-model="rom.artwork"
|
||||
accept="image/*"
|
||||
hide-details
|
||||
class="file-input"
|
||||
@change="previewImage"
|
||||
/>
|
||||
</v-chip>
|
||||
<v-chip
|
||||
class="translucent-dark"
|
||||
:size="mdAndDown ? 'large' : 'small'"
|
||||
@click="removeArtwork"
|
||||
label
|
||||
>
|
||||
<v-icon class="text-red"> mdi-delete </v-icon>
|
||||
</v-chip>
|
||||
</v-chip-group>
|
||||
</template>
|
||||
</game-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<template #append>
|
||||
<v-row class="justify-center pa-2" no-gutters>
|
||||
<v-btn class="bg-terciary" @click="closeDialog" variant="flat"> Cancel </v-btn>
|
||||
<v-btn class="text-romm-green ml-5 bg-terciary" @click="updateRom" variant="flat">
|
||||
Apply
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</template>
|
||||
</r-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.content-desktop {
|
||||
width: 900px;
|
||||
}
|
||||
.content-tablet {
|
||||
width: 620px;
|
||||
}
|
||||
.content-mobile {
|
||||
width: 85vw;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, useSlots } from "vue";
|
||||
import EmptyGame from "@/components/Gallery/EmptyGame.vue";
|
||||
import EmptyPlatform from "@/components/Gallery/EmptyPlatform.vue";
|
||||
import RommIso from "@/components/common/RommIso.vue";
|
||||
import { onMounted, ref, useSlots } from "vue";
|
||||
|
||||
// Props
|
||||
withDefaults(
|
||||
@@ -32,6 +32,8 @@ withDefaults(
|
||||
);
|
||||
const emit = defineEmits(["update:modelValue", "close"]);
|
||||
const hasToolbarSlot = ref(false);
|
||||
const hasPrependSlot = ref(false);
|
||||
const hasAppendSlot = ref(false);
|
||||
const hasFooterSlot = ref(false);
|
||||
|
||||
// Functions
|
||||
@@ -43,6 +45,8 @@ function closeDialog() {
|
||||
onMounted(() => {
|
||||
const slots = useSlots();
|
||||
hasToolbarSlot.value = !!slots.toolbar;
|
||||
hasPrependSlot.value = !!slots.prepend;
|
||||
hasAppendSlot.value = !!slots.append;
|
||||
hasFooterSlot.value = !!slots.footer;
|
||||
});
|
||||
</script>
|
||||
@@ -80,12 +84,14 @@ onMounted(() => {
|
||||
|
||||
<v-divider />
|
||||
|
||||
<template v-if="hasToolbarSlot">
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<slot name="toolbar"></slot>
|
||||
</v-toolbar>
|
||||
<v-divider />
|
||||
</template>
|
||||
<v-toolbar v-if="hasToolbarSlot" density="compact" class="bg-terciary">
|
||||
<slot name="toolbar"></slot>
|
||||
</v-toolbar>
|
||||
<v-divider />
|
||||
|
||||
<v-card-text v-if="hasPrependSlot" class="pa-1 bg-terciary">
|
||||
<slot name="prepend"></slot>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-text class="pa-1" :class="{ scroll: scrollContent }">
|
||||
<v-row
|
||||
@@ -113,6 +119,10 @@ onMounted(() => {
|
||||
|
||||
<slot name="content"></slot>
|
||||
</v-card-text>
|
||||
<v-card-text v-if="hasAppendSlot" class="pa-1 bg-terciary">
|
||||
<slot name="append"></slot>
|
||||
</v-card-text>
|
||||
|
||||
<template v-if="hasFooterSlot">
|
||||
<v-divider />
|
||||
<v-toolbar class="bg-terciary" density="compact">
|
||||
|
||||
Reference in New Issue
Block a user