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

@@ -30,7 +30,7 @@ export default {
mail: this.mail,
pass: this.password
}).then(() => {
console.log("LoginBlock user logged-in")
console.log('LoginBlock user logged-in')
this.openCloseHamMenu(false)
this.$router.push({
name: 'base'
@@ -39,9 +39,9 @@ export default {
}
},
beforeMount() {
// console.log('LoginBlock beforeMount', this._props.block);
if(this._props.block){
// console.log('LoginBlock beforeMount if this._props.block ok');
// console.log('LoginBlock beforeMount', this._props.block)
if (this._props.block) {
// console.log('LoginBlock beforeMount if this._props.block ok')
this.template = Vue.compile(this._props.block)
this.$options.staticRenderFns = [];
this._staticTrees = [];
@@ -49,16 +49,16 @@ export default {
}
},
mounted(){
// console.log('LoginBlock mounted');
// console.log('LoginBlock mounted')
Drupal.attachBehaviors(this.$el);
},
render(h) {
// console.log('LoginBlock render');
if(!this.template){
// console.log('LoginBlock render NAN');
// console.log('LoginBlock render')
if (!this.template) {
// console.log('LoginBlock render NAN')
return h('span', 'Loading ...')
}else{
// console.log('LoginBlock render template');
} else {
// console.log('LoginBlock render template')
return this.template.render.call(this)
}
}

View File

@@ -23,21 +23,21 @@ export default {
canSearch: state => state.User.canSearch
}),
displayform(){
// console.log('computed displayform');
// console.log('computed displayform')
return this.canSearch && this.form
}
},
beforeMount() {
// console.log('SearchBlock beforeMount');
// console.log('SearchBlock beforeMount')
this.form = this.formhtml
},
watch: {
canSearch(new_value, old_value) {
// console.log('canSearch changed, old: '+old_value+", new: "+new_value);
if(new_value && !this.form){
// console.log('canSearch changed, old: '+old_value+", new: "+new_value)
if (new_value && !this.form) {
this.getSearchForm()
}
if(!new_value && this.form){
if (!new_value && this.form) {
this.form = null
}
}
@@ -46,10 +46,10 @@ export default {
getSearchForm(){
MA.get(`/materio_sapi/search_form`)
.then(({data}) => {
// console.log("getSearchForm");
// console.log('getSearchForm')
this.form = data.rendered
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with get searchform', error)
})
}

View File

@@ -24,10 +24,10 @@ export default {
})
},
beforeMount() {
console.log('UserBlock beforeMount');
if(this.loginblock){
console.log('UserBlock beforeMount')
if (this.loginblock) {
this.block = this.loginblock
}else{
} else {
this.getLoginBlock()
}
@@ -36,10 +36,10 @@ export default {
getLoginBlock(){
MA.get(`/materio_user/login_block`)
.then(({data}) => {
// console.log("getLoginBlock data", data);
// console.log("getLoginBlock data", data)
this.block = data.rendered
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with getLoginBlock', error)
})
}

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)
})

View File

@@ -25,13 +25,13 @@ export default {
// vuejs attributes a inserted by form alter in same module
MA.get(`/materio_user/login_form`)
.then(({data}) => {
console.log("getLoginForm data");
console.log('getLoginForm data')
this.form = Vue.compile(data.rendered)
this.$options.staticRenderFns = [];
this._staticTrees = [];
this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with getLoginForm', error)
})
},
@@ -40,31 +40,31 @@ export default {
mail: this.mail,
pass: this.password
}).then( () => {
console.log('logedin from login component');
console.log('logedin from login component')
this.$emit('onLogedIn')
}
).catch(( error ) => {
).catch((error) => {
console.warn('Issue with login from login component', error)
Promise.reject(error)
})
}
},
beforeMount () {
if(!this.form){
if (!this.form) {
this.getLoginForm()
}
},
mounted(){
// console.log('LoginBlock mounted');
// console.log('LoginBlock mounted')
Drupal.attachBehaviors(this.$el);
},
render(h) {
// console.log('LoginBlock render');
if(!this.form){
// console.log('LoginBlock render NAN');
// console.log('LoginBlock render')
if (!this.form) {
// console.log('LoginBlock render NAN')
return h('span', 'Loading ...')
}else{
// console.log('LoginBlock render template');
} else {
// console.log('LoginBlock render template')
return this.form.render.call(this)
}
}

View File

@@ -38,14 +38,14 @@ export default {
// vuejs attributes a inserted by form alter in same module
MA.get(`/materio_user/register_form`)
.then(({data}) => {
console.log("getRegisterForm data", data);
console.log("getRegisterForm data", data)
this.form = Vue.compile(data.rendered)
this.$options.staticRenderFns = [];
this._staticTrees = [];
this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
this.initFormBehaviours()
})
.catch(( error ) => {
.catch((error) => {
console.warn('Issue with getRegisterForm', error)
})
},
@@ -54,28 +54,28 @@ export default {
this.checkSubmitEnabled()
},
checkSubmitEnabled () {
console.log("checkSubmitEnabled", this);
if(this.ps === 'Strong'){
console.log("checkSubmitEnabled", this)
if (this.ps === 'Strong') {
this.$refs.register.disabled = false
}else{
} else {
this.$refs.register.disabled = true
}
},
register () {
console.log('register', this.mail, this.pass1, this.pass2);
console.log('register', this.mail, this.pass1, this.pass2)
// TODO: check for identical password
// TODO: check for valide email
// TODO: check for unique email
if(this.pass1 === this.pass2){
if (this.pass1 === this.pass2) {
this.userRegister({
name: this.mail,
mail: this.mail,
pass: this.pass1
}).then( () => {
console.log('registered from register component');
console.log('registered from register component')
this.$emit('onRegistered')
}
).catch(( error ) => {
).catch((error) => {
console.warn('Issue with register from registerform component', error)
Promise.reject(error)
})
@@ -84,29 +84,29 @@ export default {
}
},
beforeMount () {
if(!this.form){
if (!this.form) {
this.getRegisterForm()
}
},
mounted(){
// console.log('LoginBlock mounted');
if(this.form){
// console.log('LoginBlock mounted')
if (this.form) {
this.initForm()
}
},
render(h) {
// console.log('LoginBlock render');
if(!this.form){
// console.log('LoginBlock render NAN');
// console.log('LoginBlock render')
if (!this.form) {
// console.log('LoginBlock render NAN')
return h('span', 'Loading ...')
}else{
// console.log('LoginBlock render template');
} else {
// console.log('LoginBlock render template')
return this.form.render.call(this)
}
},
watch: {
pass1: function(n, o){
if(n){
if (n) {
this.ps = passwordStrength(n).value
console.log('watch pass1 n', n, 'ps :', this.ps)
this.checkSubmitEnabled()

View File

@@ -38,13 +38,13 @@ export default {
},
onAutoCompleteSelect(event, ui){
event.preventDefault();
console.log('autoCompleteSelect', event, ui);
console.log('autoCompleteSelect', event, ui)
this.typed = ui.item.label
// we have to wait for typed watch to reset autocomplete before setting it
setTimeout(function(){
console.log('update autocomplete value after settimeout');
console.log('update autocomplete value after settimeout')
this.autocomplete = ui.item.value
if(this.typed !== this.keys || this.autocomplete !== this.term){
if (this.typed !== this.keys || this.autocomplete !== this.term) {
this.submit()
}
}.bind(this), 1)
@@ -61,9 +61,9 @@ export default {
}
},
beforeMount() {
// console.log('SearchForm beforeMount');
if(this._props.form){
// console.log('SearchForm beforeMount if this._props.form ok');
// console.log('SearchForm beforeMount')
if (this._props.form) {
// console.log('SearchForm beforeMount if this._props.form ok')
this.template = Vue.compile(this._props.form)
// https://github.com/vuejs/vue/issues/9911
this.$options.staticRenderFns = [];
@@ -73,16 +73,16 @@ export default {
},
watch: {
typed(n, o){
console.log('typed changed', o, n);
console.log('typed changed', o, n)
// is changed also when autocomplete change it ...
this.autocomplete = null
},
keys(n, o){
console.log('keys changed', o, n);
console.log('keys changed', o, n)
this.typed = n
},
term(n, o){
console.log('autocomplete changed', o, n);
console.log('autocomplete changed', o, n)
this.autocomplete = n
}
},
@@ -91,7 +91,7 @@ export default {
this.autocomplete = this.term
},
mounted(){
// console.log('SearchForm mounted');
// console.log('SearchForm mounted')
Drupal.attachBehaviors(this.$el);
// get the search input
this.$input = this.$el.querySelector('#edit-search')
@@ -101,10 +101,10 @@ export default {
jQuery(this.$input).on('autocompleteselect', this.onAutoCompleteSelect);
},
render(h) {
// console.log('searchForm render');
if(!this.template){
// console.log('searchForm render')
if (!this.template) {
return h('span', 'Loading ...')
}else{
} else {
return this.template.render.call(this)
}
}

View File

@@ -30,7 +30,7 @@ export default {
}),
methods: {
close () {
console.log('click close');
console.log('click close')
this.$emit('close')
}
}

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)
}
}

View File

@@ -40,7 +40,7 @@ export default {
},
// watch: {
// flagcolls (newv, oldv) {
// console.log('watching flagcolls');
// console.log('watching flagcolls')
// if( typeof this.flagcolls[this.collection.id].loadedItems !== 'undefined' ) {
// this.loadedItems = this.flagcolls[this.collection.id].loadedItems
// }

View File

@@ -81,23 +81,23 @@ export default {
this.is_creating_folder = true;
this.createFlagColl(this.new_folder_name)
.then(data => {
console.log("onCreateFlagColl then", data);
console.log("onCreateFlagColl then", data)
this.new_folder_name = "";
this.is_creating_folder = false;
})
},
onDeleteFlagColl (e) {
const flagcollid = e.target.getAttribute('flagcollid');
console.log("UserFlags onDeleteFlagColl", flagcollid);
console.log("UserFlags onDeleteFlagColl", flagcollid)
this.is_deleting_folder = flagcollid;
// TODO: confirm suppression
this.confirmDeleteFlagColl(flagcollid)
},
confirmDeleteFlagColl (flagcollid){
// console.log('confirmDeleteFlagCOll', flagcollid, this.flagcolls);
// console.log('confirmDeleteFlagCOll', flagcollid, this.flagcolls)
// const index = this.flagcolls.findIndex(i => i.id === flagcollid)
let coll = this.flagcolls[flagcollid]
// console.log("coll to delete", coll);
// console.log("coll to delete", coll)
this.$modal.show('dialog',
{ // component props
title: this.$t("materio.Folder delete"),
@@ -114,10 +114,10 @@ export default {
{
title: this.$t('default.Delete'),
handler: () => {
// console.log('deletion confirmed', flagcollid);
// console.log('deletion confirmed', flagcollid)
this.deleteFlagColl(flagcollid)
.then(() => {
// console.log("onDeleteFlagColl then", data);
// console.log("onDeleteFlagColl then", data)
// this.is_deleting_folder = false;
this.$modal.hide('dialog')
})
@@ -136,11 +136,11 @@ export default {
},
onOpenFlagColl (flagcollid) {
// const flagcollid = e.target.getAttribute('flagcollid');
console.log("UserFlags onOpenFlagColl", flagcollid);
console.log("UserFlags onOpenFlagColl", flagcollid)
this.openCloseHamMenu(false)
this.openFlagColl(flagcollid)
.then(() => {
// console.log("onDeleteFlagColl then", data);
// console.log("onDeleteFlagColl then", data)
})
}
}

View File

@@ -47,7 +47,7 @@ export default {
userLogout: 'User/userLogout'
}),
onLogout () {
console.log("UserTools onLogout")
console.log('UserTools onLogout')
this.userLogout()
}
}

View File

@@ -2,10 +2,10 @@
export default {
directives: {
lazy: {
bind(img,binding){
// console.log('lazy bind', img, binding);
bind (img, binding) {
// console.log('lazy bind', img, binding)
// show only the first image
if(binding.value === 0){
if (binding.value === 0) {
img.setAttribute('src', img.getAttribute('data-src'))
img.removeAttribute('data-src')
img.classList.remove('lazy')
@@ -13,63 +13,63 @@ export default {
}
},
switcher: {
inserted(el,binding){
inserted (el, binding) {
// switch images on mousemove
el.addEventListener('mousemove', function(event) {
let figs = this.querySelectorAll('figure')
// console.log('mousemove', this, event, figs.length);
el.addEventListener('mousemove', function (event) {
const figs = this.querySelectorAll('figure')
// console.log('mousemove', this, event, figs.length)
// let len = figs.length
// let w = this.clientWidth;
// let g = w / len;
// let delta = Math.floor(event.layerX / g)
let delta = Math.floor(event.layerX / (this.clientWidth / figs.length))
// console.log('delta', delta);
const delta = Math.floor(event.layerX / (this.clientWidth / figs.length))
// console.log('delta', delta)
figs.forEach((fig, index) => {
// console.log(index);
if(index == delta){
// console.log(index)
if (index === delta) {
// fig.style.display = "block"
fig.classList.remove("hide")
fig.classList.add("show")
}else{
fig.classList.remove('hide')
fig.classList.add('show')
} else {
// fig.style.display = "none"
fig.classList.remove("show")
fig.classList.add("hide")
fig.classList.remove('show')
fig.classList.add('hide')
}
})
})
}
}
},
mounted() {
mounted () {
// lazy load images on mouseover
console.log('card mounted', this.$options.name);
console.log('card mounted', this.$options.name)
// if (this.$options.name ==! 'ModalCard') {
this.$el.addEventListener('mouseover', function(event) {
let imgs = this.querySelectorAll('.images figure img.lazy')
console.log('mousemove', this, imgs);
imgs.forEach((img) => {
// console.log('forEach img',img);
img.setAttribute('src', img.getAttribute('data-src'))
img.removeAttribute('data-src')
img.classList.remove('lazy')
})
}, {once : true})
this.$el.addEventListener('mouseover', function (event) {
const imgs = this.querySelectorAll('.images figure img.lazy')
console.log('mousemove', this, imgs)
imgs.forEach((img) => {
// console.log('forEach img',img)
img.setAttribute('src', img.getAttribute('data-src'))
img.removeAttribute('data-src')
img.classList.remove('lazy')
})
}, { once: true })
// }
},
methods: {
activateLazyLoad () {
console.log('card activateLazyLoad', this.$options.name);
console.log('card activateLazyLoad', this.$options.name)
this.$el.addEventListener('mousemove', function(event) {
let imgs = this.querySelectorAll('.images figure img.lazy')
console.log('mousemove', this, imgs);
this.$el.addEventListener('mousemove', function (event) {
const imgs = this.querySelectorAll('.images figure img.lazy')
console.log('mousemove', this, imgs)
imgs.forEach((img) => {
// console.log('forEach img',img);
// console.log('forEach img',img)
img.setAttribute('src', img.getAttribute('data-src'))
img.removeAttribute('data-src')
img.classList.remove('lazy')
})
}, {once : true})
}, { once: true })
}
// deg2rad (deg) {
// return deg * (Math.PI / 180)