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

@ -39,7 +39,7 @@ export default {
},
methods:{
onclick(){
console.log('clicked on article', this.alias);
console.log('clicked on article', this.alias)
this.$router.push({
name:`article`,
params: { alias:this.alias, id: this.item.nid }

View File

@ -140,14 +140,14 @@ export default {
this.is_creating_folder = true;
this.createFlagColl(this.new_folder_name)
.then(data => {
console.log("Card onCreateFlagColl then", data);
console.log("Card onCreateFlagColl then", data)
this.new_folder_name = "";
this.is_creating_folder = false;
let collid = data.id
this.loadingFlag = collid;
this.flagUnflag({ action: 'flag', id: this.item.id, collid: collid})
.then(data => {
console.log("onFlagActionCard then", data);
console.log("onFlagActionCard then", data)
this.loadingFlag = false;
})
})
@ -158,27 +158,27 @@ export default {
// this.flagcolls[collid].items,
// this.flagcolls[collid].items.indexOf(this.item.id)
// );
// console.log(this.flagcolls[collid].items_uuids);
// console.log(this.flagcolls[collid].items_uuids)
// return this.flagcolls[collid].items_uuids.indexOf(this.item.uuid) !== -1;
return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
},
flagIsLoading(collid) {
// console.log(this.item.uuid);
// console.log(this.flagcolls[collid].items_uuids);
// console.log(this.item.uuid)
// console.log(this.flagcolls[collid].items_uuids)
return collid === this.loadingFlag;
},
onFlagActionCard (e) {
console.log("Card onFlagActionCard", e, this.item);
console.log("Card onFlagActionCard", e, this.item)
if (!this.loadingFlag) {
let collid = e.target.getAttribute('collid');
let isActive = this.flagIsActive(collid);
let action = isActive ? 'unflag' : 'flag';
// console.log('collid', collid);
// console.log("this.item", this.item);
// console.log('collid', collid)
// console.log("this.item", this.item)
this.loadingFlag = collid;
this.flagUnflag({ action: action, id: this.item.id, collid: collid})
.then(data => {
console.log("onFlagActionCard then", data);
console.log("onFlagActionCard then", data)
this.loadingFlag = false;
})
}
@ -187,8 +187,8 @@ export default {
// this.lightbox_index = index
// },
openModalCard (e) {
console.log('openModalCard', this.isLoggedin);
if(this.isloggedin){
console.log('openModalCard', this.isLoggedin)
if (this.isloggedin) {
this.$modal.show(
ModalCard,
{

View File

@ -72,33 +72,33 @@ export default {
// // this.flagcolls[collid].items,
// // this.flagcolls[collid].items.indexOf(this.item.id)
// // );
// // console.log(this.flagcolls[collid].items_uuids);
// // console.log(this.flagcolls[collid].items_uuids)
// // return this.flagcolls[collid].items_uuids.indexOf(this.item.uuid) !== -1;
// return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
// },
// flagIsLoading(collid) {
// // console.log(this.item.uuid);
// // console.log(this.flagcolls[collid].items_uuids);
// // console.log(this.item.uuid)
// // console.log(this.flagcolls[collid].items_uuids)
// return collid === this.loadingFlag;
// },
// onFlagActionCard (e) {
// console.log("Card onFlagActionCard", e, this.item);
// console.log("Card onFlagActionCard", e, this.item)
// if (!this.loadingFlag) {
// let collid = e.target.getAttribute('collid');
// let isActive = this.flagIsActive(collid);
// let action = isActive ? 'unflag' : 'flag';
// // console.log('collid', collid);
// // console.log("this.item", this.item);
// // console.log('collid', collid)
// // console.log("this.item", this.item)
// this.loadingFlag = collid;
// this.flagUnflag({ action: action, id: this.item.id, collid: collid})
// .then(data => {
// console.log("onFlagActionCard then", data);
// console.log("onFlagActionCard then", data)
// this.loadingFlag = false;
// })
// }
// },
openThematique (e) {
console.log('openThematique', e, this.alias);
console.log('openThematique', e, this.alias)
this.$router.push({
name:`thematique`,
params: { alias:this.alias, id: this.item.id }

View File

@ -22,13 +22,13 @@ export default {
})
},
beforeMount() {
// console.log("beforeMount header_menu", this.html);
if(!this.template){
// console.log('no home_template');
if(this.dom_html){ // if html prop is available
// console.log("beforeMount header_menu", this.html)
if (!this.template) {
// console.log('no home_template')
if (this.dom_html) { // if html prop is available
this.html = this.dom_html
this.compileTemplate()
}else{ // else get it from ajax
} else { // else get it from ajax
this.getMenuBlockHtml()
}
}
@ -43,25 +43,25 @@ export default {
getMenuBlockHtml(){
MA.get('materio_decoupled/ajax/getheadermenu')
.then(({data}) => {
// console.log('HeaderMenu getMenuBlockHtml data', data);
// console.log('HeaderMenu getMenuBlockHtml data', data)
this.html = data.rendered // record the html src into data
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with getMenuBlockHtml', error)
})
},
onclick (event) {
// console.log("Clicked on header menu link", event);
// console.log("Clicked on header menu link", event)
const href = event.target.getAttribute('href')
// this.openCloseHamMenu(false)
this.$router.push(href)
}
},
render(h) {
// console.log('headerMenu render');
if(!this.template){
// console.log('headerMenu render')
if (!this.template) {
return h('span', 'Loading ...')
}else{
} else {
return this.template.render.call(this)
}
},

View File

@ -59,8 +59,8 @@ export default {
return this.loadingItem
},
openModalCard (e) {
console.log('openModalCard', this.isLoggedin);
if(this.isloggedin){
console.log('openModalCard', this.isLoggedin)
if (this.isloggedin) {
this.$modal.show(
ModalCard,
{ item: this.item },

View File

@ -21,12 +21,12 @@ export default {
}
},
beforeMount() {
// console.log('MainContent beforeMount this.html', this.html);
if(!this.home_template_src){
// console.log('no home_template_src');
if(this.html && this.isfront){ // if html prop is available and we are landing on home then record it has data
// console.log('MainContent beforeMount this.html', this.html)
if (!this.home_template_src) {
// console.log('no home_template_src')
if (this.html && this.isfront) { // if html prop is available and we are landing on home then record it has data
this.home_template_src = this.html
}else{ // else get it from ajax (e.g. if we didn't load the page from home)
} else { // else get it from ajax (e.g. if we didn't load the page from home)
this.getHomeHtml()
}
}
@ -35,10 +35,10 @@ export default {
getHomeHtml(){
MA.get('materio_home/ajax/gethome')
.then(({data}) => {
// console.log('Home getHomeHtml data', data);
// console.log('Home getHomeHtml data', data)
this.home_template_src = data.rendered // record the html src into data
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with getHomeHtml', error)
})
}

View File

@ -83,7 +83,7 @@ export default {
return this.loadingItem
},
onUnFlagCard (e) {
console.log("Card onFlagActionCard", e, this.item);
console.log("Card onFlagActionCard", e, this.item)
if (!this.loadingItem) {
this.loadingItem = true;
this.flagUnflag({
@ -92,14 +92,14 @@ export default {
collid: this.collid
})
.then(data => {
console.log("onUnFlagCard then", data);
console.log("onUnFlagCard then", data)
this.loadingItem = false;
})
}
},
openModalCard (e) {
console.log('openModalCard', this.isLoggedin);
if(this.isloggedin){
console.log('openModalCard', this.isLoggedin)
if (this.isloggedin) {
this.$modal.show(
ModalCard,
{ item: this.item },

View File

@ -361,20 +361,20 @@ export default {
loadMaterial(){
console.log('loadMaterial', this.item.id)
this.loading = true
let ast = gql`{
const ast = gql`{
materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") {
...MateriauFields
}
}
${ materiauFields }
${materiauFields}
`
MGQ.post('', { query: print(ast)
})
.then(({ data:{data:{materiau}}}) => {
console.log('loadMaterial material loaded', materiau )
console.log('loadMaterial material loaded', materiau)
this.material = materiau
this.loading = false
if(materiau.note && materiau.note.id){
if (materiau.note && materiau.note.id) {
this.note_id = materiau.note.id
this.note = materiau.note.contenu
}
@ -394,41 +394,41 @@ export default {
this.is_creating_folder = true;
this.createFlagColl(this.new_folder_name)
.then(data => {
console.log("Card onCreateFlagColl then", data);
console.log("Card onCreateFlagColl then", data)
this.new_folder_name = "";
this.is_creating_folder = false;
let collid = data.id
this.loadingFlag = collid;
this.flagUnflag({ action: 'flag', id: this.item.id, collid: collid})
.then(data => {
console.log("onFlagActionCard then", data);
console.log("onFlagActionCard then", data)
this.loadingFlag = false;
})
})
},
flagIsActive(collid) {
// console.log(this.item.uuid);
// console.log(this.flagcolls[collid].items_uuids);
// console.log(this.item.uuid)
// console.log(this.flagcolls[collid].items_uuids)
// return this.flagcolls[collid].items_uuids.indexOf(this.item.uuid) !== -1;
return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
},
flagIsLoading(collid) {
// console.log(this.item.uuid);
// console.log(this.flagcolls[collid].items_uuids);
// console.log(this.item.uuid)
// console.log(this.flagcolls[collid].items_uuids)
return collid === this.loadingFlag;
},
onFlagActionCard (e) {
console.log("Card onFlagActionCard", e);
console.log("Card onFlagActionCard", e)
if (!this.loadingFlag) {
let collid = e.target.getAttribute('collid');
let isActive = this.flagIsActive(collid);
let action = isActive ? 'unflag' : 'flag';
// console.log('collid', collid);
// console.log("this.item", this.item);
// console.log('collid', collid)
// console.log("this.item", this.item)
this.loadingFlag = collid;
this.flagUnflag({ action: action, id: this.item.id, collid: collid})
.then(data => {
console.log("onFlagActionCard then", data);
console.log("onFlagActionCard then", data)
this.loadingFlag = false;
})
}
@ -448,10 +448,10 @@ export default {
return url.replace(/^http:\/\//, '').replace(/^www\./, '')
},
saveNote(){
console.log("saveNote", this.note);
if(this.note_nid){
console.log("saveNote", this.note)
if (this.note_nid) {
this.updateNote()
}else{
} else {
this.createNote()
}
},
@ -511,7 +511,7 @@ export default {
onTapCard (e) {
console.log('ontapCard', e)
let tools = this.$refs['tools'].querySelectorAll('section.tool')
// console.log();
// console.log()
tools.forEach((item, i) => {
console.log('item', item)
item.classList.remove('tapped')

View File

@ -78,25 +78,25 @@ export default {
this.showLoginModal = false;
},
checkaddtocart(e, variation_id) {
console.log('checkaddtocart');
console.log('checkaddtocart')
if(!this.isloggedin){
if (!this.isloggedin) {
// show popup for login or register
// login or register event will be catched by onLogedin or onRegistered
this.showLoginModal = variation_id
}else{
} else {
// if already logedin directly goes to cart operations
this.addtocart(variation_id)
}
},
// event bubbled from modal login form
onLogedIn (variation_id) {
console.log('Product: onLogedIn. variation_id', variation_id);
console.log('Product: onLogedIn. variation_id', variation_id)
this.addtocart(variation_id)
},
// event bubbled from modal register form
onRegistered (variation_id) {
console.log('Product: onRegistered. variation_id', variation_id);
console.log('Product: onRegistered. variation_id', variation_id)
this.addtocart(variation_id)
},
getCarts () {
@ -105,18 +105,18 @@ export default {
// .then(({ data }) => {
// console.log('current user carts: data', data)
// })
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with get cart', error)
Promise.reject(error)
})
},
deleteCart (order_id) {
console.log('deleting cart ', order_id);
console.log('deleting cart ', order_id)
return REST.delete(`/cart/${order_id}/items?_format=json`)
.then(({ data }) => {
console.log(`product cart ${order_id} deleted: data`, data)
})
.catch(( error ) => {
.catch((error) => {
console.warn(`Issue with cart ${order_id} deleting`, error)
Promise.reject(error)
})
@ -124,20 +124,20 @@ export default {
clearCarts (data) {
let promises = [];
// clear each cart as a promise
for (var i = 0; i < data.length; i++) {
for (let i = 0; i < data.length; i++) {
promises.push(this.deleteCart(data[i].order_id))
}
// return all the promises as one
return Promise.all(promises)
},
addtocart (variation_id) {
console.log("addtocart")
console.log('addtocart')
this.getCarts()
.then(({data}) => {
console.log('current user carts: data', data)
this.clearCarts(data)
.then(() => {
console.log('all carts cleared');
console.log('all carts cleared')
// fill the cart with new product
REST.post(`/cart/add?_format=json`, [{
"purchased_entity_type": "commerce_product_variation",
@ -152,7 +152,7 @@ export default {
// TODO: redirect to checkout instead of cart
window.location.href = `/checkout/${data[0].order_id}/order_information`
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with product add to cart', error)
Promise.reject(error)
})