fixed all eslint errors and warning, compiled as PROD

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

View File

@ -16,7 +16,7 @@ module.exports = {
],
rules: {
'no-unused-vars': ["warn"],
'camelcase': 'warn',
'camelcase': 'off',
'eqeqeq': 'warn',
'no-redeclare': 'warn'
},

View File

@ -5,7 +5,7 @@ start_url: /
lang: en
theme_color: '#ffffff'
background_color: '#ffffff'
display: fullscreen
display: standalone
default_image: '0'
urls_to_cache: "/en/pricing\r\n/en/blabla\r\n/en/base\r\n/en/showrooms"
urls_to_exclude: "admin/.*\r\nuser/.*"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
/*!
* Vue.js v2.6.12
* (c) 2014-2020 Evan You
* Released under the MIT License.
*/
/*!
* vue-i18n v8.22.2
* (c) 2020 kazuya kawaguchi
* Released under the MIT License.
*/
/*!
* vue-infinite-loading v2.4.5
* (c) 2016-2020 PeachScript
* MIT License
*/
/*!
* vuex v3.6.0
* (c) 2020 Evan You
* @license MIT
*/

View File

@ -1,73 +1,2 @@
body {
font-size: 16px;
font-family: "Ubuntu",Arial,"MS Trebuchet",sans-serif;
font-weight: 500;
font-style: normal;
line-height: 1.3; }
body {
margin: 0;
padding: 0; }
#printable-root-page {
box-sizing: border-box;
width: 21cm;
padding: 1cm .5cm 2cm; }
#printable-root-page > header {
display: flex;
flex-flow: nowrap;
align-items: baseline; }
#printable-root-page > header h1 {
margin: 0;
font-weight: 600; }
#printable-root-page > article {
padding-top: 1em; }
#printable-root-page > article > h2 {
font-weight: 600;
margin: 0; }
#printable-root-page > article .field--name-field-reference {
margin: 0 0 1em 0; }
#printable-root-page > article .field--name-body,
#printable-root-page > article .field--name-field-samples {
display: inline-block;
vertical-align: top; }
#printable-root-page > article .field--name-body {
width: 75%; }
#printable-root-page > article .field--name-body p {
margin: 0; }
#printable-root-page > article .field__label {
font-size: 0.756em;
font-weight: 700; }
#printable-root-page > article .field--name-field-samples {
width: 23%;
text-align: right; }
#printable-root-page > article .field--name-field-samples .field__item {
font-size: 0.756em; }
#printable-root-page > article .field--name-field-manufacturer,
#printable-root-page > article .field--name-field-distributor {
margin-top: 1em;
display: inline-block;
vertical-align: top;
width: 49%; }
#printable-root-page > article .field--name-field-manufacturer .taxonomy-term,
#printable-root-page > article .field--name-field-distributor .taxonomy-term {
padding-bottom: 0.5em; }
#printable-root-page > article .field--name-field-manufacturer .taxonomy-term > h2,
#printable-root-page > article .field--name-field-distributor .taxonomy-term > h2 {
margin: 0;
font-weight: 600;
font-size: 1em; }
#printable-root-page > article .field--name-field-manufacturer .taxonomy-term p,
#printable-root-page > article .field--name-field-distributor .taxonomy-term p {
margin: 0; }
#printable-root-page > article .field--name-field-materiau-images {
margin-top: 1em;
display: flex;
flex-flow: row wrap;
justify-content: space-between; }
#printable-root-page > article .field--name-field-materiau-images .field__item {
flex: 0 0 33%; }
#printable-root-page > article .field--name-field-materiau-images .field__item img {
width: 100%;
height: auto; }
body{font-size:16px;font-family:"Ubuntu",Arial,"MS Trebuchet",sans-serif;font-weight:500;font-style:normal;line-height:1.3}body{margin:0;padding:0}#printable-root-page{box-sizing:border-box;width:21cm;padding:1cm .5cm 2cm}#printable-root-page>header{display:flex;flex-flow:nowrap;align-items:baseline}#printable-root-page>header h1{margin:0;font-weight:600}#printable-root-page>article{padding-top:1em}#printable-root-page>article>h2{font-weight:600;margin:0}#printable-root-page>article .field--name-field-reference{margin:0 0 1em 0}#printable-root-page>article .field--name-body,#printable-root-page>article .field--name-field-samples{display:inline-block;vertical-align:top}#printable-root-page>article .field--name-body{width:75%}#printable-root-page>article .field--name-body p{margin:0}#printable-root-page>article .field__label{font-size:0.756em;font-weight:700}#printable-root-page>article .field--name-field-samples{width:23%;text-align:right}#printable-root-page>article .field--name-field-samples .field__item{font-size:0.756em}#printable-root-page>article .field--name-field-manufacturer,#printable-root-page>article .field--name-field-distributor{margin-top:1em;display:inline-block;vertical-align:top;width:49%}#printable-root-page>article .field--name-field-manufacturer .taxonomy-term,#printable-root-page>article .field--name-field-distributor .taxonomy-term{padding-bottom:0.5em}#printable-root-page>article .field--name-field-manufacturer .taxonomy-term>h2,#printable-root-page>article .field--name-field-distributor .taxonomy-term>h2{margin:0;font-weight:600;font-size:1em}#printable-root-page>article .field--name-field-manufacturer .taxonomy-term p,#printable-root-page>article .field--name-field-distributor .taxonomy-term p{margin:0}#printable-root-page>article .field--name-field-materiau-images{margin-top:1em;display:flex;flex-flow:row wrap;justify-content:space-between}#printable-root-page>article .field--name-field-materiau-images .field__item{flex:0 0 33%}#printable-root-page>article .field--name-field-materiau-images .field__item img{width:100%;height:auto}

View File

@ -1,69 +0,0 @@
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is not neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./web/themes/custom/materiotheme/assets/styles/print.scss":
/*!*****************************************************************!*\
!*** ./web/themes/custom/materiotheme/assets/styles/print.scss ***!
\*****************************************************************/
/*! namespace exports */
/*! exports [not provided] [no usage info] */
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://materio.com/./web/themes/custom/materiotheme/assets/styles/print.scss?");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/ // startup
/******/ // Load entry module
/******/ __webpack_require__("./web/themes/custom/materiotheme/assets/styles/print.scss");
/******/ // This entry module used 'exports' so it can't be inlined
/******/ })()
;

View File

@ -80,9 +80,9 @@ import { MA } from 'vuejs/api/ma-axios'
function checkNoVuePages () {
// return drupalDecoupled.sys_path != '/cart'
// && drupalDecoupled.sys_path.indexOf('checkout') != 1;
if (drupalDecoupled.route_name.indexOf('commerce') == -1 &&
drupalDecoupled.route_name.indexOf('flagging_collection') == -1 &&
drupalDecoupled.route_name.indexOf('user') == -1) {
if (drupalDecoupled.route_name.indexOf('commerce') === -1 &&
drupalDecoupled.route_name.indexOf('flagging_collection') === -1 &&
drupalDecoupled.route_name.indexOf('user') === -1) {
return false
} else {
return true
@ -122,7 +122,7 @@ import { MA } from 'vuejs/api/ma-axios'
function initVRouter () {
// we need this to update the title and body classes while using history nav
router.beforeEach((to, from, next) => {
// console.log('router beforeEach to ', to);
console.log('router beforeEach to ', to)
// commit new title to store
let title = null
switch (to.name) {
@ -142,7 +142,7 @@ import { MA } from 'vuejs/api/ma-axios'
// remove all path related body classes
const body_classes = document.querySelector('body').classList
const classes_to_rm = []
for (var i = 0; i < body_classes.length; i++) {
for (let i = 0; i < body_classes.length; i++) {
if (body_classes[i].startsWith('path-')) {
classes_to_rm.push(body_classes[i])
}
@ -150,26 +150,26 @@ import { MA } from 'vuejs/api/ma-axios'
document.querySelector('body').classList.remove(...classes_to_rm)
// add new path classes to body
const classes = []
if (to.name == 'home') {
if (to.name === 'home') {
classes.push('path-home')
} else {
const path_parts = to.path
.replace(/^\//, '')
// remove language relative prefix from path classes (fr, en, etc)
.replace(/^\D{2,3}\//, '')
.split('/')
for (var i = 0; i < path_parts.length; i++) {
if (i == 0) {
var c = 'path-' + path_parts[i]
} else if (path_parts[i] !== '') {
var c = classes[i - 1] + '-' + path_parts[i]
.replace(/^\D{2,3}\//, '') // remove language relative prefix from path classes (fr, en, etc)
.split('/')
let c
for (let j = 0; j < path_parts.length; j++) {
if (j === 0) {
c = 'path-' + path_parts[j]
} else if (path_parts[j] !== '') {
c = classes[j - 1] + '-' + path_parts[j]
}
classes.push(c)
}
}
document.querySelector('body').classList.add(...classes)
updateLanguageLinksBlock(to.path);
updateLanguageLinksBlock(to.path)
// close the hamburger menu
store.dispatch('Common/openCloseHamMenu', false)
@ -179,32 +179,32 @@ import { MA } from 'vuejs/api/ma-axios'
})
}
function updateLanguageLinksBlock(path){
function updateLanguageLinksBlock (path) {
// update block language selection
console.log("updateLanguageLinksBlock, path:", path);
let links = document.querySelectorAll('#block-languageswitcher a.language-link')
console.log('router beforeEach path ', path)
const links = document.querySelectorAll('#block-languageswitcher a.language-link')
let params = {
const params = {
path: path
// XDEBUG_SESSION_START: true
}
MA.post(`materio_decoupled/path_translation_links?`, params)
MA.post('materio_decoupled/path_translation_links?', params)
.then(({ data }) => {
console.log('Path translations links', data)
if (data.error) {
console.warn("error getting translation paths", data.error);
console.warn('error getting translation paths', data.error)
}
links.forEach((link, i) => {
console.log("language link",path , link)
let hreflang = link.getAttribute('hreflang')
console.log('language link', path, link)
const hreflang = link.getAttribute('hreflang')
link.setAttribute('href', data.links[hreflang].url)
link.setAttribute('data-drupal-link-system-path', data.links[hreflang].sys_path)
link.innerHTML = data.links[hreflang].title
});
})
})
.catch(error => {
console.warn('Path translations links', error)
@ -219,9 +219,9 @@ import { MA } from 'vuejs/api/ma-axios'
el: '#block-sitebranding',
methods: {
onclick (event) {
// console.log("Clicked on logo event", event);
// console.log('router beforeEach to ', to)
const href = event.target.getAttribute('href')
// console.log("Clicked on logo href", href);
// console.log('router beforeEach to ', to)
this.$router.push(href)
// replaced by router.beforeEach
// this.$store.commit('Common/setPagetitle', null)
@ -290,14 +290,14 @@ import { MA } from 'vuejs/api/ma-axios'
},
render: h => h(VUserBlock, { props: props })
}).$mount('#' + mount_point)
// console.log('initVUserBlock', _v_user_block);
// console.log('router beforeEach to ', to)
}
function initVHeaderMenu () {
// console.log('initVHeaderMenu');
// console.log('router beforeEach to ', to)
const id = 'block-header'
const $html_obj = document.querySelector('#' + id)
// console.log('main-content', $main_content);
// console.log('router beforeEach to ', to)
const html = $html_obj.outerHTML
_v_header_menu = new Vue({
store,
@ -307,10 +307,10 @@ import { MA } from 'vuejs/api/ma-axios'
}).$mount('#' + id)
}
function initHamburgerMenu(){
function initHamburgerMenu () {
const input = document.querySelector('input#header-block-right-toggle')
input.addEventListener('change', (e) => {
console.log("block header right toggle", e, this);
console.log('initHamburgerMenu input change ', e)
store.dispatch('Common/openCloseHamMenu', e.currentTarget.checked)
})
}
@ -318,7 +318,7 @@ import { MA } from 'vuejs/api/ma-axios'
function initVMainContent () {
const id = 'main-content'
const $main_content = document.querySelector('#' + id)
// console.log('main-content', $main_content);
// console.log('router beforeEach to ', to)
const main_html = $main_content.innerHTML
_v_main_content = new Vue({
store,
@ -334,7 +334,7 @@ import { MA } from 'vuejs/api/ma-axios'
}
function initVSearchBlock () {
// console.log('initVSearchBlock');
// console.log('router beforeEach to ', to)
const id = 'block-materiosapisearchblock'
let $search_block = document.getElementById(id)
let formhtml = null
@ -360,7 +360,7 @@ import { MA } from 'vuejs/api/ma-axios'
}
function initVLeftContent () {
const id = 'content-left'
const $leftContent = document.getElementById(id)
// const $leftContent = document.getElementById(id)
// in any case create the vue
_v_left_content = new Vue({
store,
@ -371,5 +371,6 @@ import { MA } from 'vuejs/api/ma-axios'
init()
} // end MaterioTheme()
const materiotheme = new MaterioTheme()
// const materiotheme = new MaterioTheme()
MaterioTheme()
})(Drupal, drupalSettings, drupalDecoupled)

View File

@ -18,7 +18,7 @@ console.dir(argv);
var prod = argv.env == 'prod' ? true : false;
function handleError(err) {
console.log(err.toString());
console.log(err.toString())
}
gulp.task('scripts', gulp.series(function (done) {

View File

@ -131,7 +131,7 @@ function materiotheme_form_user_login_form_alter(&$form, FormStateInterface $for
* - url: An optional \Drupal\Core\Url object.
*/
// function materiotheme_preprocess_image_formatter(&$vars){
// if(isset($vars['url'])){
// if (isset($vars['url'])) {
// $system_path = $vars['url']->getInternalPath();
// $vars['link_attributes'] = new Attribute(array(
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,

View File

@ -2,16 +2,16 @@ import axios from 'axios'
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
// console.log('drupalSettings', drupalSettings);
console.log(window.location);
// console.log('drupalSettings', drupalSettings)
console.log(window.location)
export const MGQ = axios.create({
baseURL: window.location.origin+`/mgq`,
baseURL: window.location.origin + '/mgq',
withCredentials: true,
headers: {
'Accept': 'application/json',
Accept: 'application/json',
// Accept: 'application/vnd.api+json'
// Authorization: 'Basic {token}',
"Content-Type": "application/json"
'Content-Type': 'application/json'
}
})

View File

@ -2,8 +2,8 @@ import axios from 'axios'
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
// console.log('drupalSettings', drupalSettings);
console.log(window.location);
// console.log('drupalSettings', drupalSettings)
console.log(window.location)
export const JSONAPI = axios.create({
baseURL: window.location.origin+`/jsonapi`,
@ -11,6 +11,6 @@ export const JSONAPI = axios.create({
headers: {
Accept: 'application/vnd.api+json'
// Authorization: 'Basic {token}',
// "Content-Type": "application/json"
// 'Content-Type': 'application/json'
}
})

View File

@ -2,13 +2,13 @@ import axios from 'axios'
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
// console.log('drupalSettings', drupalSettings);
// console.log('drupalSettings', drupalSettings)
export const MA = axios.create({
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
withCredentials: true,
headers: {
"Content-Type": "application/json"
'Content-Type': 'application/json'
// "X-CSRF-Token": "csrf_token"
}
})

View File

@ -2,13 +2,13 @@ import axios from 'axios'
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
// console.log('drupalSettings', drupalSettings);
// console.log('drupalSettings', drupalSettings)
export const REST = axios.create({
baseURL: window.location.origin,
withCredentials: true,
headers: {
// Authorization: 'Bearer {token}',
"Content-Type": "application/json"
'Content-Type': 'application/json'
}
})

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)

View File

@ -17,7 +17,7 @@ Vue.use(VueRouter)
// We could use aliases to never reload the page on language changement
// BUT beforeupdate is not triggered when push alias instead of path or name
// const languages = ['en', 'fr'];
// console.log('path aliases', (() => languages.map(l => `/${l}/base`))() );
// console.log('path aliases', (() => languages.map(l => `/${l}/base`))())
const basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix

View File

@ -18,7 +18,6 @@ import Blabla from './modules/blabla'
import Showrooms from './modules/showrooms'
import Pages from './modules/pages'
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
Vue.use(Vuex)
@ -38,16 +37,16 @@ export default createStore(Vuex.Store, {
loadMaterialsGQL ({ dispatch }, { ids, gqlfragment, callBack, callBackArgs }) {
console.log('loadMaterialsGQL ids', ids)
let ast = gql`{
const ast = gql`{
materiaux(ids: [${ids}]) {
...MateriauFields
}
}
${ gqlfragment }
${gqlfragment}
`
MGQ.post('', { query: print(ast) })
.then(( resp ) => {
console.log('loadMaterialsGQL resp', resp )
.then((resp) => {
console.log('loadMaterialsGQL resp', resp)
// dispatch('parseMaterialsGQL', {
// items: resp.data.data.materiaux,
// callBack: callBack,
@ -79,7 +78,7 @@ export default createStore(Vuex.Store, {
// params[`filter[${uuid}][condition][operator]`] = '='
// params[`filter[${uuid}][condition][memberOf]`] = 'uuids-groupe'
// }
// // console.log('search JSONAPI params', params);
// // console.log('search JSONAPI params', params)
// const q = qs.stringify(params)
// return JSONAPI.get('node/materiau?' + q)
// .then(({ data }) => {
@ -98,12 +97,12 @@ export default createStore(Vuex.Store, {
// // so we loop from uuids to conserve the original order
// console.log('mixin parseMaterials', data, uuids, callBack, callBackArgs)
// const items = []
// // for (var i = 0; i < data.length; i++) {
// // for (let i = 0; i < data.length; i++) {
// for (let i = 0; i < uuids.length; i++) {
// const uuid = uuids[i]
// // https://stackoverflow.com/questions/11258077/how-to-find-index-of-an-object-by-key-and-value-in-an-javascript-array
// const item_index = data.findIndex(p => p.id === uuid)
// // console.log('item_index', item_index);
// // console.log('item_index', item_index)
// if (item_index === -1) continue
//
// const item_src = data[item_index]
@ -121,14 +120,14 @@ export default createStore(Vuex.Store, {
//
// // get images included values
// const img_src = relations.images.data
// // console.log('img_src', img_src);
// // console.log('img_src', img_src)
// // this is a temporary deactivation of images
// // img_src = [];
// item.images = []
// for (let j = 0; j < img_src.length; j++) {
// if (img_src[j].meta.imageDerivatives) {
// let img_styles = {}
// for (var k = 0; k < imgStyle.length; k++) {
// for (let k = 0; k < imgStyle.length; k++) {
// img_styles[imgStyle[k]] = img_src[j].meta.imageDerivatives.links.[imgStyle[k]].href
// }
// item.images.push({

View File

@ -40,7 +40,7 @@ export default {
console.log('blabla REST: data', data)
if (data.length) {
commit('setItems', data)
// console.log('items.length', this.items.length);
// console.log('items.length', this.items.length)
if (state.infiniteLoadingState) { state.infiniteLoadingState.loaded() }
} else {
if (state.infiniteLoadingState) { state.infiniteLoadingState.complete() }
@ -60,8 +60,8 @@ export default {
getItemIndex ({ dispatch, commit, state }, nid) {
console.log('getItemIndex nid', nid)
return state.items.findIndex((e) => {
console.log('findIndex', e.nid, nid);
return e.nid == nid
console.log('findIndex', e.nid, nid)
return e.nid === nid
})
},
getPrevNextItems ({ dispatch, commit, state }, index) {

View File

@ -20,7 +20,7 @@ export default {
console.log('Common, setPagetitle', title)
state.pagetitle = title
},
setHamMenuState (state, s){
setHamMenuState (state, s) {
state.hamburgerMenuToggle.checked = s
}
},

View File

@ -29,15 +29,15 @@ export default {
// actions
actions: {
getProducts({ dispatch, commit, state }) {
getProducts ({ dispatch, commit, state }) {
dispatch('loadProductsIds')
},
loadProductsIds({ dispatch, commit, state }) {
loadProductsIds ({ dispatch, commit, state }) {
REST.get('/pricing_rest?_format=json', {})
.then(({ data }) => {
console.log('getProducts REST: data', data)
let ids = [];
for (var i = 0; i < data.length; i++) {
const ids = []
for (let i = 0; i < data.length; i++) {
ids.push(data[i].product_id)
}
commit('setProductsIds', ids)
@ -48,17 +48,17 @@ export default {
Promise.reject(error)
})
},
loadProducts({ dispatch, commit, state }) {
let ast = gql`{
loadProducts ({ dispatch, commit, state }) {
const ast = gql`{
products(ids: [${state.products_ids}]) {
...ProductsFields
}
}
${ productsGQL }
${productsGQL}
`
MGQ.post('', { query: print(ast) })
.then(( resp ) => {
console.log('loadProductsGQL resp', resp )
.then((resp) => {
console.log('loadProductsGQL resp', resp)
commit('setProducts', resp.data.data.products)
})
.catch(error => {

View File

@ -41,11 +41,11 @@ export default {
state.uuids = []
},
setResults (state, items) {
// console.log('setResults, items', items);
if(items){ // avoid bug like items = [null]
// console.log('setResults, items', items)
if (items) { // avoid bug like items = [null]
state.items = state.items.concat(items)
}
// console.log('setResults, state.items', state.items);
// console.log('setResults, state.items', state.items)
},
updateItem (state, item) {
// state.items[data.index] = data.item // this is not triggering vuejs refresh
@ -101,9 +101,9 @@ export default {
commit('resetCount')
commit('resetNoresults')
commit('resetOffset')
if(state.keys || state.term){
if (state.keys || state.term) {
this.commit('Common/setPagetitle', state.keys)
}else{
} else {
this.commit('Common/setPagetitle', 'Base')
}
dispatch('getResults')
@ -121,7 +121,7 @@ export default {
offset: state.offset,
limit: state.limit
}
// console.log('Search getResults params', params);
// console.log('Search getResults params', params)
const q = qs.stringify(params)
return MA.get('/materio_sapi/getresults?' + q)
.then(({ data }) => {
@ -138,17 +138,17 @@ export default {
// gqlfragment: materiauGQL,
// callBack: 'loadSearchResultsCallBack'
// })
let ast = gql`{
const ast = gql`{
searchresults(ids: [${data.nids}], lang: "${drupalDecoupled.lang_code}") {
...SearchResultFields
}
}
${ searchresultGQL }
${searchresultGQL}
`
MGQ.post('', { query: print(ast) })
.then(resp => {
console.log('loadSearchResultsGQL resp', resp )
dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
console.log('loadSearchResultsGQL resp', resp)
dispatch('loadSearchResultsCallBack', { items: resp.data.data.searchresults })
})
.catch(error => {
console.warn('Issue with loadSearchResults', error)
@ -178,20 +178,20 @@ export default {
}
}
},
refreshItem({ commit, state }, { id }) {
console.log("Search refreshItem: id", id);
let ast = gql`{
refreshItem ({ commit, state }, { id }) {
console.log('Search refreshItem: id', id)
const ast = gql`{
searchresult(id: ${id}, lang: "${drupalDecoupled.lang_code}") {
...SearchResultFields
}
}
${ searchresultGQL }
${searchresultGQL}
`
MGQ.post('', { query: print(ast) })
.then(resp => {
console.log('refreshItem searchresult resp', resp )
console.log('refreshItem searchresult resp', resp)
// dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
commit("updateItem", resp.data.data.searchresult)
commit('updateItem', resp.data.data.searchresult)
})
.catch(error => {
console.warn('Issue with refreshItem', error)

View File

@ -49,11 +49,11 @@ export default {
state.logout_token = data.logout_token
},
setLoginMessage (state, message) {
console.log('setLoginMessage', message);
console.log('setLoginMessage', message)
state.loginMessage = message
},
setRegisterMessage (state, message) {
console.log('setRegisterMessage', message);
console.log('setRegisterMessage', message)
state.registerMessage = message
},
setUid (state, uid) {
@ -75,12 +75,12 @@ export default {
state.roles.indexOf('admin') !== -1 ||
state.roles.indexOf('root') !== -1
) {
// console.log('is admin');
// console.log('is admin')
state.isAdmin = true
}
// check if has access to search
if (state.roles.indexOf('adherent') !== -1) {
// console.log('is admin');
// console.log('is admin')
state.canSearch = true
state.isAdherent = true
}
@ -140,21 +140,21 @@ export default {
REST.post('/user/register?_format=json', credentials, {
'X-CSRF-Token': state.csrftoken,
validateStatus: function (status) {
return status >= 200 && status < 500;
return status >= 200 && status < 500
}
})
.then((response) => {
console.log('user REST registered', response)
if(response.status === 200){
if (response.status === 200) {
dispatch('userLogin', credentials).then(() => {
resolve()
})
}else{
} else {
let message = ''
switch (response.status) {
case 422:
message = "email is already registered"
break;
message = 'email is already registered'
break
default:
message = response.data.message
}
@ -168,15 +168,15 @@ export default {
})
})
},
userLogin ({ dispatch, state }, credentials) {
userLogin ({ dispatch, commit, state }, credentials) {
return new Promise((resolve, reject) => {
dispatch('getToken', credentials)
// TODO: catch failed login
.then(() => {
// there no response here, check the original getToken method
// console.log('dispatch getToken response', response);
// check if getToken (login) went well
if(state.isloggedin){
.then((response) => {
console.log('userLogin dispatch getToken response', response)
if (response.status === 200) {
commit('setToken', response.data)
dispatch('getUser').then(userdata => {
console.log('User Loggedin')
if (state.isAdmin) {
@ -184,9 +184,11 @@ export default {
}
resolve()
})
}else{
} else {
commit('setLoginMessage', response.data.message)
console.warn('Issue with getToken', response)
console.log('user loggein failed')
Promise.reject('user loggein failed')
Promise.reject(new Error('user loggein failed'))
}
})
.catch(error => {
@ -200,23 +202,9 @@ export default {
credentials,
{
validateStatus: function (status) {
return status >= 200 && status < 500;
return status >= 200 && status < 500
}
})
.then((response) => {
console.log('user REST getToken response', response)
if(response.status === 200){
commit('setToken', response.data)
}else if(response.data.message){
commit('setLoginMessage', response.data.message)
}else{
console.warn('Issue with getToken', response)
}
})
.catch(error => {
console.warn('Issue with getToken', error)
Promise.reject(error)
})
},
getUser ({ dispatch, commit, state }) {
return new Promise((resolve, reject) => {
@ -248,7 +236,7 @@ export default {
getUserFlagColls ({ dispatch, commit, state }) {
// flags
// REST.get('/flagging_collection/1?_format=json')
// .then(( data ) => {
// .then((data) => {
// console.log('TEST FLAG REST data', data)
// })
// .catch(error => {
@ -267,11 +255,11 @@ export default {
})
},
// https://drupal.stackexchange.com/questions/248539/cant-get-flagging-api-to-accept-post-request
createFlagColl ({ dispatch, commit, state }, new_collection_name) {
console.log('user createFlagColl', new_collection_name)
createFlagColl ({ dispatch, commit, state }, newCollectionName) {
console.log('user createFlagColl', newCollectionName)
return new Promise((resolve, reject) => {
const params = {
name: new_collection_name
name: newCollectionName
}
MA.post('materio_flag/create_user_flagging_collection', params)
.then(({ data }) => {
@ -321,7 +309,6 @@ export default {
// reload the fulllist of flagcolleciton
dispatch('getUserFlagColls').then(() => {
if (state.flagcolls[collid].items.length) {
dispatch('loadMaterialsGQL', {
ids: state.flagcolls[collid].items,
gqlfragment: materiauGQL,
@ -373,7 +360,6 @@ export default {
// callBack: 'loadMaterialsCallBack',
// callBackArgs: { collid: collid }
// })
} else {
// call the mutation without data to only trigger the FlagCollection component update
console.log('committing setLoadedCollItems without args')
@ -399,6 +385,7 @@ export default {
.then(resp => {
console.log('userLogout resp', resp)
commit('setLoggedOut')
// window.location.reload(true) ???
})
.catch(error => {
console.warn('Issue with logout', error)