From 5cf4fd4831930d291400b44983988673c2adb493 Mon Sep 17 00:00:00 2001 From: Kelani Tolulope Date: Tue, 25 Jul 2023 15:33:08 +0100 Subject: [PATCH] Fix sub pages to be shown in navigation block configurator --- .../components/PageBlocks/Navigation/Base.vue | 5 +-- .../PageBlocks/Navigation/Configurator.vue | 11 +++--- .../Navigation/NavTypes/ComposePage.vue | 35 +++++++++++-------- .../Navigation/NavTypes/Dropdown.vue | 11 +++--- .../types/page-block/navigation/index.ts | 7 ++-- .../src/components/input/CInputCheckbox.vue | 1 - 6 files changed, 37 insertions(+), 33 deletions(-) diff --git a/client/web/compose/src/components/PageBlocks/Navigation/Base.vue b/client/web/compose/src/components/PageBlocks/Navigation/Base.vue index b8d15a3da5..50f11624bc 100644 --- a/client/web/compose/src/components/PageBlocks/Navigation/Base.vue +++ b/client/web/compose/src/components/PageBlocks/Navigation/Base.vue @@ -90,6 +90,7 @@
@@ -140,8 +141,8 @@ export default { return (navItem.type === 'compose' && navItem.options.item.displaySubPages) }, - getSubPages (selfID) { - return this.pages.filter(value => value.selfID === selfID && value.moduleID === NoID) || [] + getSubPages (pageID) { + return this.pages.filter(value => value.selfID === pageID && value.moduleID === NoID) || [] }, selectTargetOption (target) { diff --git a/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue b/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue index 00d442cf94..f4a1248d06 100644 --- a/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue +++ b/client/web/compose/src/components/PageBlocks/Navigation/Configurator.vue @@ -73,7 +73,7 @@
-
+
{{ $t("navigation.navigationItems") }}
@@ -149,11 +149,11 @@ class="w-100" /> - - + @@ -277,8 +277,11 @@ export default { options: { backgroundColor: '#FFFFFF00', item: { + label: '', + url: '', align: 'bottom', target: 'sameTab', + displaySubPages: false, dropdown: { label: '', items: [], diff --git a/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/ComposePage.vue b/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/ComposePage.vue index 3e29ed458c..c9bf6ea148 100644 --- a/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/ComposePage.vue +++ b/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/ComposePage.vue @@ -15,7 +15,7 @@ key="pageID" v-model="options.item.pageID" :placeholder="$t('navigation.none')" - :options="tree" + :options="pageList" append-to-body :get-option-key="getOptionKey" label="title" @@ -37,19 +37,21 @@ - - + - {{ $t('navigation.displaySubPages') }} - + /> @@ -78,7 +80,11 @@ export default { data () { return { - tree: [], + pageList: [], + checkboxLabel: { + on: this.$t('general:label.yes'), + off: this.$t('general:label.no'), + }, targetOptions: [ { value: 'sameTab', text: this.$t('navigation.sameTab') }, { value: 'newTab', text: this.$t('navigation.newTab') }, @@ -87,28 +93,27 @@ export default { }, created () { - this.loadTree() + this.loadPages() }, methods: { selectedPageChildren (pageID) { - const tree = this.tree ? this.tree.find(t => t.pageID === pageID) : {} - return tree && tree.children ? tree.children.length > 0 : false + return this.pageList.filter(value => value.selfID === pageID && value.moduleID === NoID) || [] }, - loadTree () { + loadPages () { const { namespaceID } = this.namespace this.$ComposeAPI .pageList({ namespaceID, sort: 'title' }) - .then(({ set: tree }) => { - this.tree = tree.map(p => new compose.Page(p)).filter(p => p.moduleID === NoID) + .then(({ set: pages }) => { + this.pageList = pages.map(p => new compose.Page(p)).filter(p => p.moduleID === NoID) }) .catch(this.toastErrorHandler(this.$t('notification:page.loadFailed'))) }, updateLabelValue (pageID) { if (!this.options.item.label) { - const composePage = this.tree.find(t => t.pageID === pageID) + const composePage = this.pageList.find(t => t.pageID === pageID) this.options.item.label = composePage ? composePage.title : '' } }, diff --git a/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/Dropdown.vue b/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/Dropdown.vue index fd7b04b4cf..540f87ffaf 100644 --- a/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/Dropdown.vue +++ b/client/web/compose/src/components/PageBlocks/Navigation/NavTypes/Dropdown.vue @@ -50,10 +50,7 @@ {{ $t("navigation.url") }} - + {{ $t('navigation.openIn') }} - - + ): void { if (!o) return + Apply(this.options, o, String, 'magnifyOption') + this.options.navigationItems = (o.navigationItems || []).map(f => new NavigationItem(f)) - if (o.display) { - this.options.display = o.display - } + this.options.display = { ...this.options.display, ...o.display } - Apply(this.options, o, String, 'magnifyOption') } static makeNavigationItem (item?: NavigationItemInput): NavigationItem { diff --git a/lib/vue/src/components/input/CInputCheckbox.vue b/lib/vue/src/components/input/CInputCheckbox.vue index 1a845b8cb0..af456c6d67 100644 --- a/lib/vue/src/components/input/CInputCheckbox.vue +++ b/lib/vue/src/components/input/CInputCheckbox.vue @@ -38,7 +38,6 @@ export default { labels: { type: Object, - required: true, default: () => ({}), },