materio-d9/web/themes/custom/materiotheme/assets/dist/module-article.bundle.js

7 lines
16 KiB
JavaScript

(self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[]).push([[790],{7682:e=>{var t={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"ArticleFields"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Article"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"uuid"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"author"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"date"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"start"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"end"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"source"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"body"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"showroom"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"tags"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"thesaurus"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"linked_materials"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"title"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"short_description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"reference"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"images"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"style_cardmedium_url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"style_hd_url"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"samples"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"showroom"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"location"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"note"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"images"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"alt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"style_articlecardmedium"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"videos"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"memo"},arguments:[],directives:[]}]}}],loc:{start:0,end:604}};t.loc.source={body:"fragment ArticleFields on Article {\n id\n uuid\n title\n author\n date{\n start\n end\n }\n source{\n url\n title\n }\n body\n showroom {\n id\n name\n }\n tags {\n id\n name\n }\n thesaurus {\n id\n name\n }\n linked_materials {\n id\n title\n short_description\n reference\n images {\n url\n style_cardmedium_url\n style_hd_url\n }\n \tsamples{\n showroom{\n name\n id\n }\n location\n }\n note{\n id\n }\n }\n images {\n id\n url\n alt\n style_articlecardmedium{\n url\n }\n }\n videos {\n url\n }\n memo\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};e.exports=t},3775:(e,t,i)=>{"use strict";i.d(t,{Z:()=>g});var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("article",{staticClass:"card search-card"},[i("header",{on:{click:function(t){return t.preventDefault(),e.openModalCard(t)}}},[e.hasDBAccess?i("h1",[e._v(e._s(e.item.title))]):e._e(),e._v(" "),i("h4",[e._v(e._s(e.item.short_description))]),e._v(" "),e.hasDBAccess?i("span",{staticClass:"ref"},[e._v(e._s(e.item.reference))]):e._e()]),e._v(" "),e.hasDBAccess?i("nav",{staticClass:"tools"},[i("section",{staticClass:"tool flags"},[i("span",{staticClass:"btn mdi mdi-folder-outline"}),e._v(" "),i("div",{staticClass:"tool-content"},[i("ul",[e._l(e.flagcolls,(function(t){return e.flagcolls?i("li",{key:t.id},[i("span",{staticClass:"flag mdi",class:[e.flagIsLoading(t.id)?"mdi-loading mdi-spin":e.flagIsActive(t.id)?"mdi-close-circle isActive":"mdi-plus"],attrs:{collid:t.id},on:{click:function(t){return t.preventDefault(),e.onFlagActionCard(t)}}},[e._v("\n "+e._s(t.name)+"\n ")])]):e._e()})),e._v(" "),e.collsLength<15?i("li",{staticClass:"create-flag"},[i("input",{directives:[{name:"model",rawName:"v-model",value:e.new_folder_name,expression:"new_folder_name"}],attrs:{placeholder:"new folder"},domProps:{value:e.new_folder_name},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),t.stopPropagation(),e.onCreateFlagColl(t))},input:function(t){t.target.composing||(e.new_folder_name=t.target.value)}}}),e._v(" "),i("span",{staticClass:"add-btn mdi",class:e.addFlagBtnClassObj,on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.onCreateFlagColl(t)}}})]):e._e()],2)])]),e._v(" "),e.item.samples&&e.item.samples.length?i("section",{staticClass:"tool samples"},[i("span",{staticClass:"btn mdi mdi-map-marker-star-outline"}),e._v(" "),i("div",{staticClass:"tool-content"},[i("span",{staticClass:"label"},[e._v(e._s(e.$t("materio.Samples")))]),e._v(" "),i("ul",e._l(e.item.samples,(function(t){return i("li",{key:t.showroom.id},[i("span",{staticClass:"showroom"},[e._v(e._s(t.showroom.name))]),e._v(": "+e._s(t.location)+"\n ")])})),0)])]):e._e(),e._v(" "),e.item.note?i("section",{staticClass:"tool note"},[i("span",{staticClass:"btn mdi mdi-note"})]):e._e(),e._v(" "),i("section",{staticClass:"tool print"},[i("a",{attrs:{href:e.item.path+"/printable/print",target:"_blank"}},[i("span",{staticClass:"btn mdi mdi-printer"})])])]):e._e(),e._v(" "),i("section",{directives:[{name:"switcher",rawName:"v-switcher"}],staticClass:"images"},e._l(e.item.images,(function(t,n){return i("figure",{directives:[{name:"lazy",rawName:"v-lazy",value:n,expression:"index"}],key:t.url,staticClass:"lazy"},[i("img",{attrs:{"data-src":t.style_cardmedium_url,title:t.title}}),e._v(" "),i("img",{staticClass:"blank",attrs:{src:e.blanksrc},on:{click:function(t){return t.preventDefault(),e.openModalCard(t)}}})])})),0)])};n._withStripped=!0;var a=i(629),s=i(8357),l=i(3939),r=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{attrs:{id:"member-warning"}},[i("h2",[e._v(e._s(e.$t("materio.Oops")))]),e._v(" "),i("p",[e._v(e._s(e.$t("materio.To be able to access to our 8000+ materials you need become a member")))]),e._v(" "),i("a",{attrs:{href:"/pricing"},on:{click:function(t){return t.preventDefault(),e.onclick(t)}}},[e._v(e._s(e.$t("materio.Join us")))])])};r._withStripped=!0;const d={name:"MemberWarning",router:i(4408).Z,data:()=>({}),methods:{onclick(){this.$modal.hideAll(),this.$router.push({name:"pricing"})}}};var o=i(1900),c=(0,o.Z)(d,r,[],!1,null,"bce9630c",null);c.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/MemberWarning.vue";const m=c.exports,u={name:"Card",props:["item"],mixins:[s.Z],components:{ModalCard:l.default,MemberWarning:m},data:()=>({blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,loadingFlag:!1,new_folder_name:"",is_creating_folder:!1}),computed:{...(0,a.rn)({flagcolls:e=>e.User.flagcolls,isloggedin:e=>e.User.isloggedin,hasDBAccess:e=>e.User.hasDBAccess}),collsLength(){return Object.keys(this.flagcolls).length},addFlagBtnClassObj(){return{"mdi-plus-circle-outline":!this.is_creating_folder,"mdi-loading":this.is_creating_folder,active:this.new_folder_name.length>4&&!this.is_creating_folder,loading:this.is_creating_folder}}},beforeMount(){},methods:{...(0,a.nv)({createFlagColl:"User/createFlagColl",flagUnflag:"User/flagUnflag"}),onCreateFlagColl(){this.new_folder_name,this.is_creating_folder=!0,this.createFlagColl(this.new_folder_name).then((e=>{this.new_folder_name="",this.is_creating_folder=!1;let t=e.id;this.loadingFlag=t,this.flagUnflag({action:"flag",id:this.item.id,collid:t}).then((e=>{this.loadingFlag=!1}))}))},flagIsActive(e){return-1!==this.flagcolls[e].items.indexOf(this.item.id)},flagIsLoading(e){return e===this.loadingFlag},onFlagActionCard(e){if(this.item,!this.loadingFlag){let t=e.target.getAttribute("collid"),i=this.flagIsActive(t)?"unflag":"flag";this.loadingFlag=t,this.flagUnflag({action:i,id:this.item.id,collid:t}).then((e=>{this.loadingFlag=!1}))}},openModalCard(e){this.hasDBAccess,this.hasDBAccess?this.$modal.show(l.default,{item:this.item,addNoteId:e=>{this.item.note={id:e}}},{name:`modal-${this.item.id}`,draggable:!1,classes:"vm--modale-card",width:"95%",height:"95%"}):this.$modal.show(m,{},{draggable:!1,width:"400px",height:"250px"})}}};var v=(0,o.Z)(u,n,[],!1,null,"0318fc68",null);v.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/Card.vue";const g=v.exports},4060:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>_});var n=function(){var e=this,t=e.$createElement,i=e._self._c||t;return!e.article||e.loading?i("div",{staticClass:"loading"},[i("span",[e._v(e._s(e.$t("default.Loading…")))])]):i("article",{staticClass:"article"},[i("nav",{staticClass:"prevnext top"},[i("ul",[i("li",[e.prevnext.prev?i("a",{attrs:{href:e.prevnext.prev.view_node},domProps:{innerHTML:e._s(e.prevnext.prev.title)},on:{click:function(t){return t.preventDefault(),e.onPrevNext(e.prevnext.prev)}}}):e._e()]),e._v(" "),i("li",[e.prevnext.next?i("a",{attrs:{href:e.prevnext.next.view_node},domProps:{innerHTML:e._s(e.prevnext.next.title)},on:{click:function(t){return t.preventDefault(),e.onPrevNext(e.prevnext.next)}}}):e._e()])])]),e._v(" "),i("div",{staticClass:"cols"},[i("div",{staticClass:"col col-left"},[e.image_accroche?i("section",{staticClass:"accroche"},[i("figure",[i("img",{attrs:{src:e.image_accroche.url,alt:e.image_accroche.alt,title:e.image_accroche.title},on:{click:function(t){return e.setLightboxIndex(0)}}})])]):e._e(),e._v(" "),e.article.showroom?i("section",{staticClass:"showroom"},[i("h2",[e._v(e._s(e.article.showroom.name))]),e._v(" "),i("a",{staticClass:"mail",attrs:{href:"mail:"+e.article.showroom.field_public_email}},[e._v("\n "+e._s(e.article.showroom.field_public_email))]),e._v(" "),i("br"),e._v(" "),i("a",{staticClass:"phone",attrs:{href:"tel:"+e.article.showroom.field_public_phone}},[e._v("\n "+e._s(e.article.showroom.field_public_phone))])]):e._e()]),e._v(" "),i("div",{staticClass:"col col-right"},[i("section",{staticClass:"body",domProps:{innerHTML:e._s(e.article.body)}}),e._v(" "),i("CoolLightBox",{attrs:{items:e.lightbox_items,index:e.lightbox_index,loop:!0,srcName:"url"},on:{close:function(t){e.lightbox_index=null}}}),e._v(" "),i("div",{staticClass:"gallery-wrapper"},e._l(e.lightbox_items,(function(t,n){return n>0?i("div",{key:n,staticClass:"image",style:{backgroundImage:"url("+t.thumb+")"},on:{click:function(t){return e.setLightboxIndex(n)}}}):e._e()})),0),e._v(" "),i("aside",{staticClass:"linked-materials"},[i("h3",{staticClass:"field__label"},[e._v(e._s(e.$t("materio.Linked Materials")))]),e._v(" "),i("div",{staticClass:"cards-list"},[i("ul",{},e._l(e.article.linked_materials,(function(e){return i("li",{key:e.id},[i("Card",{attrs:{item:e}})],1)})),0)])])],1)]),e._v(" "),i("nav",{staticClass:"prevnext bottom"},[i("ul",[i("li",[e.prevnext.prev?i("a",{attrs:{href:e.prevnext.prev.view_node},domProps:{innerHTML:e._s(e.prevnext.prev.title)},on:{click:function(t){return t.preventDefault(),e.onPrevNext(e.prevnext.prev)}}}):e._e()]),e._v(" "),i("li",[e.prevnext.next?i("a",{attrs:{href:e.prevnext.next.view_node},domProps:{innerHTML:e._s(e.prevnext.next.title)},on:{click:function(t){return t.preventDefault(),e.onPrevNext(e.prevnext.next)}}}):e._e()])])])])};n._withStripped=!0;var a=i(4408),s=i(8492),l=i(546),r=i(3033),d=i(4119),o=i.n(d),c=i(7682),m=i.n(c),u=i(3775),v=i(629);const g={name:"Article",router:a.Z,store:s.Z,props:["item"],data:()=>({index:-1,prevnext:{},nid:null,path:null,article:{},image_accroche:null,lightbox_items:null,loading:!0,lightbox_index:null}),metaInfo(){return{title:this.article.title}},computed:{...(0,v.rn)({items:e=>e.Blabla.items})},created(){this.getArticle()},methods:{...(0,v.nv)({getItems:"Blabla/getItems",getItemIndex:"Blabla/getItemIndex",getPrevNextItems:"Blabla/getPrevNextItems"}),getArticle(){this.$route,this.$route.params.id?this.id=this.$route.params.id:"node"==drupalDecoupled.entity_type&&"article"==drupalDecoupled.entity_bundle&&(this.id=drupalDecoupled.entity_id),this.id?this.loadArticle():this.$router.replace({name:"home"})},getIndex(){this.article.id,this.getItemIndex(this.article.id).then((e=>{this.index=e,this.getPrevNextItems(e).then((e=>{this.prevnext=e}))}))},loadArticle(){this.loading=!0;const e=o()`{
article(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
...ArticleFields
}
}
${m()}
`;l.Z.post("",{query:(0,r.S)(e)}).then((({data:{data:{article:e}}})=>{this.parseDataGQL(e)})).catch((e=>{console.warn("Issue with loadArticle",e),Promise.reject(e)}))},parseDataGQL(e){this.article=e,this.items.length?this.getIndex():this.getItems().then((()=>{this.getIndex()})),this.image_accroche=e.images[0],this.lightbox_items=[];for(let t=0;t<e.images.length;t++)e.images[t].thumb=e.images[t].style_articlecardmedium.url,this.lightbox_items.push(e.images[t]);for(let t=0;t<e.videos.length;t++){let i=e.videos[t].url,n=null,a=null;switch(/https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/.exec(i).groups.provider){case"vimeo":n=/https:\/\/vimeo\.com\/(?<id>\d+)/.exec(i).groups.id||null,a="http://blogpeda.ac-poitiers.fr/ent-lyc/files/2015/06/Vimeo_icon_block.png";break;case"youtube":n=/https:\/\/(www\.)?youtube\.com\/watch\?v=(?<id>.+)/.exec(i).groups.id||null,a="http://img.youtube.com/vi/"+n+"/0.jpg"}this.lightbox_items.push({url:i,title:"",description:"",thumb:a})}this.lightbox_items,this.$store.commit("Common/setPagetitle",e.title),this.loading=!1},onPrevNext(e){let t=e.view_node.replace(/^\/\D{2,3}\/blabla\//g,"");this.$router.push({name:"article",params:{alias:t,id:e.nid}})},setLightboxIndex(e){this.lightbox_index=e}},components:{Card:u.Z},watch:{$route(e,t){this.getArticle()}}};var h=(0,i(1900).Z)(g,n,[],!1,null,"74fbee19",null);h.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Article.vue";const _=h.exports}}]);