From 59125f15220ee9771f31fdf1b5843276133468df Mon Sep 17 00:00:00 2001 From: Steffen Giers Date: Thu, 23 Jan 2020 09:26:12 +0100 Subject: [PATCH 1/2] fix: remove error message when no pages where found --- index.js | 2 +- src/components/EnhancedToolbarLinkDialog.vue | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 343da67..42d4b17 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -(function () {var a={props:{pages:Array,text:String},data:function(){return{tabs:[{name:"external",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.external")},{name:"internal",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.internal")}],search:null,currentPage:{},currentTab:{},value:{url:null,text:null},pagination:{page:1,total:0},externalFields:{url:{label:this.$t("link"),type:"text",placeholder:this.$t("url.placeholder"),icon:"url"},text:{label:this.$t("link.text"),type:"text"}}}},watch:{search:b(function(){this.pagination.page=0,this.fetch()},200)},computed:{kirbytext:function(){return this.$store.state.system.info.kirbytext}},methods:{open:function(t,e){this.value.text=e,this.currentTab=this.tabs[0],this.$refs.dialog.open()},resetForm:function(){this.value={url:null,text:null},this.value.text=null,this.search=null,this.pagination.page=1},selectTab:function(t){this.currentTab=t},selectPage:function(t){this.value={url:t.url,text:this.value.text||t.title},this.isCurrentPage(t)?(this.currentPage={},this.value={url:null,text:null}):this.currentPage=t},isCurrentPage:function(t){return this.currentPage===t},paginate:function(t){this.pagination.page=t.page,this.fetch()},createKirbytext:function(){return this.value.text.length>0?"(link: ".concat(this.value.url," text: ").concat(this.value.text,")"):"(link: ".concat(this.value.url,")")},createMarkdown:function(){return this.value.text.length>0?"[".concat(this.value.text,"](").concat(this.value.url,")"):"<".concat(this.value.url,">")},fetch:function(){var t=this,e={page:this.pagination.page,search:this.search};this.$api.get("enhanced-toolbar-link-dialog/pages",e).then(function(e){t.pages=e.data,t.pagination=e.pagination})},submit:function(){this.$emit("submit",this.kirbytext?this.createKirbytext():this.createMarkdown()),this.$refs.dialog.close()}}};function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=null;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){t.apply(n,i)},e)}}if(typeof a==="function"){a=a.options}Object.assign(a,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-dialog",{ref:"dialog",staticClass:"k-pages-dialog",attrs:{"size":"medium","button":_vm.$t("insert")},on:{"submit":_vm.submit,"open":_vm.fetch,"close":_vm.resetForm}},[_vm.tabs&&_vm.tabs.length>1?_c("div",{staticClass:"k-header-tabs"},[_c("nav",_vm._l(_vm.tabs,function(tab){return _c("k-button",{staticClass:"k-tab-button",attrs:{"link":"#"+tab.name,"current":_vm.currentTab&&_vm.currentTab.name===tab.name},on:{"click":function($event){return _vm.selectTab(tab)}}},[_vm._v(" "+_vm._s(tab.label)+" ")])}),1)]):_vm._e(),_vm._v(" "),_vm.currentTab.name==="external"?_c("div",{staticClass:"k-tab"},[_c("k-form",{ref:"form",attrs:{"fields":_vm.externalFields},on:{"submit":_vm.submit},model:{value:_vm.value,callback:function($$v){_vm.value=$$v},expression:"value"}})],1):_vm._e(),_vm._v(" "),_vm.currentTab.name==="internal"?_c("div",{staticClass:"k-tab"},[_c("k-input",{staticClass:"k-dialog-search",attrs:{"autofocus":"","placeholder":_vm.$t("search")+" \u2026","type":"text","icon":"search"},model:{value:_vm.search,callback:function($$v){_vm.search=$$v},expression:"search"}}),_vm._v(" "),_vm.pages.length>0?_c("k-list",_vm._l(_vm.pages,function(page){return _c("k-list-item",{key:page.id,attrs:{"text":page.title},on:{"click":function($event){return _vm.selectPage(page)}}},[_c("template",{slot:"options"},[_vm.isCurrentPage(page)?_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"check","theme":"positive","tooltip":_vm.$t("remove")},slot:"options"}):_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"circle-outline","tooltip":_vm.$t("select")},slot:"options"})],1)],2)}),1):_c("k-text",[_vm._v(" "+_vm._s(_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.empty"))+" ")]),_vm._v(" "),_c("k-pagination",_vm._b({staticClass:"k-dialog-pagination",attrs:{"details":true,"dropdown":false,"align":"center"},on:{"paginate":_vm.paginate}},"k-pagination",_vm.pagination,false))],1):_vm._e()])};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("gearsdigital/enhanced-toolbar-link-dialog",{components:{"k-toolbar-link-dialog":{extends:a}}});})(); \ No newline at end of file +(function () {var a={data:function(){return{tabs:[{name:"external",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.external")},{name:"internal",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.internal")}],search:null,currentPage:{},currentTab:{},pages:[],value:{url:null,text:null},pagination:{page:1,total:0},externalFields:{url:{label:this.$t("link"),type:"text",placeholder:this.$t("url.placeholder"),icon:"url"},text:{label:this.$t("link.text"),type:"text"}}}},watch:{search:b(function(){this.pagination.page=0,this.fetch()},200)},computed:{hasPages:function(){return this.pages.length},kirbytext:function(){return this.$store.state.system.info.kirbytext}},methods:{open:function(t,e){this.value.text=e,this.currentTab=this.tabs[0],this.$refs.dialog.open()},resetForm:function(){this.value={url:null,text:null},this.value.text=null,this.search=null,this.pagination.page=1},selectTab:function(t){this.currentTab=t},selectPage:function(t){this.value={url:t.url,text:this.value.text||t.title},this.isCurrentPage(t)?(this.currentPage={},this.value={url:null,text:null}):this.currentPage=t},isCurrentPage:function(t){return this.currentPage===t},paginate:function(t){this.pagination.page=t.page,this.fetch()},createKirbytext:function(){return this.value.text.length>0?"(link: ".concat(this.value.url," text: ").concat(this.value.text,")"):"(link: ".concat(this.value.url,")")},createMarkdown:function(){return this.value.text.length>0?"[".concat(this.value.text,"](").concat(this.value.url,")"):"<".concat(this.value.url,">")},fetch:function(){var t=this,e={page:this.pagination.page,search:this.search};this.$api.get("enhanced-toolbar-link-dialog/pages",e).then(function(e){t.pages=e.data,t.pagination=e.pagination})},submit:function(){this.$emit("submit",this.kirbytext?this.createKirbytext():this.createMarkdown()),this.$refs.dialog.close()}}};function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=null;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){t.apply(n,i)},e)}}if(typeof a==="function"){a=a.options}Object.assign(a,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-dialog",{ref:"dialog",staticClass:"k-pages-dialog",attrs:{"size":"medium","button":_vm.$t("insert")},on:{"submit":_vm.submit,"open":_vm.fetch,"close":_vm.resetForm}},[_vm.tabs&&_vm.tabs.length>1?_c("div",{staticClass:"k-header-tabs"},[_c("nav",_vm._l(_vm.tabs,function(tab){return _c("k-button",{staticClass:"k-tab-button",attrs:{"link":"#"+tab.name,"current":_vm.currentTab&&_vm.currentTab.name===tab.name},on:{"click":function($event){return _vm.selectTab(tab)}}},[_vm._v(" "+_vm._s(tab.label)+" ")])}),1)]):_vm._e(),_vm._v(" "),_vm.currentTab.name==="external"?_c("div",{staticClass:"k-tab"},[_c("k-form",{ref:"form",attrs:{"fields":_vm.externalFields},on:{"submit":_vm.submit},model:{value:_vm.value,callback:function($$v){_vm.value=$$v},expression:"value"}})],1):_vm._e(),_vm._v(" "),_vm.currentTab.name==="internal"?_c("div",{staticClass:"k-tab"},[_c("k-input",{staticClass:"k-dialog-search",attrs:{"autofocus":"","placeholder":_vm.$t("search")+" \u2026","type":"text","icon":"search"},model:{value:_vm.search,callback:function($$v){_vm.search=$$v},expression:"search"}}),_vm._v(" "),_vm.hasPages?_c("k-list",_vm._l(_vm.pages,function(page){return _c("k-list-item",{key:page.id,attrs:{"text":page.title},on:{"click":function($event){return _vm.selectPage(page)}}},[_c("template",{slot:"options"},[_vm.isCurrentPage(page)?_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"check","theme":"positive","tooltip":_vm.$t("remove")},slot:"options"}):_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"circle-outline","tooltip":_vm.$t("select")},slot:"options"})],1)],2)}),1):_c("k-text",[_vm._v(" "+_vm._s(_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.empty"))+" ")]),_vm._v(" "),_c("k-pagination",_vm._b({staticClass:"k-dialog-pagination",attrs:{"details":true,"dropdown":false,"align":"center"},on:{"paginate":_vm.paginate}},"k-pagination",_vm.pagination,false))],1):_vm._e()])};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("gearsdigital/enhanced-toolbar-link-dialog",{components:{"k-toolbar-link-dialog":{extends:a}}});})(); \ No newline at end of file diff --git a/src/components/EnhancedToolbarLinkDialog.vue b/src/components/EnhancedToolbarLinkDialog.vue index 998e45f..c65e6cf 100755 --- a/src/components/EnhancedToolbarLinkDialog.vue +++ b/src/components/EnhancedToolbarLinkDialog.vue @@ -42,7 +42,7 @@ icon="search" /> - + export default { - props: { - pages: Array, - text: String - }, data() { return { tabs: [ @@ -104,6 +100,7 @@ search: null, currentPage: {}, currentTab: {}, + pages:[], value: { url: null, text: null @@ -133,6 +130,9 @@ }, 200) }, computed: { + hasPages(){ + return this.pages.length + }, kirbytext() { return this.$store.state.system.info.kirbytext; } From 4728e9533ac39f0cf0ad1421b795aa2911e347f4 Mon Sep 17 00:00:00 2001 From: Steffen Giers Date: Fri, 24 Jan 2020 23:02:44 +0100 Subject: [PATCH 2/2] feat: add link as absolute URL without protocol and domain Closes #2 --- index.js | 2 +- index.php | 38 +++++++++++++++++--- src/components/EnhancedToolbarLinkDialog.vue | 12 +++---- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 42d4b17..94c1628 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -(function () {var a={data:function(){return{tabs:[{name:"external",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.external")},{name:"internal",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.internal")}],search:null,currentPage:{},currentTab:{},pages:[],value:{url:null,text:null},pagination:{page:1,total:0},externalFields:{url:{label:this.$t("link"),type:"text",placeholder:this.$t("url.placeholder"),icon:"url"},text:{label:this.$t("link.text"),type:"text"}}}},watch:{search:b(function(){this.pagination.page=0,this.fetch()},200)},computed:{hasPages:function(){return this.pages.length},kirbytext:function(){return this.$store.state.system.info.kirbytext}},methods:{open:function(t,e){this.value.text=e,this.currentTab=this.tabs[0],this.$refs.dialog.open()},resetForm:function(){this.value={url:null,text:null},this.value.text=null,this.search=null,this.pagination.page=1},selectTab:function(t){this.currentTab=t},selectPage:function(t){this.value={url:t.url,text:this.value.text||t.title},this.isCurrentPage(t)?(this.currentPage={},this.value={url:null,text:null}):this.currentPage=t},isCurrentPage:function(t){return this.currentPage===t},paginate:function(t){this.pagination.page=t.page,this.fetch()},createKirbytext:function(){return this.value.text.length>0?"(link: ".concat(this.value.url," text: ").concat(this.value.text,")"):"(link: ".concat(this.value.url,")")},createMarkdown:function(){return this.value.text.length>0?"[".concat(this.value.text,"](").concat(this.value.url,")"):"<".concat(this.value.url,">")},fetch:function(){var t=this,e={page:this.pagination.page,search:this.search};this.$api.get("enhanced-toolbar-link-dialog/pages",e).then(function(e){t.pages=e.data,t.pagination=e.pagination})},submit:function(){this.$emit("submit",this.kirbytext?this.createKirbytext():this.createMarkdown()),this.$refs.dialog.close()}}};function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=null;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){t.apply(n,i)},e)}}if(typeof a==="function"){a=a.options}Object.assign(a,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-dialog",{ref:"dialog",staticClass:"k-pages-dialog",attrs:{"size":"medium","button":_vm.$t("insert")},on:{"submit":_vm.submit,"open":_vm.fetch,"close":_vm.resetForm}},[_vm.tabs&&_vm.tabs.length>1?_c("div",{staticClass:"k-header-tabs"},[_c("nav",_vm._l(_vm.tabs,function(tab){return _c("k-button",{staticClass:"k-tab-button",attrs:{"link":"#"+tab.name,"current":_vm.currentTab&&_vm.currentTab.name===tab.name},on:{"click":function($event){return _vm.selectTab(tab)}}},[_vm._v(" "+_vm._s(tab.label)+" ")])}),1)]):_vm._e(),_vm._v(" "),_vm.currentTab.name==="external"?_c("div",{staticClass:"k-tab"},[_c("k-form",{ref:"form",attrs:{"fields":_vm.externalFields},on:{"submit":_vm.submit},model:{value:_vm.value,callback:function($$v){_vm.value=$$v},expression:"value"}})],1):_vm._e(),_vm._v(" "),_vm.currentTab.name==="internal"?_c("div",{staticClass:"k-tab"},[_c("k-input",{staticClass:"k-dialog-search",attrs:{"autofocus":"","placeholder":_vm.$t("search")+" \u2026","type":"text","icon":"search"},model:{value:_vm.search,callback:function($$v){_vm.search=$$v},expression:"search"}}),_vm._v(" "),_vm.hasPages?_c("k-list",_vm._l(_vm.pages,function(page){return _c("k-list-item",{key:page.id,attrs:{"text":page.title},on:{"click":function($event){return _vm.selectPage(page)}}},[_c("template",{slot:"options"},[_vm.isCurrentPage(page)?_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"check","theme":"positive","tooltip":_vm.$t("remove")},slot:"options"}):_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"circle-outline","tooltip":_vm.$t("select")},slot:"options"})],1)],2)}),1):_c("k-text",[_vm._v(" "+_vm._s(_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.empty"))+" ")]),_vm._v(" "),_c("k-pagination",_vm._b({staticClass:"k-dialog-pagination",attrs:{"details":true,"dropdown":false,"align":"center"},on:{"paginate":_vm.paginate}},"k-pagination",_vm.pagination,false))],1):_vm._e()])};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("gearsdigital/enhanced-toolbar-link-dialog",{components:{"k-toolbar-link-dialog":{extends:a}}});})(); \ No newline at end of file +(function () {var a={data:function(){return{tabs:[{name:"external",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.external")},{name:"internal",label:this.$t("gearsdigital.enhanced-toolbar-link-dialog.internal")}],search:null,currentPage:{},currentTab:{},pages:[],value:{url:null,text:null},pagination:{page:1,total:0},externalFields:{url:{label:this.$t("link"),type:"text",placeholder:this.$t("url.placeholder"),icon:"url"},text:{label:this.$t("link.text"),type:"text"}}}},watch:{search:b(function(){this.pagination.page=0,this.fetch()},200)},computed:{hasPages:function(){return this.pages.length},kirbytext:function(){return this.$store.state.system.info.kirbytext}},methods:{open:function(t,e){this.value.text=e,this.currentTab=this.tabs[0],this.$refs.dialog.open()},resetForm:function(){this.value={url:null,text:null},this.value.text=null,this.search=null,this.pagination.page=1},selectTab:function(t){this.currentTab=t},selectPage:function(t){this.value={url:t.slug,text:this.value.text||t.title},this.isCurrentPage(t)?(this.currentPage={},this.value={url:null,text:null}):this.currentPage=t},isCurrentPage:function(t){return this.currentPage===t},paginate:function(t){this.pagination.page=t.page,this.fetch()},createKirbytext:function(){return this.value.text.length>0?"(link: ".concat(this.value.url," text: ").concat(this.value.text,")"):"(link: ".concat(this.value.url,")")},createMarkdown:function(){return this.value.text.length>0?"[".concat(this.value.text,"](").concat(this.value.url,")"):"<".concat(this.value.url,">")},fetch:function(){var t=this,e={page:this.pagination.page,search:this.search};this.$api.get("enhanced-toolbar-link-dialog/pages",e).then(function(e){t.pages=e.data,t.pagination=e.pagination})},submit:function(){this.$emit("submit",this.kirbytext?this.createKirbytext():this.createMarkdown()),this.$refs.dialog.close()}}};function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200,a=null;return function(){var n=this,i=arguments;clearTimeout(a),a=setTimeout(function(){t.apply(n,i)},e)}}if(typeof a==="function"){a=a.options}Object.assign(a,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("k-dialog",{ref:"dialog",staticClass:"k-pages-dialog",attrs:{"size":"medium","button":_vm.$t("insert")},on:{"submit":_vm.submit,"open":_vm.fetch,"close":_vm.resetForm}},[_vm.tabs&&_vm.tabs.length>1?_c("div",{staticClass:"k-header-tabs"},[_c("nav",_vm._l(_vm.tabs,function(tab){return _c("k-button",{staticClass:"k-tab-button",attrs:{"link":"#"+tab.name,"current":_vm.currentTab&&_vm.currentTab.name===tab.name},on:{"click":function($event){return _vm.selectTab(tab)}}},[_vm._v(" "+_vm._s(tab.label)+" ")])}),1)]):_vm._e(),_vm._v(" "),_vm.currentTab.name==="external"?_c("div",{staticClass:"k-tab"},[_c("k-form",{ref:"form",attrs:{"fields":_vm.externalFields},on:{"submit":_vm.submit},model:{value:_vm.value,callback:function($$v){_vm.value=$$v},expression:"value"}})],1):_vm._e(),_vm._v(" "),_vm.currentTab.name==="internal"?_c("div",{staticClass:"k-tab"},[_c("k-input",{staticClass:"k-dialog-search",attrs:{"autofocus":"","placeholder":_vm.$t("search")+" \u2026","type":"text","icon":"search"},model:{value:_vm.search,callback:function($$v){_vm.search=$$v},expression:"search"}}),_vm._v(" "),_vm.hasPages?_c("k-list",_vm._l(_vm.pages,function(page){return _c("k-list-item",{key:page.id,attrs:{"text":page.title},on:{"click":function($event){return _vm.selectPage(page)}}},[_c("template",{slot:"options"},[_vm.isCurrentPage(page)?_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"check","theme":"positive","tooltip":_vm.$t("remove")},slot:"options"}):_c("k-button",{attrs:{"slot":"options","autofocus":"","icon":"circle-outline","tooltip":_vm.$t("select")},slot:"options"})],1)],2)}),1):_c("k-text",[_vm._v(" "+_vm._s(_vm.$t("gearsdigital.enhanced-toolbar-link-dialog.empty"))+" ")]),_vm._v(" "),_c("k-pagination",_vm._b({staticClass:"k-dialog-pagination",attrs:{"details":true,"dropdown":false,"align":"center"},on:{"paginate":_vm.paginate}},"k-pagination",_vm.pagination,false))],1):_vm._e()])};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("gearsdigital/enhanced-toolbar-link-dialog",{components:{"k-toolbar-link-dialog":{extends:a}}});})(); \ No newline at end of file diff --git a/index.php b/index.php index 358b6f2..d3ae7e2 100755 --- a/index.php +++ b/index.php @@ -1,22 +1,50 @@ [ - 'routes' => [ + 'models' => [ + // a camelCased model name results in Kirby\Exception\NotFoundException + 'simplepagemodel' => [ + 'type' => 'Kirby\Cms\Page', + 'fields' => [ + 'id' => function ($page) { + return $page->id(); + }, + 'title' => function ($page) { + return $page->title()->value(); + }, + 'slug' => function ($page) { + return URL::makeAbsolute($page->slug()); + }, + ], + ], + ], + 'collections' => [ + 'simplepagecollection' => [ + 'model' => 'simplepagemodel', + 'type' => 'Kirby\Toolkit\Collection', + ], + ], + 'routes' => [ [ 'pattern' => 'enhanced-toolbar-link-dialog/pages', 'method' => 'get', 'action' => function () { $page = get('page'); - $query = get('search', '*'); + $query = get('search'); if (empty($query)) { $query = '*'; } - return site()->search($query, 'title')->paginate([ + $pagedCollection = site()->search($query, 'title')->paginate([ 'page' => $page, 'limit' => 10, ]); + + return $this->collection('simplepagecollection', $pagedCollection); }, ], ], @@ -25,12 +53,12 @@ 'en' => [ 'gearsdigital.enhanced-toolbar-link-dialog.internal' => 'Internal Link', 'gearsdigital.enhanced-toolbar-link-dialog.external' => 'External Link', - 'gearsdigital.enhanced-toolbar-link-dialog.empty' => 'No pages found', + 'gearsdigital.enhanced-toolbar-link-dialog.empty' => 'No pages found', ], 'de' => [ 'gearsdigital.enhanced-toolbar-link-dialog.internal' => 'Interner Link', 'gearsdigital.enhanced-toolbar-link-dialog.external' => 'Externer Link', - 'gearsdigital.enhanced-toolbar-link-dialog.empty' => 'Keine Seiten gefunden.', + 'gearsdigital.enhanced-toolbar-link-dialog.empty' => 'Keine Seiten gefunden.', ], ], ]); diff --git a/src/components/EnhancedToolbarLinkDialog.vue b/src/components/EnhancedToolbarLinkDialog.vue index c65e6cf..2fb2c4e 100755 --- a/src/components/EnhancedToolbarLinkDialog.vue +++ b/src/components/EnhancedToolbarLinkDialog.vue @@ -100,7 +100,7 @@ search: null, currentPage: {}, currentTab: {}, - pages:[], + pages: [], value: { url: null, text: null @@ -130,7 +130,7 @@ }, 200) }, computed: { - hasPages(){ + hasPages() { return this.pages.length }, kirbytext() { @@ -157,7 +157,7 @@ }, selectPage(model) { this.value = { - url: model.url, + url: model.slug, text: this.value.text || model.title }; if (this.isCurrentPage(model)) { @@ -197,9 +197,9 @@ search: this.search }; this.$api.get('enhanced-toolbar-link-dialog/pages', params).then(response => { - this.pages = response.data; - this.pagination = response.pagination; - }); + this.pages = response.data; + this.pagination = response.pagination; + }); }, submit() { this.$emit("submit", this.kirbytext ? this.createKirbytext() : this.createMarkdown());