From cb2e7c9c5f0d7e1b7de78758a8cb17692dc02432 Mon Sep 17 00:00:00 2001 From: philippoehrlein Date: Tue, 26 Nov 2024 13:54:21 +0100 Subject: [PATCH] fix: enabled site --- Readme.md | 2 +- composer.json | 2 +- config/api.php | 1 - index.css | 2 +- index.js | 2 +- package.json | 2 +- src/components/NavigationRoot.vue | 3 +-- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index 9bc4dd7..7c55573 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # Kirby Navigation Groups ![License](https://img.shields.io/badge/license-MIT-green) -![Version](https://img.shields.io/badge/version-1.0.0-blue) +![Version](https://img.shields.io/badge/version-1.0.1-blue) A plugin for Kirby CMS that allows you to organize your navigation items into groups. diff --git a/composer.json b/composer.json index 4697b10..c60e991 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "A Kirby Plugin for grouping navigation items", "type": "kirby-plugin", "license": "MIT", - "version": "1.0.0", + "version": "1.0.1", "authors": [ { "name": "Philipp Oehrlein", diff --git a/config/api.php b/config/api.php index 84a6291..6fedd31 100644 --- a/config/api.php +++ b/config/api.php @@ -8,7 +8,6 @@ 'action' => function () { $path = get('path'); $status = get('status', 'listed'); - $status_values = ['all', 'listed', 'unlisted', 'published']; $status = $status === 'all' ? 'published' : $status; diff --git a/index.css b/index.css index 83b2c1c..9bb0aed 100644 --- a/index.css +++ b/index.css @@ -1 +1 @@ -.k-draggable-item[data-v-6c660d46]{width:100%}.k-status-icon[data-v-6c660d46]{--icon-size: 15px}.k-frame.k-icon-frame.k-item-image svg[data-v-6c660d46]{color:var(--color-grey-500)}.k-navigation-group[data-v-497a8b13]{width:100%;background-color:var(--color-white);border-radius:var(--rounded-md);box-shadow:var(--shadow);position:relative}.k-item-sort-handle[data-v-497a8b13]{position:absolute;left:-28px;top:4px;opacity:0;transition:opacity 0s ease-in-out .15s}.k-navigation-group:hover .k-item-sort-handle[data-v-497a8b13]{opacity:1}.k-navigation-group-header[data-v-497a8b13]{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--color-gray-200);padding:0 var(--spacing-1);height:var(--height-xl)}.k-navigation-group-header h3[data-v-497a8b13]{white-space:nowrap;overflow:hidden;font-size:var(--text-sm);line-height:1.4;text-overflow:ellipsis}.k-navigation-group-header-title[data-v-497a8b13]{display:flex;align-items:center;overflow:hidden;padding:var(--spacing-2) 0;gap:var(--spacing-2)}.k-navigation-group-footer[data-v-497a8b13]{border-top:1px solid var(--color-gray-200);padding:var(--spacing-1)}.k-draggable-group[data-v-497a8b13]{display:flex;flex-direction:column;gap:2px;width:100%;background-color:var(--color-gray-100);padding:var(--spacing-2) var(--spacing-1)}.k-empty[data-v-497a8b13]{height:40px;background-color:var(--color-gray-100)}.k-draggable-container[data-v-261910de]{display:flex;flex-direction:column;gap:var(--spacing-1);padding:0 0 var(--spacing-2) 0} +.k-draggable-item[data-v-6c660d46]{width:100%}.k-status-icon[data-v-6c660d46]{--icon-size: 15px}.k-frame.k-icon-frame.k-item-image svg[data-v-6c660d46]{color:var(--color-grey-500)}.k-navigation-group[data-v-497a8b13]{width:100%;background-color:var(--color-white);border-radius:var(--rounded-md);box-shadow:var(--shadow);position:relative}.k-item-sort-handle[data-v-497a8b13]{position:absolute;left:-28px;top:4px;opacity:0;transition:opacity 0s ease-in-out .15s}.k-navigation-group:hover .k-item-sort-handle[data-v-497a8b13]{opacity:1}.k-navigation-group-header[data-v-497a8b13]{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--color-gray-200);padding:0 var(--spacing-1);height:var(--height-xl)}.k-navigation-group-header h3[data-v-497a8b13]{white-space:nowrap;overflow:hidden;font-size:var(--text-sm);line-height:1.4;text-overflow:ellipsis}.k-navigation-group-header-title[data-v-497a8b13]{display:flex;align-items:center;overflow:hidden;padding:var(--spacing-2) 0;gap:var(--spacing-2)}.k-navigation-group-footer[data-v-497a8b13]{border-top:1px solid var(--color-gray-200);padding:var(--spacing-1)}.k-draggable-group[data-v-497a8b13]{display:flex;flex-direction:column;gap:2px;width:100%;background-color:var(--color-gray-100);padding:var(--spacing-2) var(--spacing-1)}.k-empty[data-v-497a8b13]{height:40px;background-color:var(--color-gray-100)}.k-draggable-container[data-v-c8d9d549]{display:flex;flex-direction:column;gap:var(--spacing-1);padding:0 0 var(--spacing-2) 0} diff --git a/index.js b/index.js index ce82a0a..d134df3 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -(function(){"use strict";function p(i,t,e,a,u,o,s,l){var n=typeof i=="function"?i.options:i;return t&&(n.render=t,n.staticRenderFns=e,n._compiled=!0),o&&(n._scopeId="data-v-"+o),{exports:i,options:n}}const c={name:"NavigationPageItem",props:{item:{type:Object,required:!0},image:{type:Object,default:()=>({back:"pattern",color:"gray-500",icon:"page"})}},computed:{normalizedImage(){return this.item.image?{src:this.item.image,cover:!0,back:"pattern",ratio:"1/1",...this.image}:{back:"pattern",color:"gray-500",icon:"page",...this.image}}},methods:{handleStatusClick(i){this.$dialog(`pages/${i.path}/changeStatus`)},getIconColor(i){return i==="listed"?"color: var(--color-green-500)":"color: var(--color-blue-500)"}}};var h=function(){var t=this,e=t._self._c;return t.item.type==="page"?e("k-item",{staticClass:"k-draggable-item",attrs:{sortable:t.item.sortable,text:t.item.text,link:"pages/"+t.item.path,image:t.normalizedImage},scopedSlots:t._u([{key:"options",fn:function(){return[e("k-button",{staticClass:"k-button k-status-icon",style:t.getIconColor(t.item.flag.status),attrs:{icon:"status-"+t.item.flag.status,"data-type":"status-"+t.item.flag.status,"data-theme":t.item.flag.status==="listed"?"positive-icon":"info-icon"},on:{click:function(a){return t.handleStatusClick(t.item)}}})]},proxy:!0}],null,!1,2481318459)}):t._e()},m=[],f=p(c,h,m,!1,null,"6c660d46");const g=f.exports,v={name:"NavigationGroup",components:{PageItem:g},props:{value:{type:Object,required:!0},fields:{type:Object,default:()=>({})},image:{type:Object,default:()=>({})}},data(){return{draggedElement:null,isDragging:!1}},methods:{onDragChange(i){const t={...this.value,pages:this.value.pages};this.$emit("input",t)},onGroupOption(i){this.$emit(i)},toggleGroup(){this.$emit("input",{...this.value,open:!this.value.open})}}};var _=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-navigation-group"},[e("button",{staticClass:"k-button k-sort-handle k-sort-button k-item-sort-handle",attrs:{"data-has-icon":"true","aria-label":t.$t("field.navigationgroups.group.sort"),title:t.$t("field.navigationgroups.group.sort"),type:"button",tabindex:"-1"}},[e("span",{staticClass:"k-button-icon"},[e("svg",{staticClass:"k-icon",attrs:{"aria-hidden":"true","data-type":"sort"}},[e("use",{attrs:{"xlink:href":"#icon-sort"}})])])]),e("header",{staticClass:"k-navigation-group-header"},[e("div",{staticClass:"k-navigation-group-header-title"},[e("k-button",{attrs:{variant:"ghost",icon:t.value.open?"angle-down":"angle-right",title:t.$t(t.value.open?"field.navigationgroups.closeGroup":"field.navigationgroups.openGroup")},on:{click:t.toggleGroup}}),e("h3",[t._v(t._s(t.value.title))])],1),e("div",{staticClass:"k-navigation-group-header-options",on:{mousedown:function(a){a.stopPropagation()}}},[e("k-options-dropdown",{attrs:{options:[{text:t.$t("edit"),icon:"edit",click:"edit"},{text:t.$t("delete"),icon:"trash",click:"delete"}]},on:{action:function(a){return t.onGroupOption(a)}}})],1)]),t.value.open?e("k-draggable",{ref:"groupDraggable",staticClass:"k-draggable-group",class:{"k-empty":!t.value.pages.length},attrs:{list:t.value.pages,handle:".k-item-sort-handle",options:{group:{name:"pages",pull:!0,put:(a,u,o)=>{const s=o.__vue__&&o.__vue__.$children[0]&&o.__vue__.$children[0].$options.name==="NavigationPageItem",l=o.__vue__&&o.__vue__.$children[0]&&o.__vue__.$children[0].$options.name==="NavigationGroup";return s&&!l}},animation:150}},on:{change:t.onDragChange}},t._l(t.value.pages,function(a){return e("k-box",{key:a.id},[e("PageItem",{attrs:{item:a,image:t.image}})],1)}),1):t._e(),e("footer",{staticClass:"k-navigation-group-footer"})],1)},k=[],$=p(v,_,k,!1,null,"497a8b13");const b=$.exports,y={name:"NavigationRoot",components:{PageItem:g,GroupItem:b},props:{value:{type:Array,default:()=>[]},path:{type:String,required:!0},label:{type:String,required:!0},image:{type:Object,default:()=>({})},fields:{type:Object,default:()=>{}},status:{type:String,default:"listed"}},data(){return{pages:this.value||[],draggedElement:null,isDragging:!1}},created(){this.loadPages()},mounted(){this.$events.on("page.changeStatus",this.loadPages)},destroyed(){this.$events.off("page.changeStatus",this.loadPages)},computed:{groupStats(){const i=this.value.filter(a=>a.type==="group"),t=i.filter(a=>a.open).length,e=i.length;return{openCount:t,closedCount:e-t,totalCount:e,shouldClose:t>=e/2}},toggleAllIcon(){return this.groupStats.shouldClose?"angle-down":"angle-right"},toggleAllTooltip(){return this.groupStats.shouldClose?this.$t("field.navigationgroups.closeAll"):this.$t("field.navigationgroups.openAll")}},methods:{openDialog(i,t){const e=this.fields||{};this.$panel.dialog.open({component:"k-form-dialog",props:{fields:e,value:i==="add"?{}:{title:t.title,...t}},on:{submit:a=>{i==="add"?this.$emit("input",[...this.value,{uuid:this.$helper.string.uuid(),type:"group",title:a.title,open:!0,...a,pages:[]}]):this.$emit("input",this.value.map(u=>u.uuid===t.uuid?{...u,...a}:u)),this.$panel.dialog.close()}}})},addGroup(){this.openDialog("add")},onRootChange(i){this.$emit("input",this.value)},onGroupOption(i,t){i==="edit"?this.openDialog("edit",t):this.$panel.dialog.open({component:"k-remove-dialog",props:{text:this.$t("field.navigationgroups.group.delete.confirm",{name:t.text})},on:{submit:()=>{this.deleteGroup(t),this.$panel.dialog.close()}}})},deleteGroup(i){if(i.pages.length){const t=[...this.value],e=t.findIndex(a=>a.uuid===i.uuid);t.splice(e,1,...i.pages.map(a=>({type:"page",...a}))),this.$emit("input",t);return}this.$emit("input",this.value.filter(t=>t.uuid!==i.uuid?t:null))},async loadPages(){var o;console.log("loadPages");const i=this.path==="/"?"site":this.path,t=await this.$api.get(`navigation-groups/pages?path=${i}&status=${this.status}`),e=[...this.value];for(let s=e.length-1;s>=0;s--){const l=e[s];if(l.type==="page"){const n=t.find(r=>r.id===l.id);n?e[s]={...l,text:n.title,path:n.path.replace("/","+"),image:n.image||null,flag:{status:n.status,icon:"icon-status-"+n.status,disabled:!((o=n.permissions)!=null&&o.changeStatus),statusId:n.id}}:e.splice(s,1)}else l.type==="group"&&l.pages.length&&(l.pages=l.pages.map(n=>{var d;const r=t.find(S=>S.id===n.id);return r?{...n,text:r.title,path:r.path.replace("/","+"),image:r.image||null,flag:{status:r.status,icon:"icon-status-"+r.status,disabled:!((d=r.permissions)!=null&&d.changeStatus),statusId:r.id}}:null}).filter(Boolean))}const a=new Set(e.flatMap(s=>s.type==="page"?[s.id]:s.pages.map(l=>l.id))),u=t.filter(s=>!a.has(s.id)).map(s=>{var l;return{type:"page",id:s.id,path:s.path.replace("/","+"),text:s.title,uuid:s.uuid,sortable:!0,image:s.image||null,flag:{status:s.status,icon:"icon-status-"+s.status,disabled:!((l=s.permissions)!=null&&l.changeStatus),statusId:s.id}}});e.push(...u),this.$emit("input",e),this.pages=t},updateGroup(i,t){const e=[...this.value],a=e.findIndex(u=>u.uuid===t.uuid);a!==-1&&(e[a]={...e[a],...t}),this.$emit("input",e)},toggleAll(){const i=this.value.map(t=>t.type==="group"?{...t,open:!this.groupStats.shouldClose}:t);this.$emit("input",i)}}};var C=function(){var t=this,e=t._self._c;return e("section",{staticClass:"k-section"},[e("header",{staticClass:"k-section-header"},[e("h2",{staticClass:"k-label k-section-label"},[e("span",{staticClass:"k-label-text"},[t._v(t._s(t.label))])]),e("div",{staticClass:"k-button-group k-section-buttons"},[e("k-button",{attrs:{variant:"filled",size:"xs",icon:t.toggleAllIcon,title:t.toggleAllTooltip},on:{click:t.toggleAll}}),e("k-button",{attrs:{variant:"filled",size:"xs",icon:"addgroup",title:t.$t("field.navigationgroups.addGroup")},on:{click:t.addGroup}})],1)]),t.value.length?t._e():e("k-empty",{attrs:{icon:"page",text:t.$t("pages.empty")}}),e("k-draggable",{staticClass:"k-draggable-container",attrs:{list:t.value,handle:".k-item-sort-handle",options:{group:{name:"pages",pull:!0,put:!0},animation:150}},on:{change:t.onRootChange}},t._l(t.value,function(a,u){return e("k-box",{key:a.id},[a.type==="group"?e("GroupItem",{attrs:{value:a,fields:t.fields,image:t.image},on:{input:function(o){return t.updateGroup(u,o)},edit:function(o){return t.onGroupOption("edit",a)},delete:function(o){return t.onGroupOption("delete",a)}}}):e("PageItem",{attrs:{item:a,image:t.image}})],1)}),1)],1)},x=[],I=p(y,C,x,!1,null,"261910de");const G=I.exports;panel.plugin("philippoehrlein/kirby-navigation-groups",{icons:{addgroup:''},fields:{navigationgroups:G}})})(); +(function(){"use strict";function p(i,t,e,a,u,o,s,l){var n=typeof i=="function"?i.options:i;return t&&(n.render=t,n.staticRenderFns=e,n._compiled=!0),o&&(n._scopeId="data-v-"+o),{exports:i,options:n}}const c={name:"NavigationPageItem",props:{item:{type:Object,required:!0},image:{type:Object,default:()=>({back:"pattern",color:"gray-500",icon:"page"})}},computed:{normalizedImage(){return this.item.image?{src:this.item.image,cover:!0,back:"pattern",ratio:"1/1",...this.image}:{back:"pattern",color:"gray-500",icon:"page",...this.image}}},methods:{handleStatusClick(i){this.$dialog(`pages/${i.path}/changeStatus`)},getIconColor(i){return i==="listed"?"color: var(--color-green-500)":"color: var(--color-blue-500)"}}};var h=function(){var t=this,e=t._self._c;return t.item.type==="page"?e("k-item",{staticClass:"k-draggable-item",attrs:{sortable:t.item.sortable,text:t.item.text,link:"pages/"+t.item.path,image:t.normalizedImage},scopedSlots:t._u([{key:"options",fn:function(){return[e("k-button",{staticClass:"k-button k-status-icon",style:t.getIconColor(t.item.flag.status),attrs:{icon:"status-"+t.item.flag.status,"data-type":"status-"+t.item.flag.status,"data-theme":t.item.flag.status==="listed"?"positive-icon":"info-icon"},on:{click:function(a){return t.handleStatusClick(t.item)}}})]},proxy:!0}],null,!1,2481318459)}):t._e()},m=[],f=p(c,h,m,!1,null,"6c660d46");const g=f.exports,v={name:"NavigationGroup",components:{PageItem:g},props:{value:{type:Object,required:!0},fields:{type:Object,default:()=>({})},image:{type:Object,default:()=>({})}},data(){return{draggedElement:null,isDragging:!1}},methods:{onDragChange(i){const t={...this.value,pages:this.value.pages};this.$emit("input",t)},onGroupOption(i){this.$emit(i)},toggleGroup(){this.$emit("input",{...this.value,open:!this.value.open})}}};var _=function(){var t=this,e=t._self._c;return e("div",{staticClass:"k-navigation-group"},[e("button",{staticClass:"k-button k-sort-handle k-sort-button k-item-sort-handle",attrs:{"data-has-icon":"true","aria-label":t.$t("field.navigationgroups.group.sort"),title:t.$t("field.navigationgroups.group.sort"),type:"button",tabindex:"-1"}},[e("span",{staticClass:"k-button-icon"},[e("svg",{staticClass:"k-icon",attrs:{"aria-hidden":"true","data-type":"sort"}},[e("use",{attrs:{"xlink:href":"#icon-sort"}})])])]),e("header",{staticClass:"k-navigation-group-header"},[e("div",{staticClass:"k-navigation-group-header-title"},[e("k-button",{attrs:{variant:"ghost",icon:t.value.open?"angle-down":"angle-right",title:t.$t(t.value.open?"field.navigationgroups.closeGroup":"field.navigationgroups.openGroup")},on:{click:t.toggleGroup}}),e("h3",[t._v(t._s(t.value.title))])],1),e("div",{staticClass:"k-navigation-group-header-options",on:{mousedown:function(a){a.stopPropagation()}}},[e("k-options-dropdown",{attrs:{options:[{text:t.$t("edit"),icon:"edit",click:"edit"},{text:t.$t("delete"),icon:"trash",click:"delete"}]},on:{action:function(a){return t.onGroupOption(a)}}})],1)]),t.value.open?e("k-draggable",{ref:"groupDraggable",staticClass:"k-draggable-group",class:{"k-empty":!t.value.pages.length},attrs:{list:t.value.pages,handle:".k-item-sort-handle",options:{group:{name:"pages",pull:!0,put:(a,u,o)=>{const s=o.__vue__&&o.__vue__.$children[0]&&o.__vue__.$children[0].$options.name==="NavigationPageItem",l=o.__vue__&&o.__vue__.$children[0]&&o.__vue__.$children[0].$options.name==="NavigationGroup";return s&&!l}},animation:150}},on:{change:t.onDragChange}},t._l(t.value.pages,function(a){return e("k-box",{key:a.id},[e("PageItem",{attrs:{item:a,image:t.image}})],1)}),1):t._e(),e("footer",{staticClass:"k-navigation-group-footer"})],1)},k=[],$=p(v,_,k,!1,null,"497a8b13");const b=$.exports,y={name:"NavigationRoot",components:{PageItem:g,GroupItem:b},props:{value:{type:Array,default:()=>[]},path:{type:String,required:!0},label:{type:String,required:!0},image:{type:Object,default:()=>({})},fields:{type:Object,default:()=>{}},status:{type:String,default:"listed"}},data(){return{pages:this.value||[],draggedElement:null,isDragging:!1}},created(){this.loadPages()},mounted(){this.$events.on("page.changeStatus",this.loadPages)},destroyed(){this.$events.off("page.changeStatus",this.loadPages)},computed:{groupStats(){const i=this.value.filter(a=>a.type==="group"),t=i.filter(a=>a.open).length,e=i.length;return{openCount:t,closedCount:e-t,totalCount:e,shouldClose:t>=e/2}},toggleAllIcon(){return this.groupStats.shouldClose?"angle-down":"angle-right"},toggleAllTooltip(){return this.groupStats.shouldClose?this.$t("field.navigationgroups.closeAll"):this.$t("field.navigationgroups.openAll")}},methods:{openDialog(i,t){const e=this.fields||{};this.$panel.dialog.open({component:"k-form-dialog",props:{fields:e,value:i==="add"?{}:{title:t.title,...t}},on:{submit:a=>{i==="add"?this.$emit("input",[...this.value,{uuid:this.$helper.string.uuid(),type:"group",title:a.title,open:!0,...a,pages:[]}]):this.$emit("input",this.value.map(u=>u.uuid===t.uuid?{...u,...a}:u)),this.$panel.dialog.close()}}})},addGroup(){this.openDialog("add")},onRootChange(i){this.$emit("input",this.value)},onGroupOption(i,t){i==="edit"?this.openDialog("edit",t):this.$panel.dialog.open({component:"k-remove-dialog",props:{text:this.$t("field.navigationgroups.group.delete.confirm",{name:t.text})},on:{submit:()=>{this.deleteGroup(t),this.$panel.dialog.close()}}})},deleteGroup(i){if(i.pages.length){const t=[...this.value],e=t.findIndex(a=>a.uuid===i.uuid);t.splice(e,1,...i.pages.map(a=>({type:"page",...a}))),this.$emit("input",t);return}this.$emit("input",this.value.filter(t=>t.uuid!==i.uuid?t:null))},async loadPages(){var o;const i=this.path===void 0?"site":this.path,t=await this.$api.get(`navigation-groups/pages?path=${i}&status=${this.status}`),e=[...this.value];for(let s=e.length-1;s>=0;s--){const l=e[s];if(l.type==="page"){const n=t.find(r=>r.id===l.id);n?e[s]={...l,text:n.title,path:n.path.replace("/","+"),image:n.image||null,flag:{status:n.status,icon:"icon-status-"+n.status,disabled:!((o=n.permissions)!=null&&o.changeStatus),statusId:n.id}}:e.splice(s,1)}else l.type==="group"&&l.pages.length&&(l.pages=l.pages.map(n=>{var d;const r=t.find(S=>S.id===n.id);return r?{...n,text:r.title,path:r.path.replace("/","+"),image:r.image||null,flag:{status:r.status,icon:"icon-status-"+r.status,disabled:!((d=r.permissions)!=null&&d.changeStatus),statusId:r.id}}:null}).filter(Boolean))}const a=new Set(e.flatMap(s=>s.type==="page"?[s.id]:s.pages.map(l=>l.id))),u=t.filter(s=>!a.has(s.id)).map(s=>{var l;return{type:"page",id:s.id,path:s.path.replace("/","+"),text:s.title,uuid:s.uuid,sortable:!0,image:s.image||null,flag:{status:s.status,icon:"icon-status-"+s.status,disabled:!((l=s.permissions)!=null&&l.changeStatus),statusId:s.id}}});e.push(...u),this.$emit("input",e),this.pages=t},updateGroup(i,t){const e=[...this.value],a=e.findIndex(u=>u.uuid===t.uuid);a!==-1&&(e[a]={...e[a],...t}),this.$emit("input",e)},toggleAll(){const i=this.value.map(t=>t.type==="group"?{...t,open:!this.groupStats.shouldClose}:t);this.$emit("input",i)}}};var C=function(){var t=this,e=t._self._c;return e("section",{staticClass:"k-section"},[e("header",{staticClass:"k-section-header"},[e("h2",{staticClass:"k-label k-section-label"},[e("span",{staticClass:"k-label-text"},[t._v(t._s(t.label))])]),e("div",{staticClass:"k-button-group k-section-buttons"},[e("k-button",{attrs:{variant:"filled",size:"xs",icon:t.toggleAllIcon,title:t.toggleAllTooltip},on:{click:t.toggleAll}}),e("k-button",{attrs:{variant:"filled",size:"xs",icon:"addgroup",title:t.$t("field.navigationgroups.addGroup")},on:{click:t.addGroup}})],1)]),t.value.length?t._e():e("k-empty",{attrs:{icon:"page",text:t.$t("pages.empty")}}),e("k-draggable",{staticClass:"k-draggable-container",attrs:{list:t.value,handle:".k-item-sort-handle",options:{group:{name:"pages",pull:!0,put:!0},animation:150}},on:{change:t.onRootChange}},t._l(t.value,function(a,u){return e("k-box",{key:a.id},[a.type==="group"?e("GroupItem",{attrs:{value:a,fields:t.fields,image:t.image},on:{input:function(o){return t.updateGroup(u,o)},edit:function(o){return t.onGroupOption("edit",a)},delete:function(o){return t.onGroupOption("delete",a)}}}):e("PageItem",{attrs:{item:a,image:t.image}})],1)}),1)],1)},x=[],I=p(y,C,x,!1,null,"c8d9d549");const G=I.exports;panel.plugin("philippoehrlein/kirby-navigation-groups",{icons:{addgroup:''},fields:{navigationgroups:G}})})(); diff --git a/package.json b/package.json index 9f9f5a3..bda23d9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "type": "module", "name": "kirby-navigation-groups", - "version": "1.0.0", + "version": "1.0.1", "author": { "name": "Philipp Oehrlein", "email": "github@philippoehrlein.de" diff --git a/src/components/NavigationRoot.vue b/src/components/NavigationRoot.vue index ae220d7..29022be 100644 --- a/src/components/NavigationRoot.vue +++ b/src/components/NavigationRoot.vue @@ -195,8 +195,7 @@ export default { )); }, async loadPages() { - console.log('loadPages'); - const path = this.path === '/' ? 'site' : this.path; + const path = this.path === undefined ? 'site' : this.path; const response = await this.$api.get(`navigation-groups/pages?path=${path}&status=${this.status}`); const newValue = [...this.value];