Adds support for widgets in Minimal View

This commit is contained in:
Alicia Sykes 2021-12-27 22:41:21 +00:00
parent 9ab84195c2
commit 41d9ead46b
2 changed files with 25 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<template>
<div :class="`minimal-section-inner ${selected ? 'selected' : ''} ${showAll ? 'show-all': ''}`">
<div class="section-items" v-if="selected || showAll">
<div class="section-items" v-if="items && (selected || showAll)">
<Item
v-for="(item, index) in items"
:id="`${index}_${makeId(item.title)}`"
@ -22,6 +22,15 @@
@triggerModal="triggerModal"
/>
</div>
<div v-if="widgets && (selected || showAll)">
<WidgetBase
v-for="(widget, widgetIndx) in widgets"
:key="widgetIndx"
:widget="widget"
:index="widgetIndx"
@navigateToSection="navigateToSection"
/>
</div>
<IframeModal
:ref="`iframeModal-${groupId}`"
:name="`iframeModal-${groupId}`"
@ -31,7 +40,9 @@
</template>
<script>
import router from '@/router';
import Item from '@/components/LinkItems/Item.vue';
import WidgetBase from '@/components/Widgets/WidgetBase';
import IframeModal from '@/components/LinkItems/IframeModal.vue';
export default {
@ -42,6 +53,7 @@ export default {
icon: String,
displayData: Object,
items: Array,
widgets: Array,
itemSize: String,
modalOpen: Boolean,
index: Number,
@ -55,6 +67,7 @@ export default {
},
components: {
Item,
WidgetBase,
IframeModal,
},
methods: {
@ -80,6 +93,13 @@ export default {
if (interval < 1) interval = 0;
return interval;
},
/* Navigate to the section's single-section view page */
navigateToSection() {
const parse = (section) => section.replace(' ', '-').toLowerCase().trim();
const sectionIdentifier = parse(this.title);
router.push({ path: `/home/${sectionIdentifier}` });
this.closeContextMenu();
},
},
};
</script>

View File

@ -34,6 +34,7 @@
:icon="section.icon || undefined"
:groupId="`section-${index}`"
:items="filterTiles(section.items)"
:widgets="section.widgets"
:selected="selectedSection === index"
:showAll="!tabbedView"
itemSize="small"
@ -104,7 +105,9 @@ export default {
else {
let itemsFound = true;
this.sections.forEach((section) => {
if (this.filterTiles(section.items).length > 0) itemsFound = false;
if (section.widgets || this.filterTiles(section.items).length > 0) {
itemsFound = false;
}
});
return itemsFound;
}