diff --git a/resources/dist/build/assets/addon-ec9db2e5.js b/resources/dist/build/assets/addon-2ef42060.js similarity index 79% rename from resources/dist/build/assets/addon-ec9db2e5.js rename to resources/dist/build/assets/addon-2ef42060.js index a029d3f..271b148 100644 --- a/resources/dist/build/assets/addon-ec9db2e5.js +++ b/resources/dist/build/assets/addon-2ef42060.js @@ -1 +1 @@ -function h(e,t,s,c,i,n,r,d){var o=typeof e=="function"?e.options:e;t&&(o.render=t,o.staticRenderFns=s,o._compiled=!0),c&&(o.functional=!0),n&&(o._scopeId="data-v-"+n);var l;if(r?(l=function(a){a=a||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!a&&typeof __VUE_SSR_CONTEXT__<"u"&&(a=__VUE_SSR_CONTEXT__),i&&i.call(this,a),a&&a._registeredComponents&&a._registeredComponents.add(r)},o._ssrRegister=l):i&&(l=d?function(){i.call(this,(o.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(o.functional){o._injectStyles=l;var f=o.render;o.render=function(m,_){return l.call(_),f(m,_)}}else{var u=o.beforeCreate;o.beforeCreate=u?[].concat(u,l):[l]}return{exports:e,options:o}}const p={mixins:[Listing],props:["initialColumns"],data(){return{columns:this.initialColumns,requestUrl:cp_url("statamic-locks/locks")}}};var k=function(){var t=this,s=t._self._c;return s("data-list",{attrs:{"visible-columns":t.columns,columns:t.columns,rows:t.items},scopedSlots:t._u([{key:"default",fn:function({filteredRows:c}){return s("div",{staticClass:"card overflow-hidden p-0 relative"},[s("data-list-table",{scopedSlots:t._u([{key:"cell-title",fn:function({row:i}){return[s("a",{attrs:{href:i.show_url}},[t._v(t._s(i.title))])]}},{key:"actions",fn:function({row:i,index:n}){return[i.can_delete?s("dropdown-list",[s("dropdown-item",{staticClass:"warning",attrs:{text:t.__("Delete")},on:{click:function(r){t.$refs[`deleter_${i.id}`].confirm()}}},[s("resource-deleter",{ref:`deleter_${i.id}`,attrs:{resource:i},on:{deleted:t.request}})],1)],1):t._e()]}}],null,!0)})],1)}}])})},v=[],b=h(p,k,v,!1,null,null,null,null);const g=b.exports,w={props:{itemId:{type:String,required:!0},itemType:{type:String,required:!0}},data(){return{show:!1,status:[]}},mounted(){this.checkLockStatus(),setInterval(()=>{this.checkLockStatus()},1e3*Statamic.$config.get("statamicLocks.pollInterval",30)),window.addEventListener("beforeunload",()=>{this.show||this.$axios.delete(cp_url("statamic-locks/locks/"+this.status.lock_id+"?delay=true")).then(e=>{}).catch(e=>this.handleAxiosError(e))})},methods:{back(){window.history.back()},deleteLock(){this.status.lock_id||this.$toast.error(__("This isnt possible")),this.$axios.delete(cp_url("statamic-locks/locks/"+this.status.lock_id)).then(e=>{window.location.reload()}).catch(e=>this.handleAxiosError(e))},checkLockStatus(){this.updateCsrfToken().then(()=>{this.$axios.post(cp_url("statamic-locks/locks"),{item_id:this.itemId,item_type:this.itemType}).then(e=>{if(e.data.error){this.show=!0,this.status=e.data;return}this.show=!1,this.status=e.data}).catch(e=>this.handleAxiosError(e))})},handleAxiosError(e){this.$toast.error(__("Error getting lock status"))},locks(){window.location.href=cp_url("statamic-locks/locks")},updateCsrfToken(){return this.$axios.get(cp_url("auth/token")).then(e=>{const t=e.data;this.$axios.defaults.headers.common["X-CSRF-TOKEN"]=t,this.$config.set("csrfToken",t)})}}};var C=function(){var t=this,s=t._self._c;return s("div",[t.show?s("modal",{staticClass:"modal-lock"},[s("div",{staticClass:"flex items-center p-6 bg-gray-200 border-b text-center"},[t._v(" "+t._s(t.__("Item Locked"))+" ")]),s("div",{staticClass:"p-6"},[s("p",{staticClass:"text-base"},[t._v(t._s(t.__("Locked by :name, last updated :since",{name:t.status.locked_by.name,since:t.status.last_updated}))+" ")])]),s("div",{staticClass:"p-4 bg-gray-200 border-t flex items-center justify-between text-sm"},[s("button",{staticClass:"btn",domProps:{textContent:t._s(t.__("Back"))},on:{click:t.back}}),this.can("delete user locks")?s("button",{staticClass:"btn btn-danger",domProps:{textContent:t._s(t.__("Delete lock"))},on:{click:t.deleteLock}}):t._e(),this.can("view locks")?s("button",{staticClass:"btn btn-primary",domProps:{textContent:t._s(t.__("Show locks"))},on:{click:t.locks}}):t._e()])]):t._e()],1)},$=[],S=h(w,C,$,!1,null,null,null,null);const y=S.exports;Statamic.booting(()=>{Statamic.component("statamic-locks-listing",g),Statamic.component("statamic-locks-modal",y)});Statamic.booted(()=>{let e=("/"+Statamic.$config.get("urlPath")).split("/"),t=Statamic.$config.get("statamicLocks.locks")??{};for(let s in t){let c=t[s].split("/"),i=!0,n=0,r="",d="";for(;i&&c.length;){if(r=c.shift(),r=="{id}"){d=e[n];continue}if(!(r=="*"||e[n]==r)){i=!1;continue}n++,c.length&&e.length{this.checkLockStatus()},1e3*Statamic.$config.get("statamicLocks.pollInterval",30)),window.addEventListener("beforeunload",()=>{this.show||this.$axios.delete(cp_url("statamic-locks/locks/"+this.status.lock_id+"?delay=true")).then(e=>{}).catch(e=>this.handleAxiosError(e))})},methods:{back(){window.history.back()},deleteLock(){this.status.lock_id||this.$toast.error(__("This isnt possible")),this.$axios.delete(cp_url("statamic-locks/locks/"+this.status.lock_id)).then(e=>{window.location.reload()}).catch(e=>this.handleAxiosError(e))},checkLockStatus(){this.updateCsrfToken().then(()=>{this.$axios.post(cp_url("statamic-locks/locks"),{item_id:this.itemId,item_type:this.itemType}).then(e=>{if(e.data.error){this.show=!0,this.status=e.data;return}this.show=!1,this.status=e.data}).catch(e=>this.handleAxiosError(e))})},handleAxiosError(e){this.$toast.error(__("Error getting lock status"))},locks(){window.location.href=cp_url("statamic-locks/locks")},updateCsrfToken(){return this.$axios.get(cp_url("auth/token")).then(e=>{const t=e.data;this.$axios.defaults.headers.common["X-CSRF-TOKEN"]=t,this.$config.set("csrfToken",t)})}}};var C=function(){var t=this,s=t._self._c;return s("div",[t.show?s("modal",{staticClass:"modal-lock"},[s("div",{staticClass:"flex items-center p-6 bg-gray-200 border-b text-center"},[t._v(" "+t._s(t.__("Item Locked"))+" ")]),s("div",{staticClass:"p-6"},[s("p",{staticClass:"text-base"},[t._v(t._s(t.__("Locked by :name, last updated :since",{name:t.status.locked_by.name,since:t.status.last_updated}))+" ")])]),s("div",{staticClass:"p-4 bg-gray-200 border-t flex items-center justify-between text-sm"},[s("button",{staticClass:"btn",domProps:{textContent:t._s(t.__("Back"))},on:{click:t.back}}),this.can("delete user locks")?s("button",{staticClass:"btn btn-danger",domProps:{textContent:t._s(t.__("Delete lock"))},on:{click:t.deleteLock}}):t._e(),this.can("view locks")?s("button",{staticClass:"btn btn-primary",domProps:{textContent:t._s(t.__("Show locks"))},on:{click:t.locks}}):t._e()])]):t._e()],1)},$=[],S=h(w,C,$,!1,null,null,null,null);const y=S.exports;Statamic.booting(()=>{Statamic.component("statamic-locks-listing",g),Statamic.component("statamic-locks-modal",y)});Statamic.booted(()=>{let e=("/"+Statamic.$config.get("urlPath")).split("/"),t=Statamic.$config.get("statamicLocks.locks")??{};for(let s in t){let d=t[s].split("/"),i=!0,n=0,r="",l="";for(;i&&d.length;){if(r=d.shift(),r=="{id}"){l=e[n];continue}if(!(r=="*"||e[n]==r)){i=!1;continue}n++,d.length&&e.length { } if (valid && id && ! path.length) { + + id = id.split('?').shift(); + + if (id == 'create') { + continue; + } + Statamic.$components.append('statamic-locks-modal', { - props: { itemType: handle, itemId: id.split('?').shift() } + props: { itemType: handle, itemId: id } }); } }