mirror of
https://github.com/romancm/gamebrary
synced 2024-11-15 07:57:19 +00:00
allow to select wallpaper from preview modal
This commit is contained in:
parent
e01e84aa57
commit
b711693162
2 changed files with 39 additions and 8 deletions
|
@ -1,14 +1,26 @@
|
||||||
<template lang="html">
|
<template lang="html">
|
||||||
<b-modal
|
<b-modal
|
||||||
id="previewWallpaper"
|
id="previewWallpaper"
|
||||||
|
:header-bg-variant="darkTheme ? 'dark' : null"
|
||||||
|
:header-text-variant="darkTheme ? 'white' : null"
|
||||||
|
:body-bg-variant="darkTheme ? 'dark' : null"
|
||||||
|
:body-text-variant="darkTheme ? 'white' : null"
|
||||||
hide-footer
|
hide-footer
|
||||||
size="xl"
|
size="xl"
|
||||||
>
|
>
|
||||||
<template v-slot:modal-header="{ close }">
|
<template v-slot:modal-header="{ close }">
|
||||||
<modal-header
|
<modal-header
|
||||||
:title="wallpaper.name"
|
title="Wallpaper preview"
|
||||||
|
:subtitle="wallpaper.name"
|
||||||
@close="close"
|
@close="close"
|
||||||
/>
|
>
|
||||||
|
<b-button
|
||||||
|
v-if="selectable"
|
||||||
|
@click="select"
|
||||||
|
>
|
||||||
|
Select
|
||||||
|
</b-button>
|
||||||
|
</modal-header>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<b-img
|
<b-img
|
||||||
|
@ -20,9 +32,27 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
wallpaper: Object,
|
selectable: Boolean,
|
||||||
|
wallpaper: {
|
||||||
|
type: [Object, Boolean],
|
||||||
|
default: () => {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['darkTheme']),
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
select() {
|
||||||
|
this.$emit('selected', this.wallpaper);
|
||||||
|
|
||||||
|
this.$bvModal.hide('previewWallpaper');
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template lang="html">
|
<template lang="html">
|
||||||
<div class="wallpapers">
|
<div class="wallpapers">
|
||||||
<preview-wallpaper-modal
|
<preview-wallpaper-modal
|
||||||
v-if="activeWallpaper"
|
|
||||||
:wallpaper="activeWallpaper"
|
:wallpaper="activeWallpaper"
|
||||||
|
:selectable="selectable"
|
||||||
|
@selected="selected"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<b-card
|
<b-card
|
||||||
v-for="wallpaper in wallpapers"
|
v-for="wallpaper in wallpapers"
|
||||||
@click="openModal(wallpaper)"
|
|
||||||
:key="wallpaper.name"
|
:key="wallpaper.name"
|
||||||
:img-src="wallpaper.url"
|
:img-src="wallpaper.url"
|
||||||
:img-alt="wallpaper.name"
|
:img-alt="wallpaper.name"
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
bg-variant="transparent"
|
bg-variant="transparent"
|
||||||
img-width="180"
|
img-width="180"
|
||||||
class="mb-3 overflow-hidden word-wrap clickable"
|
class="mb-3 overflow-hidden word-wrap clickable"
|
||||||
|
@click="openModal(wallpaper)"
|
||||||
>
|
>
|
||||||
<h6>
|
<h6>
|
||||||
{{ wallpaper.name }}
|
{{ wallpaper.name }}
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
|
|
||||||
<b-button
|
<b-button
|
||||||
variant="danger"
|
variant="danger"
|
||||||
@click="confirmDeleteWallpaper(wallpaper)"
|
@click.stop="confirmDeleteWallpaper(wallpaper)"
|
||||||
>
|
>
|
||||||
<i class="fas fa-trash-alt fa-fw" aria-hidden />
|
<i class="fas fa-trash-alt fa-fw" aria-hidden />
|
||||||
</b-button>
|
</b-button>
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
<b-button
|
<b-button
|
||||||
v-if="selectable"
|
v-if="selectable"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
@click="handleClick(wallpaper)"
|
@click.stop="selected(wallpaper)"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
v-if="saving"
|
v-if="saving"
|
||||||
|
@ -78,7 +79,7 @@ export default {
|
||||||
this.$bvModal.show('previewWallpaper');
|
this.$bvModal.show('previewWallpaper');
|
||||||
},
|
},
|
||||||
|
|
||||||
handleClick(wallpaper) {
|
selected(wallpaper) {
|
||||||
if (this.selectable) {
|
if (this.selectable) {
|
||||||
this.$emit('selected', wallpaper);
|
this.$emit('selected', wallpaper);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue