3
0

Add UI/UX improvements

This commit is contained in:
Jože Fortun
2023-04-19 14:31:22 +02:00
parent f461866a6c
commit 7d9d52257c
5 changed files with 49 additions and 11 deletions

View File

@@ -303,7 +303,7 @@
:hide-save="hideSave" :hide-save="hideSave"
hide-clone hide-clone
:disable-save="disableSave" :disable-save="disableSave"
@delete="handleDelete" @delete="handleDelete()"
@save="handleSave()" @save="handleSave()"
@saveAndClose="handleSave({ closeOnSuccess: true })" @saveAndClose="handleSave({ closeOnSuccess: true })"
/> />

View File

@@ -109,6 +109,7 @@
<related-pages <related-pages
:namespace="namespace" :namespace="namespace"
:module="m" :module="m"
size="sm"
/> />
<b-button-group <b-button-group

View File

@@ -1,6 +1,5 @@
<template> <template>
<div <div
v-if="page"
class="py-3" class="py-3"
> >
<portal to="topbar-title"> <portal to="topbar-title">
@@ -26,7 +25,6 @@
</b-button> </b-button>
<page-translator <page-translator
v-if="page"
:page.sync="page" :page.sync="page"
:page-layouts.sync="layouts" :page-layouts.sync="layouts"
style="margin-left:2px;" style="margin-left:2px;"
@@ -46,7 +44,17 @@
</b-button-group> </b-button-group>
</portal> </portal>
<b-container fluid="xl"> <div
v-if="processing"
class="d-flex align-items-center justify-content-center h-100"
>
<b-spinner />
</div>
<b-container
v-else
fluid="xl"
>
<div <div
class="d-flex align-items-center mt-1 mb-2" class="d-flex align-items-center mt-1 mb-2"
> >
@@ -706,7 +714,7 @@
<editor-toolbar <editor-toolbar
:back-link="{ name: 'admin.pages' }" :back-link="{ name: 'admin.pages' }"
:hide-delete="hideDelete" :hide-delete="hideDelete"
:hide-save="!page.canUpdatePage" :hide-save="hideSave"
:disable-save="disableSave" :disable-save="disableSave"
:processing="processing" :processing="processing"
@clone="handleClone()" @clone="handleClone()"
@@ -840,11 +848,15 @@ export default {
}, },
disableSave () { disableSave () {
return [this.titleState, this.handleState].includes(false) || this.layouts.some(l => !l.meta.title || handle.handleState(l.handle) === false) return !this.page || [this.titleState, this.handleState].includes(false) || this.layouts.some(l => !l.meta.title || handle.handleState(l.handle) === false)
}, },
hideDelete () { hideDelete () {
return this.hasChildren || !this.page.canDeletePage || !!this.page.deletedAt return !this.page || this.hasChildren || !this.page.canDeletePage || !!this.page.deletedAt
},
hideSave () {
return !this.page || !this.page.canUpdatePage
}, },
showDeleteDropdown () { showDeleteDropdown () {
@@ -936,7 +948,7 @@ export default {
this.processing = true this.processing = true
const { namespaceID } = this.namespace const { namespaceID } = this.namespace
this.findPageByID({ namespaceID, pageID }).then((page) => { this.findPageByID({ namespaceID, pageID, force: true }).then((page) => {
this.page = page.clone() this.page = page.clone()
return this.fetchAttachments() return this.fetchAttachments()
}).then(this.fetchLayouts) }).then(this.fetchLayouts)

View File

@@ -17,8 +17,15 @@
{{ title }} {{ title }}
</portal> </portal>
<div
v-if="!layout"
class="d-flex align-items-center justify-content-center h-100"
>
<b-spinner />
</div>
<grid <grid
v-if="blocks" v-else-if="blocks"
v-bind="$props" v-bind="$props"
:errors="errors" :errors="errors"
:record="record" :record="record"
@@ -380,7 +387,12 @@ export default {
}, },
async determineLayout (pageLayoutID) { async determineLayout (pageLayoutID) {
const expressions = await this.evaluateLayoutExpressions() let expressions = {}
// Only evaluate if one of the layouts has an expressions variable
if (this.layouts.some(({ config = {} }) => config.visibility.expression)) {
expressions = await this.evaluateLayoutExpressions()
}
// Check layouts for expressions/roles and find the first one that fits // Check layouts for expressions/roles and find the first one that fits
this.layout = this.layouts.find(l => { this.layout = this.layouts.find(l => {

View File

@@ -58,6 +58,13 @@
class="flex-grow-1 overflow-auto d-flex flex-column" class="flex-grow-1 overflow-auto d-flex flex-column"
/> />
<div
v-else-if="!layout"
class="d-flex align-items-center justify-content-center w-100"
>
<b-spinner />
</div>
<grid <grid
v-else-if="blocks" v-else-if="blocks"
:namespace="namespace" :namespace="namespace"
@@ -238,7 +245,13 @@ export default {
async determineLayout () { async determineLayout () {
this.layouts = this.getPageLayouts(this.page.pageID) this.layouts = this.getPageLayouts(this.page.pageID)
const expressions = await this.evaluateLayoutExpressions() let expressions = {}
// Only evaluate if one of the layouts has an expressions variable
if (this.layouts.some(({ config = {} }) => config.visibility.expression)) {
this.pageTitle = this.page.title
expressions = await this.evaluateLayoutExpressions()
}
// Check layouts for expressions/roles and find the first one that fits // Check layouts for expressions/roles and find the first one that fits
this.layout = this.layouts.find(({ pageLayoutID, config = {} }) => { this.layout = this.layouts.find(({ pageLayoutID, config = {} }) => {