mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-18 19:13:17 +00:00
19 lines
No EOL
15 KiB
JavaScript
Vendored
19 lines
No EOL
15 KiB
JavaScript
Vendored
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([["/js/collectioncompose"],{"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionCompose.vue?vue&type=script&lang=js":
|
|
/*!******************************************************************************************************************************************************************************************************************!*\
|
|
!*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionCompose.vue?vue&type=script&lang=js ***!
|
|
\******************************************************************************************************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>o});const o={props:["collection-id","profile-id"],data:function(){return{config:window.App.config,loaded:!1,limit:8,step:1,title:"",description:"",collection:{title:"",description:"",visibility:"draft"},id:"",posts:[],tab:"add",tabs:["all","add","order"],recentPosts:[],selectedPost:""}},beforeMount:function(){var t=this;axios.get("/api/local/collection/"+this.collectionId).then((function(e){t.collection=e.data}))},mounted:function(){this.fetchRecentPosts(),this.fetchItems(),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},methods:{addToIds:function(t){var e=this;axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:t}).then((function(t){e.fetchItems(),e.fetchRecentPosts(),e.tab="all",e.id=""})).catch((function(t){swal("Invalid URL","The post you entered was invalid","error"),e.id=""}))},fetchItems:function(){var t=this;axios.get("/api/local/collection/items/"+this.collectionId).then((function(e){t.posts=e.data,t.loaded=!0}))},addId:function(){var t=this.config.uploader.max_collection_length;if(this.posts.length>=t)swal("Error","You can only add "+t+" posts per collection","error");else{var e=this.id,s=window.location.origin,o=e.split("/");if(e.slice(0,s.length)!==s&&(swal("Invalid URL","You can only add posts from this instance","error"),this.id=""),e.includes("/i/web/post/")||e.includes("/p/")){var i=o[o.length-1];return console.log("adding "+i),void this.addToIds(i)}swal("Invalid URL","Invalid URL","error"),this.id=""}},previewUrl:function(t){return t.sensitive?"/storage/no-preview.png?v="+(new Date).getTime():t.media_attachments[0].preview_url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");background-size:cover;"},fetchRecentPosts:function(){var t=this;axios.get("/api/v1/accounts/"+this.profileId+"/statuses",{params:{only_media:!0,min_id:1,limit:40}}).then((function(e){t.recentPosts=e.data.filter((function(e){var s=t.posts.map((function(t){return t.id}));return("public"==e.visibility||"unlisted"==e.visibility)&&0==e.sensitive&&-1==s.indexOf(e.id)}))}))},selectPost:function(t){this.selectedPost=t.id,this.id=t.url},publish:function(){0!=this.posts.length?axios.post("/api/local/collection/"+this.collectionId+"/publish",{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){window.location.href=t.data.url})).catch((function(t){swal("Something went wrong","There was a problem with your request, please try again later.","error")})):swal("Error","You cannot publish an empty collection")},save:function(){axios.post("/api/local/collection/"+this.collectionId,{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){swal("Saved!","You have successfully saved this collection.","success")}))},deleteCollection:function(){window.confirm("Are you sure you want to delete this collection?")&&axios.delete("/api/local/collection/"+this.collectionId).then((function(t){window.location.href="/"}))}}}},"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionCompose.vue?vue&type=template&id=2e26dc26":
|
|
/*!*****************************************************************************************************************************************************************************************************************************************************************************************************!*\
|
|
!*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionCompose.vue?vue&type=template&id=2e26dc26 ***!
|
|
\*****************************************************************************************************************************************************************************************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{render:()=>o,staticRenderFns:()=>i});var o=function(){var t=this,e=t._self._c;return e("div",{staticClass:"container"},[t.loaded?e("div",{staticClass:"row"},[t._m(0),t._v(" "),e("div",{staticClass:"col-12 col-md-4 pt-3"},[e("div",{staticClass:"card rounded-0 shadow-none border",staticStyle:{"min-height":"440px"}},[e("div",{staticClass:"card-body"},[e("div",[e("form",[e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Title")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.collection.title,expression:"collection.title"}],staticClass:"form-control",attrs:{type:"text",id:"title",placeholder:"Collection Title",maxlength:"50"},domProps:{value:t.collection.title},on:{input:function(e){e.target.composing||t.$set(t.collection,"title",e.target.value)}}}),t._v(" "),e("div",{staticClass:"text-right small text-muted"},[e("span",[t._v(t._s(t.collection.title?t.collection.title.length:0)+"/50")])])]),t._v(" "),e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"description"}},[t._v("Description")]),t._v(" "),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.collection.description,expression:"collection.description"}],staticClass:"form-control",attrs:{id:"description",placeholder:"Example description here",rows:"3",maxlength:"500"},domProps:{value:t.collection.description},on:{input:function(e){e.target.composing||t.$set(t.collection,"description",e.target.value)}}}),t._v(" "),e("div",{staticClass:"text-right small text-muted"},[e("span",[t._v(t._s(t.collection.description?t.collection.description.length:0)+"/500")])])]),t._v(" "),e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"visibility"}},[t._v("Visibility")]),t._v(" "),e("select",{directives:[{name:"model",rawName:"v-model",value:t.collection.visibility,expression:"collection.visibility"}],staticClass:"custom-select",on:{change:function(e){var s=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.collection,"visibility",e.target.multiple?s:s[0])}}},[e("option",{attrs:{value:"public"}},[t._v("Public")]),t._v(" "),e("option",{attrs:{value:"private"}},[t._v("Followers Only")]),t._v(" "),e("option",{attrs:{value:"draft"}},[t._v("Draft")])])])]),t._v(" "),e("hr"),t._v(" "),e("p",[t.posts.length>0&&"draft"!=t.collection.visibility?e("button",{staticClass:"btn btn-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.publish}},[t._v("Publish")]):e("button",{staticClass:"btn btn-primary font-weight-bold btn-block disabled",attrs:{type:"button",disabled:""}},[t._v("Publish")])]),t._v(" "),e("p",[e("button",{staticClass:"btn btn-outline-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.save}},[t._v("Save")])]),t._v(" "),e("p",{staticClass:"mb-0"},[e("button",{staticClass:"btn btn-outline-secondary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.deleteCollection}},[t._v("Delete")])])])])])]),t._v(" "),e("div",{staticClass:"col-12 col-md-8 pt-3"},[e("div",[e("ul",{staticClass:"nav nav-tabs"},[e("li",{staticClass:"nav-item"},[e("a",{class:["add"==t.tab?"nav-link font-weight-bold bg-white active":"nav-link font-weight-bold text-muted"],attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.tab="add"}}},[t._v("Add Posts")])]),t._v(" "),e("li",{staticClass:"nav-item"},[e("a",{class:["all"==t.tab?"nav-link font-weight-bold bg-white active":"nav-link font-weight-bold text-muted"],attrs:{href:"#"},on:{click:function(e){e.preventDefault(),t.tab="all"}}},[t._v("Preview")])])])]),t._v(" "),e("div",{staticClass:"card rounded-0 shadow-none border border-top-0"},[e("div",{staticClass:"card-body",staticStyle:{"min-height":"460px"}},["all"==t.tab?e("div",{staticClass:"row"},t._l(t.posts,(function(s,o){return e("div",{staticClass:"col-4 p-1"},[e("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:s.url}},[e("div",{staticClass:"square"},["photo:album"==s.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==s.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==s.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-film fa-2x"})]):t._e(),t._v(" "),e("div",{staticClass:"square-content",style:t.previewBackground(s)}),t._v(" "),e("div",{staticClass:"info-overlay-text"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-heart fa-lg p-2 d-flex-inline"}),t._v(" "),e("span",{staticClass:"d-flex-inline"},[t._v(t._s(s.favourites_count))])]),t._v(" "),e("span",[e("span",{staticClass:"fas fa-retweet fa-lg p-2 d-flex-inline"}),t._v(" "),e("span",{staticClass:"d-flex-inline"},[t._v(t._s(s.reblogs_count))])])])])])])])})),0):t._e(),t._v(" "),"add"==t.tab?e("div",[e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Post by URL")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.id,expression:"id"}],staticClass:"form-control",attrs:{type:"text",placeholder:"https://pixelfed.dev/p/admin/1"},domProps:{value:t.id},on:{input:function(e){e.target.composing||(t.id=e.target.value)}}}),t._v(" "),e("p",{staticClass:"help-text small text-muted"},[t._v("Only local, public posts can be added")])]),t._v(" "),e("div",{staticClass:"form-group pt-4"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Recent Post")]),t._v(" "),e("div",{staticStyle:{"max-height":"360px","overflow-y":"auto"}},t._l(t.recentPosts,(function(s,o){return e("div",{class:[t.selectedPost==s.id?"box-shadow border border-warning d-inline-block m-1":"d-inline-block m-1"],on:{click:function(e){return t.selectPost(s)}}},[e("div",{staticClass:"cursor-pointer",style:"width: 175px; height: 175px; "+t.previewBackground(s)})])})),0)]),t._v(" "),e("hr"),t._v(" "),e("button",{staticClass:"btn btn-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.addId}},[t._v("Add Post")])]):t._e(),t._v(" "),"order"==t.tab?e("div"):t._e()])])])]):t._e()])},i=[function(){var t=this._self._c;return t("div",{staticClass:"col-12 col-md-6 offset-md-3 pt-5"},[t("div",{staticClass:"text-center pb-4"},[t("h1",[this._v("Create Collection")])])])}];o._withStripped=!0},"./resources/assets/js/collectioncompose.js":
|
|
/*!**************************************************!*\
|
|
!*** ./resources/assets/js/collectioncompose.js ***!
|
|
\**************************************************/(t,e,s)=>{Vue.component("collection-compose",s(/*! ./components/CollectionCompose.vue */"./resources/assets/js/components/CollectionCompose.vue").default)},"./resources/assets/js/components/CollectionCompose.vue":
|
|
/*!**************************************************************!*\
|
|
!*** ./resources/assets/js/components/CollectionCompose.vue ***!
|
|
\**************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>n});var o=s(/*! ./CollectionCompose.vue?vue&type=template&id=2e26dc26 */"./resources/assets/js/components/CollectionCompose.vue?vue&type=template&id=2e26dc26"),i=s(/*! ./CollectionCompose.vue?vue&type=script&lang=js */"./resources/assets/js/components/CollectionCompose.vue?vue&type=script&lang=js"),l={};for(const t in i)"default"!==t&&(l[t]=()=>i[t]);s.d(e,l);var a=(0,s(/*! !../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */"./node_modules/vue-loader/lib/runtime/componentNormalizer.js").default)(i.default,o.render,o.staticRenderFns,!1,null,null,null);a.options.__file="resources/assets/js/components/CollectionCompose.vue";const n=a.exports},"./resources/assets/js/components/CollectionCompose.vue?vue&type=script&lang=js":
|
|
/*!**************************************************************************************!*\
|
|
!*** ./resources/assets/js/components/CollectionCompose.vue?vue&type=script&lang=js ***!
|
|
\**************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>l});var o=s(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CollectionCompose.vue?vue&type=script&lang=js */"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionCompose.vue?vue&type=script&lang=js"),i={};for(const t in o)"default"!==t&&(i[t]=()=>o[t]);s.d(e,i);const l=o.default},"./resources/assets/js/components/CollectionCompose.vue?vue&type=template&id=2e26dc26":
|
|
/*!********************************************************************************************!*\
|
|
!*** ./resources/assets/js/components/CollectionCompose.vue?vue&type=template&id=2e26dc26 ***!
|
|
\********************************************************************************************/(t,e,s)=>{"use strict";s.r(e);var o=s(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CollectionCompose.vue?vue&type=template&id=2e26dc26 */"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionCompose.vue?vue&type=template&id=2e26dc26"),i={};for(const t in o)"default"!==t&&(i[t]=()=>o[t]);s.d(e,i)}},t=>{t.O(0,["/js/vendor"],(()=>{return e="./resources/assets/js/collectioncompose.js",t(t.s=e);var e}));t.O()}]); |