fixed all eslint errors and warning, compiled as PROD
This commit is contained in:
@@ -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`,
|
||||
|
Reference in New Issue
Block a user