diff --git a/index.css b/index.css new file mode 100644 index 0000000..1fea796 --- /dev/null +++ b/index.css @@ -0,0 +1 @@ +.form-footer,.form .k-fieldset{padding:20px;background:var(--color-background)}.headline{background:var(--color-gray-300);padding:10px 20px}.panel{background:var(--color-white);border-radius:var(--rounded);-webkit-box-shadow:var(--shadow);box-shadow:var(--shadow);padding-bottom:0}.headline{background:var(--color-gray-300)}.headline,.inner{padding:10px 20px}.inner{background:var(--color-background)}.panel{background:var(--color-white);border-radius:var(--rounded);-webkit-box-shadow:var(--shadow);box-shadow:var(--shadow);padding-bottom:0} \ No newline at end of file diff --git a/index.js b/index.js index 718c55b..4e7d870 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -(function () {var b={methods:{publish:function(){console.log("pub"),this._createPage(!0)},submit:function(){this._createPage()},_createPage:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=this.target.replace("[YEAR]",this.$library.dayjs().format("YYYY"));this.$api.pages.create(a,{slug:this.$helper.slug(this.values.title),title:this.values.title,template:this.values.template,content:{title:this.values.title,text:this.values.text}}).then(function(a){e?t.$api.pages.status(a.id,"listed").then(function(e){t.$router.push({name:"Page",params:{path:a.id.replace(/\//g,"+")}})}):t.$router.push({name:"Page",params:{path:a.id.replace(/\//g,"+")}})})}},data:function(){return{headline:"",target:"",templates:[],values:{title:"",template:"",text:""},fields:{}}},computed:{templateOptions:function(){return this.templates.map(function(t){return{value:t,text:t}})}},created:function(){var t=this;this.load().then(function(e){t.headline=e.headline,t.target=e.target,t.templates=e.templates,t.values.template=e.defaultTemplate,t.fields={title:{label:"Title",type:"text",width:"1/2"},template:{label:"Template",type:"select",width:"1/2",options:t.templateOptions},text:{label:"Text",type:"textarea",buttons:!1}}})}};if(typeof b==="function"){b=b.options}Object.assign(b,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticStyle:{"background-color":"#dfdfdf","margin-bottom":"2rem","padding":"2rem"}},[_c("k-headline",{staticStyle:{"margin-bottom":"2rem"},attrs:{"size":"medium"}},[_vm._v(_vm._s(_vm.headline))]),_vm._v(" "),_c("k-form",{attrs:{"fields":_vm.fields},on:{"submit":_vm.submit},model:{value:_vm.values,callback:function($$v){_vm.values=$$v},expression:"values"}},[_c("footer",{staticStyle:{"margin-top":"2rem"},attrs:{"slot":"footer"},slot:"footer"},[_c("div",{staticStyle:{"display":"flex","-webkit-box-pack":"justify","-ms-flex-pack":"justify","justify-content":"space-between"}},[_c("k-button",{attrs:{"icon":"add","type":"submit","theme":"positive"},on:{"click":function($event){$event.preventDefault();return _vm.publish($event)}}},[_vm._v(" Publish ")]),_vm._v(" "),_c("k-button",{attrs:{"icon":"check","type":"submit","theme":"positive"}},[_vm._v(" Create ")])],1)])])],1)};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());var c={methods:{onUploadSuccess:function(){var t=this;this.$api.pages.files(this.postPath.replace(/\//g,"+")).then(function(e){var a=e.data.map(function(e){var a=e.filename;return t.dragText.replace("[FILENAME]",a)});t.$api.pages.update(t.postPath.replace(/\//g,"+"),{text:a.join("\n")}).then(function(){t.$router.push({name:"Page",params:{path:t.postPath.replace(/\//g,"+")}})})})},drop:function(t){var e=this,a=t[0];this.createShallowPost(a.name).then(function(a){e.postPath=a.id,e.$refs.uploader.drop(t,{url:window.panel.api+"/"+e.$api.pages.url(e.postPath,"files"),multiple:!0})})},createShallowPost:function(t){var e=this.target.replace("[YEAR]",this.$library.dayjs().format("YYYY"));return this.$api.pages.create(e,{slug:this.$helper.slug(t),title:t,template:this.template,content:{title:t,text:""}})}},data:function(){return{postPath:null,headline:"",text:"",dragText:"",target:"",template:"",fields:{}}},created:function(){var t=this;this.load().then(function(e){t.headline=e.headline,t.text=e.text,t.dragText=e.dragText,t.target=e.target,t.template=e.template})}};if(typeof c==="function"){c=c.options}Object.assign(c,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticStyle:{"background-color":"#dfdfdf","margin-bottom":"2rem","padding":"2rem"}},[_c("k-dropzone",{on:{"drop":_vm.drop}},[_c("k-headline",{staticStyle:{"margin-bottom":"2rem"},attrs:{"size":"medium"}},[_vm._v(_vm._s(_vm.headline))]),_vm._v(" "),_c("p",{staticStyle:{"padding-top":"2rem","padding-bottom":"2rem"}},[_vm._v(_vm._s(_vm.text))]),_vm._v(" "),_c("k-upload",{ref:"uploader",on:{"success":_vm.onUploadSuccess}})],1)],1)};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("pwaldhauer/quick-add",{sections:{quickadd:b,quickaddimage:c}});})(); \ No newline at end of file +(function () {var a={methods:{publish:function(){this._createPage(!0)},submit:function(){this._createPage()},_createPage:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=this.target.replace("[YEAR]",this.$library.dayjs().format("YYYY"));this.$api.pages.create(a,{slug:this.$helper.slug(this.values.title),title:this.values.title,template:this.values.template,content:{title:this.values.title,text:this.values.text}}).then(function(a){e?t.$api.pages.changeStatus(a.id,"listed").then(function(e){t.$go("pages/".concat(a.id.replace(/\//g,"+")))}):t.$go("pages/".concat(a.id.replace(/\//g,"+")))})}},data:function(){return{headline:"",target:"",templates:[],values:{title:"",template:"",text:""},fields:{}}},computed:{templateOptions:function(){return this.templates.map(function(t){return{value:t,text:t}})}},created:function(){var t=this;this.load().then(function(e){t.headline=e.headline,t.target=e.target,t.templates=e.templates,t.values.template=e.defaultTemplate,t.fields={title:{label:"Title",type:"text",width:"1/2"},template:{label:"Template",type:"select",width:"1/2",options:t.templateOptions},text:{label:"Text",type:"textarea",buttons:!1}}})}};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("div",{staticClass:"panel"},[_c("k-headline",{staticClass:"headline",attrs:{"size":"medium"}},[_vm._v(_vm._s(_vm.headline))]),_vm._v(" "),_c("div",{staticClass:"form"},[_c("k-form",{attrs:{"fields":_vm.fields},on:{"submit":_vm.submit},model:{value:_vm.values,callback:function($$v){_vm.values=$$v},expression:"values"}},[_c("footer",{staticClass:"form-footer",attrs:{"slot":"footer"},slot:"footer"},[_c("div",{staticStyle:{"display":"flex","-webkit-box-pack":"justify","-ms-flex-pack":"justify","justify-content":"space-between"}},[_c("k-button",{attrs:{"icon":"add","type":"submit","theme":"positive"},on:{"click":function($event){$event.preventDefault();return _vm.publish($event)}}},[_vm._v(" Publish ")]),_vm._v(" "),_c("k-button",{attrs:{"icon":"check","type":"submit","theme":"positive"}},[_vm._v(" Create ")])],1)])])],1)],1)};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());var b={methods:{onUploadSuccess:function(){var t=this;this.$api.pages.files(this.postPath.replace(/\//g,"+")).then(function(e){var a=e.data.map(function(e){var a=e.filename;return t.dragText.replace("[FILENAME]",a)});t.$api.pages.update(t.postPath.replace(/\//g,"+"),{text:a.join("\n")}).then(function(){t.$go("pages/".concat(t.postPath.replace(/\//g,"+")))})})},drop:function(t){var e=this,a=t[0];this.createShallowPost(a.name).then(function(a){e.postPath=a.id,e.$refs.uploader.drop(t,{url:e.$urls.api+"/"+e.$api.pages.url(e.postPath,"files"),multiple:!0})})},createShallowPost:function(t){var e=this.target.replace("[YEAR]",this.$library.dayjs().format("YYYY"));return this.$api.pages.create(e,{slug:this.$helper.slug(t),title:t,template:this.template,content:{title:t,text:""}})}},data:function(){return{postPath:null,headline:"",text:"",dragText:"",target:"",template:"",fields:{}}},created:function(){var t=this;this.load().then(function(e){t.headline=e.headline,t.text=e.text,t.dragText=e.dragText,t.target=e.target,t.template=e.template})}};if(typeof b==="function"){b=b.options}Object.assign(b,function(){var render=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticClass:"panel"},[_c("k-dropzone",{on:{"drop":_vm.drop}},[_c("k-headline",{staticClass:"headline",attrs:{"size":"medium"}},[_vm._v(_vm._s(_vm.headline))]),_vm._v(" "),_c("p",{staticClass:"inner"},[_vm._v(_vm._s(_vm.text))]),_vm._v(" "),_c("k-upload",{ref:"uploader",on:{"success":_vm.onUploadSuccess}})],1)],1)};var staticRenderFns=[];return{render:render,staticRenderFns:staticRenderFns,_compiled:true,_scopeId:null,functional:undefined}}());panel.plugin("pwaldhauer/quick-add",{sections:{quickadd:a,quickaddimage:b}});})(); \ No newline at end of file diff --git a/screenshot.png b/screenshot.png index a665fea..d909325 100644 Binary files a/screenshot.png and b/screenshot.png differ