fixed all eslint errors and warning, compiled as PROD

This commit is contained in:
2021-03-31 18:42:05 +02:00
parent ae3c8f1234
commit 3042f97b29
46 changed files with 388 additions and 42514 deletions

View File

@ -169,30 +169,30 @@ export default {
getPrevNextItems: 'Blabla/getPrevNextItems'
}),
getArticle(){
console.log('getArticle', this.$route);
console.log('getArticle', this.$route)
if (this.$route.params.id) {
// we come from internal link with vuejs
// using path to load from route is hasardous
// this.path = this.$route.path
this.id = this.$route.params.id
}else if(drupalDecoupled.entity_type == 'node' && drupalDecoupled.entity_bundle == 'article'){
} else if (drupalDecoupled.entity_type == 'node' && drupalDecoupled.entity_bundle == 'article') {
// we landed in an internal page
// get the id from drupalDeclouped, provided by materio_decoupled.module
this.id = drupalDecoupled.entity_id
}
if(this.id){
if (this.id) {
this.loadArticle()
}else{
} else {
// if for any reason we dont have the id redirect to home
this.$router.replace({name:'home'})
}
},
getIndex(){
console.log("Article getIndex article.id:", this.article.id);
console.log("Article getIndex article.id:", this.article.id)
this.getItemIndex(this.article.id).then((index) => {
this.index = index
console.log('article index', index, this);
console.log('article index', index, this)
this.getPrevNextItems(index).then((pn) => {
this.prevnext = pn
})
@ -202,17 +202,17 @@ export default {
console.log('loadArticle')
this.loading = true
let ast = gql`{
const ast = gql`{
article(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
...ArticleFields
}
}
${ articleFields }
${articleFields}
`
MGQ.post('', { query: print(ast)
})
.then(({ data:{data:{article}}}) => {
console.log('loadArticle', article )
console.log('loadArticle', article)
this.parseDataGQL(article)
})
.catch(error => {
@ -225,13 +225,13 @@ export default {
this.article = article
// get the prev next items
if(!this.items.length){
if (!this.items.length) {
// if items list not yet loaded preload them
this.getItems().then(() => {
// then get the index
this.getIndex()
})
}else{
} else {
// or directly get the index
this.getIndex()
}
@ -241,17 +241,17 @@ export default {
this.lightbox_items = [];
// fill the lightbox
for (var i = 0; i < article.images.length; i++) {
for (let i = 0; i < article.images.length; i++) {
article.images[i].thumb = article.images[i].style_articlecardmedium.url
this.lightbox_items.push(article.images[i]);
}
// parse embeded videos pushing it in lightbox
for (var i = 0; i < article.videos.length; i++) {
for (let i = 0; i < article.videos.length; i++) {
let videoUrl = article.videos[i].url
let provider_regex = /https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/;
let match = provider_regex.exec(videoUrl)
// console.log('provider', match.groups.provider);
// console.log('provider', match.groups.provider)
let video_id = null;
let video_thumb = null;
switch (match.groups.provider) {
@ -260,14 +260,14 @@ export default {
video_id = vimeo_regex.exec(videoUrl).groups.id || null;
// TODO: get the vimeo thumb https://coderwall.com/p/fdrdmg/get-a-thumbnail-from-a-vimeo-video
video_thumb = "http://blogpeda.ac-poitiers.fr/ent-lyc/files/2015/06/Vimeo_icon_block.png"
break;
break
case 'youtube':
let youtube_regex = /https:\/\/(www\.)?youtube\.com\/watch\?v=(?<id>.+)/;
video_id = youtube_regex.exec(videoUrl).groups.id || null;
video_thumb = "http://img.youtube.com/vi/"+video_id+"/0.jpg"
break;
break
}
// console.log('video_id', video_id);
// console.log('video_id', video_id)
this.lightbox_items.push({
url: videoUrl,
@ -277,7 +277,7 @@ export default {
});
}
console.log('Article this.content.lightbox_items', this.lightbox_items);
console.log('Article this.content.lightbox_items', this.lightbox_items)
// update main page title
this.$store.commit('Common/setPagetitle', article.title)
@ -285,9 +285,9 @@ export default {
this.loading = false;
},
onPrevNext(pn){
console.log('clicked on prev/next; prevnext', pn);
console.log('clicked on prev/next; prevnext', pn)
let alias = pn.view_node.replace(/^\/\D{2,3}\/blabla\//g, '')
console.log('alias', alias);
console.log('alias', alias)
this.$router.push({
name:`article`,

View File

@ -57,20 +57,20 @@ export default {
nextPage: 'Search/nextPage'
}),
// infiniteHandler($state){
// console.log('inifiniteHandler', $state);
// console.log('inifiniteHandler', $state)
// this.nextPage()
// }
},
created() {
// at first page load or first route entering launch a search if params exists in url query
console.log('Base created() location',window.location);
console.log('Base created() location',window.location)
let params = new URLSearchParams(window.location.search)
if(params.has('keys') || params.has('term')){
if (params.has('keys') || params.has('term')) {
this.$store.commit('Search/setKeys', params.get('keys'))
this.$store.commit('Search/setTerm', params.get('term'))
this.pagetitle = params.get('keys')
this.newSearch()
}else{
} else {
// load default base page
this.$store.commit('Search/setKeys', '')
this.$store.commit('Search/setTerm', '')
@ -80,7 +80,7 @@ export default {
},
beforeRouteUpdate (to, from, next) {
// when query change launch a new search
console.log('Base beforeRouteUpdate', to, from, next);
console.log('Base beforeRouteUpdate', to, from, next)
this.$store.commit('Search/setKeys', to.query.keys)
this.$store.commit('Search/setTerm', to.query.term)
this.pagetitle = to.query.keys

View File

@ -17,17 +17,17 @@ export default {
}
},
beforeMount() {
// console.log('Home beforeMount');
// console.log('Home beforeMount')
// compile the html src (coming from parent with props or from ajax call)
if(this.html){
// console.log('html', this.html);
if (this.html) {
// console.log('html', this.html)
this.compileTemplate()
}
},
render(h) {
if(!this.template){
if (!this.template) {
return h('span', 'Loading ...')
}else{
} else {
return this.template.render.call(this)
}
},
@ -43,19 +43,19 @@ export default {
setTimeout(this.initShowroomCarroussel.bind(this), 250)
},
initShowroomCarroussel(){
console.log("startShowroomCarroussel");
console.log('startShowroomCarroussel')
this.showrooms = document.querySelectorAll('.field--name-computed-showrooms-reference > .field__item')
console.log('showrooms', this.showrooms);
console.log('showrooms', this.showrooms)
for (var i = 0; i < this.showrooms.length; i++) {
for (let i = 0; i < this.showrooms.length; i++) {
if (i%2 === 0) {
this.showroomsOdd.push(this.showrooms[i])
}else{
} else {
this.showroomsEven.push(this.showrooms[i])
}
}
console.log('Odd', this.showroomsOdd);
console.log('Even', this.showroomsEven);
console.log('Odd', this.showroomsOdd)
console.log('Even', this.showroomsEven)
// TODO: share media query and variables between scss and js
let column_width= 205
@ -67,7 +67,7 @@ export default {
this.checkShowroomMode(mediaQuery)
// this.showroomInterval = setInterval(this.switchShowroomCarroussel.bind(this), 5000);
// console.log('this.showroomInterval', this.showroomInterval);
// console.log('this.showroomInterval', this.showroomInterval)
// this.switchShowroomCarroussel()
},
checkShowroomMode(mq){
@ -80,7 +80,7 @@ export default {
if(newmode !== this.showroomMode) {
// if new mode different from old mode
// reset sowrooms classes
for (var i = 0; i < this.showrooms.length; i++) {
for (let i = 0; i < this.showrooms.length; i++) {
this.showrooms[i].classList.remove('active')
}
// record new mode
@ -96,16 +96,16 @@ export default {
}
// in any case (re)launch the animation
this.showroomInterval = setInterval(this.switchShowroomCarroussel.bind(this), 15000);
console.log('this.showroomInterval', this.showroomInterval);
console.log('this.showroomInterval', this.showroomInterval)
this.switchShowroomCarroussel()
},
switchShowroomCarroussel(){
// console.log('switchShowroomCarroussel i', $elmts, i);
// console.log('switchShowroomCarroussel i', $elmts, i)
if (this.showroomMode === 1) {
this.showrooms[this.showroomI].classList.add('active')
this.showrooms[this.showroomI-1 < 0 ? this.showrooms.length -1 : this.showroomI-1].classList.remove('active')
this.showroomI = this.showroomI+1 >= this.showrooms.length ? 0 : this.showroomI+1
}else{
} else {
this.showroomsOdd[this.showroomI].classList.add('active')
this.showroomsOdd[this.showroomI-1 < 0 ? this.showroomsOdd.length -1 : this.showroomI-1].classList.remove('active')
this.showroomI = this.showroomI+1 >= this.showroomsOdd.length ? 0 : this.showroomI+1
@ -117,15 +117,15 @@ export default {
}
},
onClickLink(e){
console.log("onClickLink", e, this.$router, this.$route);
console.log("onClickLink", e, this.$router, this.$route)
let path = null;
// find existing router route compared with link href
for (var i = 0; i < this.$router.options.routes.length; i++) {
for (let i = 0; i < this.$router.options.routes.length; i++) {
if (this.$router.options.routes[i].path == e.originalTarget.pathname) {
if (e.originalTarget.pathname !== this.$route.path) {
path = e.originalTarget.pathname
}
break;
break
}
}
@ -136,7 +136,7 @@ export default {
}
},
onClickFieldLabel(e){
console.log("onClickFieldLabel", e, this.$router, this.$route);
console.log("onClickFieldLabel", e, this.$router, this.$route)
}
},
watch: {

View File

@ -75,21 +75,21 @@ export default {
// getPrevNextItems: 'Blabla/getPrevNextItems'
// }),
getThematique(){
console.log('getThematique', this.$route);
console.log('getThematique', this.$route)
if (this.$route.params.id) {
// we come from internal link with vuejs
// using path to load from route is hasardous
// this.path = this.$route.path
this.id = this.$route.params.id
}else if(drupalDecoupled.entity_type == 'node' && drupalDecoupled.entity_bundle == 'thematique'){
} else if (drupalDecoupled.entity_type == 'node' && drupalDecoupled.entity_bundle == 'thematique') {
// we landed in an internal page
// get the id from drupalDeclouped, provided by materio_decoupled.module
this.id = drupalDecoupled.entity_id
}
if(this.id){
if (this.id) {
this.loadThematique()
}else{
} else {
// if for any reason we dont have the id redirect to home
this.$router.replace({name:'home'})
}
@ -98,12 +98,12 @@ export default {
console.log('loadThematique')
this.loading = true
//
let ast = gql`{
const ast = gql`{
thematique(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
...ThematiqueFields
}
}
${ thematiqueFields }
${thematiqueFields}
`
// ?XDEBUG_SESSION_START=1
MGQ.post('', { query: print(ast)
@ -129,7 +129,7 @@ export default {
// update main page title
this.$store.commit('Common/setPagetitle', thematique.title)
}else{
} else {
console.warn('Thematique not loaded');
}
this.loading = false;

View File

@ -10,10 +10,10 @@ export default {
}
},
beforeMount() {
// console.log('Home beforeMount');
// console.log('Home beforeMount')
// compile the html src (coming from parent with props or from ajax call)
if(this.html){
console.log('html', this.html);
if (this.html) {
console.log('html', this.html)
this.template = Vue.compile(this.html)
this.$options.staticRenderFns = []
this._staticTrees = []
@ -21,9 +21,9 @@ export default {
}
},
render(h) {
if(!this.template){
if (!this.template) {
return h('span', 'Loading ...')
}else{
} else {
return this.template.render.call(this)
}
}