diff --git a/layout-webapp/src/main/resources/locale/portlet/SiteNavigation_en.properties b/layout-webapp/src/main/resources/locale/portlet/SiteNavigation_en.properties index 52cad170..e030bca7 100644 --- a/layout-webapp/src/main/resources/locale/portlet/SiteNavigation_en.properties +++ b/layout-webapp/src/main/resources/locale/portlet/SiteNavigation_en.properties @@ -115,3 +115,4 @@ siteNavigation.label.nodeType.group.caption=Choose this option if you want the n siteNavigation.label.nodeType.pageOrLink.caption=Choose this option if you want the node to be linked with a new page, an existing page or a web link siteNavigation.errorCreatingNode=An unkown error occurred while saving item siteNavigation.errorUpdatingNode=An unkown error occurred while saving item +layout.rootNodeCantBeDeleted=This cannot be deleted. Disable it if needed. diff --git a/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItem.vue b/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItem.vue index 9f80481a..d33915e5 100644 --- a/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItem.vue +++ b/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItem.vue @@ -69,10 +69,11 @@ + class="mb-1 mt-0 py-0"> @@ -145,6 +147,10 @@ export default { type: Object, default: null, }, + rootNodeId: { + type: String, + default: null, + }, canMoveUp: { type: Boolean, default: () => false, @@ -197,6 +203,9 @@ export default { navigationNodeType() { return !this.navigationNode.pageKey && 'group' || this.navigationNode.pageLink && 'link' || this.navigationNode.pageKey && 'page'; }, + canDelete() { + return Number(this.navigationNode.id) !== Number(this.rootNodeId); + }, visibilityIcon() { switch (this.navigationNode?.visibility) { case 'TEMPORAL': @@ -251,12 +260,6 @@ export default { }); }, methods: { - canMoveUpChildNode(navigationNode) { - return this.navigationNode.children.indexOf(navigationNode) > 0; - }, - canMoveDownChildNode(navigationNode) { - return this.navigationNode.children.indexOf(navigationNode) < this.navigationNode.children.length - 1; - }, moveUpChildNode(navigationNodeId) { if (this.navigationNode.children.length) { const index = this.navigationNode?.children?.findIndex?.(navigationNode => navigationNode.id === navigationNodeId); diff --git a/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItemMenu.vue b/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItemMenu.vue index b26d6b50..d8e53773 100644 --- a/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItemMenu.vue +++ b/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodeItemMenu.vue @@ -35,7 +35,7 @@ + class="text-body menu-text-color"> {{ $t('siteNavigation.drawer.addNode.title') }} - + + class="text-body menu-text-color"> {{ $t('siteNavigation.label.copyLink') }} - + {{ $t('siteNavigation.label.editLayout') }} - + {{ $t('siteNavigation.drawer.editNode.title') }} - + {{ $t('siteNavigation.label.cutNode') }} - + {{ $t('siteNavigation.label.copyNode') }} - + {{ $t('siteNavigation.label.pasteNode') }} - + {{ $t('siteNavigation.label.moveUp') }} @@ -170,13 +155,11 @@ mdi-mouse-move-down - + {{ $t('siteNavigation.label.moveDown') }} @@ -186,28 +169,38 @@ fas fa-shield-alt - + {{ $t('siteNavigation.label.manageAccess') }} - - - - fas fa-trash - - - - {{ $t('siteNavigation.label.delete') }} - - + + + {{ $t('layout.rootNodeCantBeDeleted') }} + @@ -224,6 +217,10 @@ export default { type: Object, default: null, }, + canDelete: { + type: Boolean, + default: false, + }, canMoveUp: { type: Boolean, default: () => false, @@ -239,7 +236,7 @@ export default { pasteMode: { type: String, default: null, - } + }, }, data: () => ({ displayActionMenu: false, diff --git a/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodesList.vue b/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodesList.vue index 17c4c270..454a0c3a 100644 --- a/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodesList.vue +++ b/layout-webapp/src/main/webapp/vue-app/common-layout-components/components/site-navigation/NodesList.vue @@ -31,7 +31,8 @@ :can-move-up="canMoveUpNode(props.item)" :can-move-down="canMoveDownNode(props.item)" :hide-children="hideChildren" - :expanded="expanded" /> + :expanded="expanded" + :root-node-id="rootNodeId" /> @@ -59,6 +60,9 @@ export default { }, }, computed: { + rootNodeId() { + return this.navigationNodes?.length === 1 && this.navigationNodes[0].id; + }, headers() { return [ {