Skip to content

Commit

Permalink
Merge 8b3a32b into c556597
Browse files Browse the repository at this point in the history
  • Loading branch information
hubsif authored Mar 15, 2021
2 parents c556597 + 8b3a32b commit db4e87c
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions bundles/org.openhab.ui/web/src/pages/page/page-view.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<f7-page @page:afterin="onPageAfterIn" @page:beforeout="onPageBeforeOut" hide-bars-on-scroll :style="pageStyle">
<f7-navbar v-if="!page.config.hideNavbar" :back-link="(showBackButton) ? $t('page.navbar.back') : undefined">
<f7-navbar v-if="!page || !page.config.hideNavbar" :back-link="(showBackButton) ? $t('page.navbar.back') : undefined">
<f7-nav-left v-if="!showBackButton">
<f7-link icon-ios="f7:menu" icon-aurora="f7:menu" icon-md="material:menu" panel-open="left" />
</f7-nav-left>
<f7-nav-title>{{ (ready) ? page.config.label : '' }}</f7-nav-title>
<f7-nav-title>{{ (page) ? page.config.label : '' }}</f7-nav-title>
<f7-nav-right>
<f7-link v-if="isAdmin" icon-md="material:edit" :href="'/settings/pages/' + pageType + '/' + uid">
{{ $theme.md ? '' : $t('page.navbar.edit') }}
Expand All @@ -14,27 +14,25 @@

<f7-link v-else-if="!page.config.hideSidebarIcon" class="sidebar-icon" icon-ios="f7:menu" icon-aurora="f7:menu" icon-md="material:menu" panel-open="left" />

<f7-link v-if="$fullscreen.support && page.config.showFullscreenIcon" class="fullscreen-icon" :icon-f7="fullscreen ? 'rectangle_arrow_up_right_arrow_down_left_slash' : 'rectangle_arrow_up_right_arrow_down_left'" @click="toggleFullscreen" />
<f7-link v-if="page && $fullscreen.support && page.config.showFullscreenIcon" class="fullscreen-icon" :icon-f7="fullscreen ? 'rectangle_arrow_up_right_arrow_down_left_slash' : 'rectangle_arrow_up_right_arrow_down_left'" @click="toggleFullscreen" />

<f7-toolbar tabbar labels bottom v-if="page && pageType === 'tabs' && visibleToCurrentUser">
<f7-link v-for="(tab, idx) in page.slots.default" :key="idx" tab-link @click="onTabChange(idx)" :tab-link-active="currentTab === idx" :icon-ios="tab.config.icon" :icon-md="tab.config.icon" :icon-aurora="tab.config.icon" :text="tab.config.title" />
</f7-toolbar>

<f7-tabs v-if="page && pageType === 'tabs' && visibleToCurrentUser" :class="{notready: !ready}">
<f7-tabs v-if="page && pageType === 'tabs' && visibleToCurrentUser">
<f7-tab v-for="(tab, idx) in page.slots.default" :key="idx" :tab-active="currentTab === idx">
<component v-if="currentTab === idx" :is="tabComponent(tab)" :context="tabContext(tab)" @command="onCommand" />
</f7-tab>
</f7-tabs>

<component :is="page.component" v-else-if="page && visibleToCurrentUser" :context="context" :class="{notready: !ready}" @command="onCommand" />
<component :is="page.component" v-else-if="page && visibleToCurrentUser" :context="context" @command="onCommand" />

<empty-state-placeholder v-if="!visibleToCurrentUser" icon="multiply_circle_fill" title="page.unavailable.title" text="page.unavailable.text" />
</f7-page>
</template>

<style lang="stylus">
.notready
visibility hidden
.sidebar-icon
position fixed
top 8px
Expand All @@ -60,9 +58,7 @@ export default {
data () {
return {
currentTab: 0,
// ready: false,
loading: false,
// page: {}
fullscreen: this.$fullscreen.getState()
}
},
Expand Down Expand Up @@ -101,11 +97,8 @@ export default {
return 'unknown'
}
},
ready () {
return this.page
},
isAdmin () {
return this.ready && this.$store.getters.isAdmin
return this.page && this.$store.getters.isAdmin
},
visibleToCurrentUser () {
if (!this.page || !this.page.config || !this.page.config.visibleTo) return true
Expand Down

0 comments on commit db4e87c

Please sign in to comment.