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

8 lines
17 KiB
JavaScript

try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="72f3c587-ad9c-4b1a-9607-db9a194a9c9a",e._sentryDebugIdIdentifier="sentry-dbid-72f3c587-ad9c-4b1a-9607-db9a194a9c9a")}catch(e){}(self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[]).push([[574],{844:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>g});var n=function(){var e=this,t=e._self._c;return!e.article||e.loading?t("div",{staticClass:"loading"},[t("span",[e._v(e._s(e.$t("default.Loading…")))])]):t("article",{staticClass:"article"},[t("nav",{staticClass:"prevnext top"},[t("ul",[t("li",[e.prevnext.prev?t("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(" "),t("li",[e.prevnext.next?t("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(" "),t("div",{staticClass:"cols"},[t("div",{staticClass:"col col-left"},[e.image_accroche?t("section",{staticClass:"accroche"},[t("figure",[t("img",{attrs:{src:e.image_accroche.url,alt:e.image_accroche.alt,title:e.image_accroche.title},on:{click:function(t){return e.setLightBox(0)}}})])]):e._e(),e._v(" "),e.article.showroom?t("section",{staticClass:"showroom"},[t("h2",[e._v(e._s(e.article.showroom.name))]),e._v(" "),t("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(" "),t("br"),e._v(" "),t("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(" "),t("div",{staticClass:"col col-right"},[t("section",{staticClass:"body",domProps:{innerHTML:e._s(e.article.body)}}),e._v(" "),t("div",{staticClass:"gallery-wrapper"},e._l(e.lightbox_items,(function(i,n){return n>0?t("div",{key:n,staticClass:"image",style:{backgroundImage:"url("+i.thumb+")"},on:{click:function(t){return e.setLightBox(n)}}}):e._e()})),0),e._v(" "),t("aside",{staticClass:"linked-materials"},[t("h3",{staticClass:"field__label"},[e._v(e._s(e.$t("materio.Linked Materials")))]),e._v(" "),t("div",{staticClass:"cards-list"},[t("ul",{},e._l(e.article.linked_materials,(function(e){return t("li",{key:e.id},[t("Card",{attrs:{item:e}})],1)})),0)])])])]),e._v(" "),t("nav",{staticClass:"prevnext bottom"},[t("ul",[t("li",[e.prevnext.prev?t("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(" "),t("li",[e.prevnext.next?t("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(3611),s=i(6875),l=i(6691),r=i(585),d=i(2087),o=i(3581),c=i.n(o),m=i(4951),u=i(5353);const v={name:"Article",router:a.A,store:s.A,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,u.aH)({items:e=>e.Blabla.items,coolLightBoxItems:e=>e.Common.coolLightBoxItems,coolLightBoxIndex:e=>e.Common.coolLightBoxIndex})},created(){this.getArticle()},methods:{...(0,u.i0)({getItems:"Blabla/getItems",getItemIndex:"Blabla/getItemIndex",getPrevNextItems:"Blabla/getPrevNextItems",setcoolLightBoxItems:"Common/setcoolLightBoxItems",setcoolLightBoxIndex:"Common/setcoolLightBoxIndex"}),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=d.Ay`{
article(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
...ArticleFields
}
}
${c()}
`;l.A.post("",{query:(0,r.y)(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.setcoolLightBoxItems(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}})},setLightBox(e){this.setcoolLightBoxItems(this.lightbox_items),this.setcoolLightBoxIndex(e)}},components:{Card:m.A},watch:{$route(e,t){this.getArticle()}}};const g=(0,i(4486).A)(v,n,[],!1,null,"95837946",null).exports},3581: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}};function i(e,t){if("FragmentSpread"===e.kind)t.add(e.name.value);else if("VariableDefinition"===e.kind){var n=e.type;"NamedType"===n.kind&&t.add(n.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){i(e,t)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){i(e,t)})),e.definitions&&e.definitions.forEach((function(e){i(e,t)}))}var n={};function a(e,t){for(var i=0;i<e.definitions.length;i++){var n=e.definitions[i];if(n.name&&n.name.value==t)return n}}t.definitions.forEach((function(e){if(e.name){var t=new Set;i(e,t),n[e.name.value]=t}})),e.exports=t,e.exports.ArticleFields=function(e,t){var i={kind:e.kind,definitions:[a(e,t)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var s=n[t]||new Set,l=new Set,r=new Set;for(s.forEach((function(e){r.add(e)}));r.size>0;){var d=r;r=new Set,d.forEach((function(e){l.has(e)||(l.add(e),(n[e]||new Set).forEach((function(e){r.add(e)})))}))}return l.forEach((function(t){var n=a(e,t);n&&i.definitions.push(n)})),i}(t,"ArticleFields")},4951:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var n=function(){var e=this,t=e._self._c;return t("article",{staticClass:"card search-card"},[t("header",{on:{click:function(t){return t.preventDefault(),e.openModalCard.apply(null,arguments)}}},[e.hasDBAccess?t("h1",[e._v(e._s(e.item.title))]):e._e(),e._v(" "),t("h4",[e._v(e._s(e.item.short_description))]),e._v(" "),e.hasDBAccess?t("span",{staticClass:"ref"},[e._v(e._s(e.item.reference))]):e._e()]),e._v(" "),e.hasDBAccess?t("nav",{staticClass:"tools"},[t("section",{staticClass:"tool flags"},[t("span",{staticClass:"btn mdi mdi-folder-outline"}),e._v(" "),t("div",{staticClass:"tool-content"},[t("ul",[e._l(e.flagcolls,(function(i){return e.flagcolls?t("li",{key:i.id},[t("span",{staticClass:"flag mdi",class:[e.flagIsLoading(i.id)?"mdi-loading mdi-spin":e.flagIsActive(i.id)?"mdi-close-circle isActive":"mdi-plus"],attrs:{collid:i.id},on:{click:function(t){return t.preventDefault(),e.onFlagActionCard.apply(null,arguments)}}},[e._v("\n "+e._s(i.name)+"\n ")])]):e._e()})),e._v(" "),e.collsLength<15?t("li",{staticClass:"create-flag"},[t("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.apply(null,arguments))},input:function(t){t.target.composing||(e.new_folder_name=t.target.value)}}}),e._v(" "),t("span",{staticClass:"add-btn mdi",class:e.addFlagBtnClassObj,on:{click:function(t){return t.preventDefault(),t.stopPropagation(),e.onCreateFlagColl.apply(null,arguments)}}})]):e._e()],2)])]),e._v(" "),e.item.samples&&e.item.samples.length?t("section",{staticClass:"tool samples"},[t("span",{staticClass:"btn mdi mdi-map-marker-star-outline"}),e._v(" "),t("div",{staticClass:"tool-content"},[t("span",{staticClass:"label"},[e._v(e._s(e.$t("materio.Samples")))]),e._v(" "),t("ul",e._l(e.item.samples,(function(i){return t("li",{key:i.showroom.id},[t("span",{staticClass:"showroom"},[e._v(e._s(i.showroom.name))]),e._v(": "+e._s(i.location)+"\n ")])})),0)])]):e._e(),e._v(" "),e.item.note?t("section",{staticClass:"tool note"},[t("span",{staticClass:"btn mdi mdi-note"})]):e._e(),e._v(" "),t("section",{staticClass:"tool print"},[t("a",{attrs:{href:e.item.path+"/printable/print",target:"_blank"}},[t("span",{staticClass:"btn mdi mdi-printer"})])])]):e._e(),e._v(" "),t("section",{directives:[{name:"switcher",rawName:"v-switcher"}],staticClass:"images"},e._l(e.item.images,(function(i,n){return t("figure",{directives:[{name:"lazy",rawName:"v-lazy",value:n,expression:"index"}],key:i.url,staticClass:"lazy"},[t("img",{attrs:{"data-src":i.style_cardmedium_url,title:i.title}}),e._v(" "),t("img",{staticClass:"blank",attrs:{src:e.blanksrc},on:{click:function(t){return t.preventDefault(),e.openModalCard.apply(null,arguments)}}})])})),0)])};n._withStripped=!0;var a=i(5353),s=i(9811),l=i(2037),r=function(){var e=this,t=e._self._c;return t("div",{attrs:{id:"member-warning"}},[t("h2",[e._v(e._s(e.$t("materio.Oops")))]),e._v(" "),t("p",[e._v(e._s(e.$t("materio.To be able to access to our 8000+ materials you need become a member")))]),e._v(" "),t("a",{attrs:{href:"/pricing"},on:{click:function(t){return t.preventDefault(),e.onclick.apply(null,arguments)}}},[e._v(e._s(e.$t("materio.Join us")))])])};r._withStripped=!0;const d={name:"MemberWarning",router:i(3611).A,data:()=>({}),methods:{onclick(){this.$modal.hideAll(),this.$router.push({name:"pricing"})}}};var o=i(4486);const c=(0,o.A)(d,r,[],!1,null,"54d9dd2c",null).exports,m={name:"Card",props:["item"],mixins:[s.A],components:{ModalCard:l.default,MemberWarning:c},data:()=>({blanksrc:`${drupalSettings.path.themePath}/assets/img/blank.gif`,loadingFlag:!1,new_folder_name:"",is_creating_folder:!1}),computed:{...(0,a.aH)({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.i0)({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(c,{},{draggable:!1,width:"400px",height:"250px"})}}};const u=(0,o.A)(m,n,[],!1,null,"1220dd05",null).exports}}]);
//# sourceMappingURL=module-article.f39260d40a7d3c5bea70.bundle.js.map