-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Page Template Illustration Preview - MEED-6849 - Meeds-io/M…
- Loading branch information
Showing
6 changed files
with
162 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...ain/webapp/vue-app/page-templates-management/components/list/PageTemplateIllustration.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!-- | ||
This file is part of the Meeds project (https://meeds.io/). | ||
Copyright (C) 2020 - 2024 Meeds Association [email protected] | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
<template> | ||
<v-hover v-model="hover" :disabled="!illustrationId"> | ||
<div | ||
:aria-label="$t('pageTemplate.label.preview', {0: name})" | ||
class="position-relative full-height full-width d-flex align-center justify-center"> | ||
<v-expand-transition> | ||
<v-card | ||
v-if="hover" | ||
class="d-flex absolute-full-size z-index-one align-center justify-center transition-fast-in-fast-out grey opacity-5" | ||
flat | ||
@click="openIllustration"> | ||
<v-icon color="white">fa-search</v-icon> | ||
</v-card> | ||
</v-expand-transition> | ||
<v-img | ||
:src="illustrationSrc" | ||
max-height="30" | ||
max-width="60" /> | ||
</div> | ||
</v-hover> | ||
</template> | ||
<script> | ||
export default { | ||
props: { | ||
pageTemplate: { | ||
type: Object, | ||
default: null, | ||
}, | ||
}, | ||
data: () => ({ | ||
hover: false, | ||
}), | ||
computed: { | ||
pageTemplateId() { | ||
return this.pageTemplate?.id; | ||
}, | ||
name() { | ||
return this.$te(this.pageTemplate?.name) ? this.$t(this.pageTemplate?.name) : this.pageTemplate?.name; | ||
}, | ||
illustrationId() { | ||
return this.pageTemplate?.illustrationId; | ||
}, | ||
illustrationSrc() { | ||
return this.illustrationId && `${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/social/attachments/pageTemplate/${this.pageTemplateId}/${this.illustrationId}` || '/layout/images/page-templates/DefaultPreview.webp'; | ||
}, | ||
}, | ||
methods: { | ||
openIllustration() { | ||
this.$root.$emit('page-templates-illustration-preview', this.illustrationSrc); | ||
}, | ||
}, | ||
}; | ||
</script> |
80 changes: 80 additions & 0 deletions
80
...e-app/page-templates-management/components/list/PageTemplateIllustrationPreviewDialog.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!-- | ||
This file is part of the Meeds project (https://meeds.io/). | ||
Copyright (C) 2020 - 2024 Meeds Association [email protected] | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program; if not, write to the Free Software Foundation, | ||
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
--> | ||
<template> | ||
<v-dialog | ||
v-model="dialog" | ||
:persistent="false" | ||
height="100%" | ||
max-height="100%" | ||
width="100%" | ||
max-width="100%" | ||
overlay-opacity="0.9" | ||
content-class="overflow-y-initial full-height full-width pa-5"> | ||
<template v-if="dialog"> | ||
<div class="d-flex justify-end"> | ||
<v-btn | ||
:aria-label="$t('pageTemplate.label.close')" | ||
class="ma-4" | ||
icon | ||
@click="dialog = false"> | ||
<v-icon color="white">fa-times</v-icon> | ||
</v-btn> | ||
</div> | ||
<v-card | ||
max-height="80vh" | ||
class="transparent" | ||
flat | ||
@click="dialog = false"> | ||
<v-img | ||
:src="illustrationSrc" | ||
:aspect-ratio="2" | ||
height="80vh" | ||
contain /> | ||
</v-card> | ||
</template> | ||
</v-dialog> | ||
</template> | ||
<script> | ||
export default { | ||
data: () => ({ | ||
dialog: false, | ||
illustrationSrc: null, | ||
}), | ||
watch: { | ||
dialog() { | ||
if (this.dialog) { | ||
document.dispatchEvent(new CustomEvent('modalOpened')); | ||
} else { | ||
document.dispatchEvent(new CustomEvent('modalClosed')); | ||
} | ||
} | ||
}, | ||
created() { | ||
this.$root.$on('page-templates-illustration-preview', this.open); | ||
}, | ||
methods: { | ||
open(illustrationSrc) { | ||
this.illustrationSrc = illustrationSrc; | ||
this.dialog = true; | ||
}, | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters