-
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 Portlet Instances Preview Drawer - MEED-6921 - Meeds-io/MIP…
- Loading branch information
Showing
9 changed files
with
121 additions
and
13 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
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
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
99 changes: 99 additions & 0 deletions
99
...ut-webapp/src/main/webapp/vue-app/portlets/components/portlets/drawer/InstancesDrawer.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,99 @@ | ||
<!-- | ||
|
||
This file is part of the Meeds project (https://meeds.io/). | ||
|
||
Copyright (C) 2020 - 2024 Meeds Association contact@meeds.io | ||
|
||
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> | ||
<exo-drawer | ||
ref="drawer" | ||
id="portletInstancesDrawer" | ||
v-model="drawer" | ||
allow-expand | ||
right> | ||
<template #title> | ||
{{ $t('portlets.portletInstancesList') }} | ||
</template> | ||
<template v-if="drawer" #content> | ||
<div v-if="applications.length" class="my-4"> | ||
<v-list-item | ||
v-for="application in applications" | ||
:key="application.id" | ||
dense> | ||
<v-list-item-content> | ||
<v-list-item-title class="subtitle-2 text-color"> | ||
<v-card | ||
v-on="application.illustrationId && { | ||
click: () => openIllustration(application) | ||
}" | ||
flat> | ||
{{ application.name }} | ||
</v-card> | ||
</v-list-item-title> | ||
</v-list-item-content> | ||
<v-list-item-action class="my-auto me-4"> | ||
<v-btn | ||
:disabled="!application.illustrationId" | ||
class="transparent d-flex align-center justify-center" | ||
icon | ||
@click="openIllustration(application)"> | ||
<v-icon class="icon-default-color">fa-eye</v-icon> | ||
</v-btn> | ||
</v-list-item-action> | ||
</v-list-item> | ||
</div> | ||
<div v-else class="d-flex align-center justify-center pa-4 subtitle-1"> | ||
{{ $t('portlets.noPortletInstancesYet') }} | ||
</div> | ||
</template> | ||
</exo-drawer> | ||
</template> | ||
<script> | ||
export default { | ||
data: () => ({ | ||
drawer: false, | ||
contentId: null, | ||
}), | ||
computed: { | ||
applications() { | ||
const applications = this.contentId && this.$root.portletInstances.filter(a => a.contentId === this.contentId) || []; | ||
applications.sort((a, b) => this.$root.collator.compare(a.name.toLowerCase(), b.name.toLowerCase())); | ||
return applications; | ||
}, | ||
}, | ||
created() { | ||
this.$root.$on('portlets-instances-drawer', this.open); | ||
}, | ||
beforeDestroy() { | ||
this.$root.$off('portlets-instances-drawer', this.open); | ||
}, | ||
methods: { | ||
open(contentId) { | ||
this.contentId = contentId; | ||
this.$nextTick().then(() => this.$refs.drawer.open()); | ||
}, | ||
openIllustration(application) { | ||
const illustrationId = application.illustrationId; | ||
const illustrationSrc = `${eXo.env.portal.context}/${eXo.env.portal.rest}/v1/social/attachments/portletInstance/${application.id}/${illustrationId}`; | ||
this.$root.$emit('layout-illustration-preview', illustrationSrc); | ||
}, | ||
close() { | ||
this.$refs.drawer.close(); | ||
}, | ||
}, | ||
}; | ||
</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