fixed all eslint errors and warning, compiled as PROD
This commit is contained in:
parent
ae3c8f1234
commit
3042f97b29
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'no-unused-vars': ["warn"],
|
'no-unused-vars': ["warn"],
|
||||||
'camelcase': 'warn',
|
'camelcase': 'off',
|
||||||
'eqeqeq': 'warn',
|
'eqeqeq': 'warn',
|
||||||
'no-redeclare': 'warn'
|
'no-redeclare': 'warn'
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,7 @@ start_url: /
|
||||||
lang: en
|
lang: en
|
||||||
theme_color: '#ffffff'
|
theme_color: '#ffffff'
|
||||||
background_color: '#ffffff'
|
background_color: '#ffffff'
|
||||||
display: fullscreen
|
display: standalone
|
||||||
default_image: '0'
|
default_image: '0'
|
||||||
urls_to_cache: "/en/pricing\r\n/en/blabla\r\n/en/base\r\n/en/showrooms"
|
urls_to_cache: "/en/pricing\r\n/en/blabla\r\n/en/base\r\n/en/showrooms"
|
||||||
urls_to_exclude: "admin/.*\r\nuser/.*"
|
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
|
@ -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
|
||||||
|
*/
|
|
@ -1,73 +1,2 @@
|
||||||
body {
|
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}
|
||||||
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; }
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
||||||
/******/ })()
|
|
||||||
;
|
|
|
@ -80,9 +80,9 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
function checkNoVuePages () {
|
function checkNoVuePages () {
|
||||||
// return drupalDecoupled.sys_path != '/cart'
|
// return drupalDecoupled.sys_path != '/cart'
|
||||||
// && drupalDecoupled.sys_path.indexOf('checkout') != 1;
|
// && drupalDecoupled.sys_path.indexOf('checkout') != 1;
|
||||||
if (drupalDecoupled.route_name.indexOf('commerce') == -1 &&
|
if (drupalDecoupled.route_name.indexOf('commerce') === -1 &&
|
||||||
drupalDecoupled.route_name.indexOf('flagging_collection') == -1 &&
|
drupalDecoupled.route_name.indexOf('flagging_collection') === -1 &&
|
||||||
drupalDecoupled.route_name.indexOf('user') == -1) {
|
drupalDecoupled.route_name.indexOf('user') === -1) {
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
|
@ -122,7 +122,7 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
function initVRouter () {
|
function initVRouter () {
|
||||||
// we need this to update the title and body classes while using history nav
|
// we need this to update the title and body classes while using history nav
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
// console.log('router beforeEach to ', to);
|
console.log('router beforeEach to ', to)
|
||||||
// commit new title to store
|
// commit new title to store
|
||||||
let title = null
|
let title = null
|
||||||
switch (to.name) {
|
switch (to.name) {
|
||||||
|
@ -142,7 +142,7 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
// remove all path related body classes
|
// remove all path related body classes
|
||||||
const body_classes = document.querySelector('body').classList
|
const body_classes = document.querySelector('body').classList
|
||||||
const classes_to_rm = []
|
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-')) {
|
if (body_classes[i].startsWith('path-')) {
|
||||||
classes_to_rm.push(body_classes[i])
|
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)
|
document.querySelector('body').classList.remove(...classes_to_rm)
|
||||||
// add new path classes to body
|
// add new path classes to body
|
||||||
const classes = []
|
const classes = []
|
||||||
if (to.name == 'home') {
|
if (to.name === 'home') {
|
||||||
classes.push('path-home')
|
classes.push('path-home')
|
||||||
} else {
|
} else {
|
||||||
const path_parts = to.path
|
const path_parts = to.path
|
||||||
.replace(/^\//, '')
|
.replace(/^\//, '')
|
||||||
// remove language relative prefix from path classes (fr, en, etc)
|
.replace(/^\D{2,3}\//, '') // remove language relative prefix from path classes (fr, en, etc)
|
||||||
.replace(/^\D{2,3}\//, '')
|
.split('/')
|
||||||
.split('/')
|
let c
|
||||||
for (var i = 0; i < path_parts.length; i++) {
|
for (let j = 0; j < path_parts.length; j++) {
|
||||||
if (i == 0) {
|
if (j === 0) {
|
||||||
var c = 'path-' + path_parts[i]
|
c = 'path-' + path_parts[j]
|
||||||
} else if (path_parts[i] !== '') {
|
} else if (path_parts[j] !== '') {
|
||||||
var c = classes[i - 1] + '-' + path_parts[i]
|
c = classes[j - 1] + '-' + path_parts[j]
|
||||||
}
|
}
|
||||||
classes.push(c)
|
classes.push(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.querySelector('body').classList.add(...classes)
|
document.querySelector('body').classList.add(...classes)
|
||||||
|
|
||||||
updateLanguageLinksBlock(to.path);
|
updateLanguageLinksBlock(to.path)
|
||||||
|
|
||||||
// close the hamburger menu
|
// close the hamburger menu
|
||||||
store.dispatch('Common/openCloseHamMenu', false)
|
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
|
// update block language selection
|
||||||
console.log("updateLanguageLinksBlock, path:", path);
|
console.log('router beforeEach path ', path)
|
||||||
let links = document.querySelectorAll('#block-languageswitcher a.language-link')
|
const links = document.querySelectorAll('#block-languageswitcher a.language-link')
|
||||||
|
|
||||||
let params = {
|
const params = {
|
||||||
path: path
|
path: path
|
||||||
// XDEBUG_SESSION_START: true
|
// XDEBUG_SESSION_START: true
|
||||||
}
|
}
|
||||||
|
|
||||||
MA.post(`materio_decoupled/path_translation_links?`, params)
|
MA.post('materio_decoupled/path_translation_links?', params)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('Path translations links', data)
|
console.log('Path translations links', data)
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
console.warn("error getting translation paths", data.error);
|
console.warn('error getting translation paths', data.error)
|
||||||
}
|
}
|
||||||
|
|
||||||
links.forEach((link, i) => {
|
links.forEach((link, i) => {
|
||||||
console.log("language link",path , link)
|
console.log('language link', path, link)
|
||||||
let hreflang = link.getAttribute('hreflang')
|
const hreflang = link.getAttribute('hreflang')
|
||||||
|
|
||||||
link.setAttribute('href', data.links[hreflang].url)
|
link.setAttribute('href', data.links[hreflang].url)
|
||||||
link.setAttribute('data-drupal-link-system-path', data.links[hreflang].sys_path)
|
link.setAttribute('data-drupal-link-system-path', data.links[hreflang].sys_path)
|
||||||
|
|
||||||
link.innerHTML = data.links[hreflang].title
|
link.innerHTML = data.links[hreflang].title
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Path translations links', error)
|
console.warn('Path translations links', error)
|
||||||
|
@ -219,9 +219,9 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
el: '#block-sitebranding',
|
el: '#block-sitebranding',
|
||||||
methods: {
|
methods: {
|
||||||
onclick (event) {
|
onclick (event) {
|
||||||
// console.log("Clicked on logo event", event);
|
// console.log('router beforeEach to ', to)
|
||||||
const href = event.target.getAttribute('href')
|
const href = event.target.getAttribute('href')
|
||||||
// console.log("Clicked on logo href", href);
|
// console.log('router beforeEach to ', to)
|
||||||
this.$router.push(href)
|
this.$router.push(href)
|
||||||
// replaced by router.beforeEach
|
// replaced by router.beforeEach
|
||||||
// this.$store.commit('Common/setPagetitle', null)
|
// this.$store.commit('Common/setPagetitle', null)
|
||||||
|
@ -290,14 +290,14 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
},
|
},
|
||||||
render: h => h(VUserBlock, { props: props })
|
render: h => h(VUserBlock, { props: props })
|
||||||
}).$mount('#' + mount_point)
|
}).$mount('#' + mount_point)
|
||||||
// console.log('initVUserBlock', _v_user_block);
|
// console.log('router beforeEach to ', to)
|
||||||
}
|
}
|
||||||
|
|
||||||
function initVHeaderMenu () {
|
function initVHeaderMenu () {
|
||||||
// console.log('initVHeaderMenu');
|
// console.log('router beforeEach to ', to)
|
||||||
const id = 'block-header'
|
const id = 'block-header'
|
||||||
const $html_obj = document.querySelector('#' + id)
|
const $html_obj = document.querySelector('#' + id)
|
||||||
// console.log('main-content', $main_content);
|
// console.log('router beforeEach to ', to)
|
||||||
const html = $html_obj.outerHTML
|
const html = $html_obj.outerHTML
|
||||||
_v_header_menu = new Vue({
|
_v_header_menu = new Vue({
|
||||||
store,
|
store,
|
||||||
|
@ -307,10 +307,10 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
}).$mount('#' + id)
|
}).$mount('#' + id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function initHamburgerMenu(){
|
function initHamburgerMenu () {
|
||||||
const input = document.querySelector('input#header-block-right-toggle')
|
const input = document.querySelector('input#header-block-right-toggle')
|
||||||
input.addEventListener('change', (e) => {
|
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)
|
store.dispatch('Common/openCloseHamMenu', e.currentTarget.checked)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
function initVMainContent () {
|
function initVMainContent () {
|
||||||
const id = 'main-content'
|
const id = 'main-content'
|
||||||
const $main_content = document.querySelector('#' + id)
|
const $main_content = document.querySelector('#' + id)
|
||||||
// console.log('main-content', $main_content);
|
// console.log('router beforeEach to ', to)
|
||||||
const main_html = $main_content.innerHTML
|
const main_html = $main_content.innerHTML
|
||||||
_v_main_content = new Vue({
|
_v_main_content = new Vue({
|
||||||
store,
|
store,
|
||||||
|
@ -334,7 +334,7 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
}
|
}
|
||||||
|
|
||||||
function initVSearchBlock () {
|
function initVSearchBlock () {
|
||||||
// console.log('initVSearchBlock');
|
// console.log('router beforeEach to ', to)
|
||||||
const id = 'block-materiosapisearchblock'
|
const id = 'block-materiosapisearchblock'
|
||||||
let $search_block = document.getElementById(id)
|
let $search_block = document.getElementById(id)
|
||||||
let formhtml = null
|
let formhtml = null
|
||||||
|
@ -360,7 +360,7 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
}
|
}
|
||||||
function initVLeftContent () {
|
function initVLeftContent () {
|
||||||
const id = 'content-left'
|
const id = 'content-left'
|
||||||
const $leftContent = document.getElementById(id)
|
// const $leftContent = document.getElementById(id)
|
||||||
// in any case create the vue
|
// in any case create the vue
|
||||||
_v_left_content = new Vue({
|
_v_left_content = new Vue({
|
||||||
store,
|
store,
|
||||||
|
@ -371,5 +371,6 @@ import { MA } from 'vuejs/api/ma-axios'
|
||||||
init()
|
init()
|
||||||
} // end MaterioTheme()
|
} // end MaterioTheme()
|
||||||
|
|
||||||
const materiotheme = new MaterioTheme()
|
// const materiotheme = new MaterioTheme()
|
||||||
|
MaterioTheme()
|
||||||
})(Drupal, drupalSettings, drupalDecoupled)
|
})(Drupal, drupalSettings, drupalDecoupled)
|
||||||
|
|
|
@ -18,7 +18,7 @@ console.dir(argv);
|
||||||
var prod = argv.env == 'prod' ? true : false;
|
var prod = argv.env == 'prod' ? true : false;
|
||||||
|
|
||||||
function handleError(err) {
|
function handleError(err) {
|
||||||
console.log(err.toString());
|
console.log(err.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('scripts', gulp.series(function (done) {
|
gulp.task('scripts', gulp.series(function (done) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ function materiotheme_form_user_login_form_alter(&$form, FormStateInterface $for
|
||||||
* - url: An optional \Drupal\Core\Url object.
|
* - url: An optional \Drupal\Core\Url object.
|
||||||
*/
|
*/
|
||||||
// function materiotheme_preprocess_image_formatter(&$vars){
|
// function materiotheme_preprocess_image_formatter(&$vars){
|
||||||
// if(isset($vars['url'])){
|
// if (isset($vars['url'])) {
|
||||||
// $system_path = $vars['url']->getInternalPath();
|
// $system_path = $vars['url']->getInternalPath();
|
||||||
// $vars['link_attributes'] = new Attribute(array(
|
// $vars['link_attributes'] = new Attribute(array(
|
||||||
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
|
// 'data-drupal-link-system-path' => $system_path=='' ? '<front>' : $system_path,
|
||||||
|
|
|
@ -2,16 +2,16 @@ import axios from 'axios'
|
||||||
|
|
||||||
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
|
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
|
||||||
|
|
||||||
// console.log('drupalSettings', drupalSettings);
|
// console.log('drupalSettings', drupalSettings)
|
||||||
console.log(window.location);
|
console.log(window.location)
|
||||||
|
|
||||||
export const MGQ = axios.create({
|
export const MGQ = axios.create({
|
||||||
baseURL: window.location.origin+`/mgq`,
|
baseURL: window.location.origin + '/mgq',
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
Accept: 'application/json',
|
||||||
// Accept: 'application/vnd.api+json'
|
// Accept: 'application/vnd.api+json'
|
||||||
// Authorization: 'Basic {token}',
|
// Authorization: 'Basic {token}',
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,8 +2,8 @@ import axios from 'axios'
|
||||||
|
|
||||||
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
|
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
|
||||||
|
|
||||||
// console.log('drupalSettings', drupalSettings);
|
// console.log('drupalSettings', drupalSettings)
|
||||||
console.log(window.location);
|
console.log(window.location)
|
||||||
|
|
||||||
export const JSONAPI = axios.create({
|
export const JSONAPI = axios.create({
|
||||||
baseURL: window.location.origin+`/jsonapi`,
|
baseURL: window.location.origin+`/jsonapi`,
|
||||||
|
@ -11,6 +11,6 @@ export const JSONAPI = axios.create({
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/vnd.api+json'
|
Accept: 'application/vnd.api+json'
|
||||||
// Authorization: 'Basic {token}',
|
// Authorization: 'Basic {token}',
|
||||||
// "Content-Type": "application/json"
|
// 'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,13 +2,13 @@ import axios from 'axios'
|
||||||
|
|
||||||
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
|
// 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({
|
export const MA = axios.create({
|
||||||
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
|
baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
// "X-CSRF-Token": "csrf_token"
|
// "X-CSRF-Token": "csrf_token"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,13 +2,13 @@ import axios from 'axios'
|
||||||
|
|
||||||
// https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
|
// 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({
|
export const REST = axios.create({
|
||||||
baseURL: window.location.origin,
|
baseURL: window.location.origin,
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
headers: {
|
headers: {
|
||||||
// Authorization: 'Bearer {token}',
|
// Authorization: 'Bearer {token}',
|
||||||
"Content-Type": "application/json"
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default {
|
||||||
mail: this.mail,
|
mail: this.mail,
|
||||||
pass: this.password
|
pass: this.password
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
console.log("LoginBlock user logged-in")
|
console.log('LoginBlock user logged-in')
|
||||||
this.openCloseHamMenu(false)
|
this.openCloseHamMenu(false)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'base'
|
name: 'base'
|
||||||
|
@ -39,9 +39,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log('LoginBlock beforeMount', this._props.block);
|
// console.log('LoginBlock beforeMount', this._props.block)
|
||||||
if(this._props.block){
|
if (this._props.block) {
|
||||||
// console.log('LoginBlock beforeMount if this._props.block ok');
|
// console.log('LoginBlock beforeMount if this._props.block ok')
|
||||||
this.template = Vue.compile(this._props.block)
|
this.template = Vue.compile(this._props.block)
|
||||||
this.$options.staticRenderFns = [];
|
this.$options.staticRenderFns = [];
|
||||||
this._staticTrees = [];
|
this._staticTrees = [];
|
||||||
|
@ -49,16 +49,16 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
// console.log('LoginBlock mounted');
|
// console.log('LoginBlock mounted')
|
||||||
Drupal.attachBehaviors(this.$el);
|
Drupal.attachBehaviors(this.$el);
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
// console.log('LoginBlock render');
|
// console.log('LoginBlock render')
|
||||||
if(!this.template){
|
if (!this.template) {
|
||||||
// console.log('LoginBlock render NAN');
|
// console.log('LoginBlock render NAN')
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
// console.log('LoginBlock render template');
|
// console.log('LoginBlock render template')
|
||||||
return this.template.render.call(this)
|
return this.template.render.call(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,21 +23,21 @@ export default {
|
||||||
canSearch: state => state.User.canSearch
|
canSearch: state => state.User.canSearch
|
||||||
}),
|
}),
|
||||||
displayform(){
|
displayform(){
|
||||||
// console.log('computed displayform');
|
// console.log('computed displayform')
|
||||||
return this.canSearch && this.form
|
return this.canSearch && this.form
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log('SearchBlock beforeMount');
|
// console.log('SearchBlock beforeMount')
|
||||||
this.form = this.formhtml
|
this.form = this.formhtml
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
canSearch(new_value, old_value) {
|
canSearch(new_value, old_value) {
|
||||||
// console.log('canSearch changed, old: '+old_value+", new: "+new_value);
|
// console.log('canSearch changed, old: '+old_value+", new: "+new_value)
|
||||||
if(new_value && !this.form){
|
if (new_value && !this.form) {
|
||||||
this.getSearchForm()
|
this.getSearchForm()
|
||||||
}
|
}
|
||||||
if(!new_value && this.form){
|
if (!new_value && this.form) {
|
||||||
this.form = null
|
this.form = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,10 +46,10 @@ export default {
|
||||||
getSearchForm(){
|
getSearchForm(){
|
||||||
MA.get(`/materio_sapi/search_form`)
|
MA.get(`/materio_sapi/search_form`)
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
// console.log("getSearchForm");
|
// console.log('getSearchForm')
|
||||||
this.form = data.rendered
|
this.form = data.rendered
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with get searchform', error)
|
console.warn('Issue with get searchform', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
console.log('UserBlock beforeMount');
|
console.log('UserBlock beforeMount')
|
||||||
if(this.loginblock){
|
if (this.loginblock) {
|
||||||
this.block = this.loginblock
|
this.block = this.loginblock
|
||||||
}else{
|
} else {
|
||||||
this.getLoginBlock()
|
this.getLoginBlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ export default {
|
||||||
getLoginBlock(){
|
getLoginBlock(){
|
||||||
MA.get(`/materio_user/login_block`)
|
MA.get(`/materio_user/login_block`)
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
// console.log("getLoginBlock data", data);
|
// console.log("getLoginBlock data", data)
|
||||||
this.block = data.rendered
|
this.block = data.rendered
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with getLoginBlock', error)
|
console.warn('Issue with getLoginBlock', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
onclick(){
|
onclick(){
|
||||||
console.log('clicked on article', this.alias);
|
console.log('clicked on article', this.alias)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name:`article`,
|
name:`article`,
|
||||||
params: { alias:this.alias, id: this.item.nid }
|
params: { alias:this.alias, id: this.item.nid }
|
||||||
|
|
|
@ -140,14 +140,14 @@ export default {
|
||||||
this.is_creating_folder = true;
|
this.is_creating_folder = true;
|
||||||
this.createFlagColl(this.new_folder_name)
|
this.createFlagColl(this.new_folder_name)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("Card onCreateFlagColl then", data);
|
console.log("Card onCreateFlagColl then", data)
|
||||||
this.new_folder_name = "";
|
this.new_folder_name = "";
|
||||||
this.is_creating_folder = false;
|
this.is_creating_folder = false;
|
||||||
let collid = data.id
|
let collid = data.id
|
||||||
this.loadingFlag = collid;
|
this.loadingFlag = collid;
|
||||||
this.flagUnflag({ action: 'flag', id: this.item.id, collid: collid})
|
this.flagUnflag({ action: 'flag', id: this.item.id, collid: collid})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("onFlagActionCard then", data);
|
console.log("onFlagActionCard then", data)
|
||||||
this.loadingFlag = false;
|
this.loadingFlag = false;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -158,27 +158,27 @@ export default {
|
||||||
// this.flagcolls[collid].items,
|
// this.flagcolls[collid].items,
|
||||||
// this.flagcolls[collid].items.indexOf(this.item.id)
|
// 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_uuids.indexOf(this.item.uuid) !== -1;
|
||||||
return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
|
return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
|
||||||
},
|
},
|
||||||
flagIsLoading(collid) {
|
flagIsLoading(collid) {
|
||||||
// console.log(this.item.uuid);
|
// console.log(this.item.uuid)
|
||||||
// console.log(this.flagcolls[collid].items_uuids);
|
// console.log(this.flagcolls[collid].items_uuids)
|
||||||
return collid === this.loadingFlag;
|
return collid === this.loadingFlag;
|
||||||
},
|
},
|
||||||
onFlagActionCard (e) {
|
onFlagActionCard (e) {
|
||||||
console.log("Card onFlagActionCard", e, this.item);
|
console.log("Card onFlagActionCard", e, this.item)
|
||||||
if (!this.loadingFlag) {
|
if (!this.loadingFlag) {
|
||||||
let collid = e.target.getAttribute('collid');
|
let collid = e.target.getAttribute('collid');
|
||||||
let isActive = this.flagIsActive(collid);
|
let isActive = this.flagIsActive(collid);
|
||||||
let action = isActive ? 'unflag' : 'flag';
|
let action = isActive ? 'unflag' : 'flag';
|
||||||
// console.log('collid', collid);
|
// console.log('collid', collid)
|
||||||
// console.log("this.item", this.item);
|
// console.log("this.item", this.item)
|
||||||
this.loadingFlag = collid;
|
this.loadingFlag = collid;
|
||||||
this.flagUnflag({ action: action, id: this.item.id, collid: collid})
|
this.flagUnflag({ action: action, id: this.item.id, collid: collid})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("onFlagActionCard then", data);
|
console.log("onFlagActionCard then", data)
|
||||||
this.loadingFlag = false;
|
this.loadingFlag = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -187,8 +187,8 @@ export default {
|
||||||
// this.lightbox_index = index
|
// this.lightbox_index = index
|
||||||
// },
|
// },
|
||||||
openModalCard (e) {
|
openModalCard (e) {
|
||||||
console.log('openModalCard', this.isLoggedin);
|
console.log('openModalCard', this.isLoggedin)
|
||||||
if(this.isloggedin){
|
if (this.isloggedin) {
|
||||||
this.$modal.show(
|
this.$modal.show(
|
||||||
ModalCard,
|
ModalCard,
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,33 +72,33 @@ export default {
|
||||||
// // this.flagcolls[collid].items,
|
// // this.flagcolls[collid].items,
|
||||||
// // this.flagcolls[collid].items.indexOf(this.item.id)
|
// // 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_uuids.indexOf(this.item.uuid) !== -1;
|
||||||
// return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
|
// return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
|
||||||
// },
|
// },
|
||||||
// flagIsLoading(collid) {
|
// flagIsLoading(collid) {
|
||||||
// // console.log(this.item.uuid);
|
// // console.log(this.item.uuid)
|
||||||
// // console.log(this.flagcolls[collid].items_uuids);
|
// // console.log(this.flagcolls[collid].items_uuids)
|
||||||
// return collid === this.loadingFlag;
|
// return collid === this.loadingFlag;
|
||||||
// },
|
// },
|
||||||
// onFlagActionCard (e) {
|
// onFlagActionCard (e) {
|
||||||
// console.log("Card onFlagActionCard", e, this.item);
|
// console.log("Card onFlagActionCard", e, this.item)
|
||||||
// if (!this.loadingFlag) {
|
// if (!this.loadingFlag) {
|
||||||
// let collid = e.target.getAttribute('collid');
|
// let collid = e.target.getAttribute('collid');
|
||||||
// let isActive = this.flagIsActive(collid);
|
// let isActive = this.flagIsActive(collid);
|
||||||
// let action = isActive ? 'unflag' : 'flag';
|
// let action = isActive ? 'unflag' : 'flag';
|
||||||
// // console.log('collid', collid);
|
// // console.log('collid', collid)
|
||||||
// // console.log("this.item", this.item);
|
// // console.log("this.item", this.item)
|
||||||
// this.loadingFlag = collid;
|
// this.loadingFlag = collid;
|
||||||
// this.flagUnflag({ action: action, id: this.item.id, collid: collid})
|
// this.flagUnflag({ action: action, id: this.item.id, collid: collid})
|
||||||
// .then(data => {
|
// .then(data => {
|
||||||
// console.log("onFlagActionCard then", data);
|
// console.log("onFlagActionCard then", data)
|
||||||
// this.loadingFlag = false;
|
// this.loadingFlag = false;
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
// },
|
// },
|
||||||
openThematique (e) {
|
openThematique (e) {
|
||||||
console.log('openThematique', e, this.alias);
|
console.log('openThematique', e, this.alias)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name:`thematique`,
|
name:`thematique`,
|
||||||
params: { alias:this.alias, id: this.item.id }
|
params: { alias:this.alias, id: this.item.id }
|
||||||
|
|
|
@ -22,13 +22,13 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log("beforeMount header_menu", this.html);
|
// console.log("beforeMount header_menu", this.html)
|
||||||
if(!this.template){
|
if (!this.template) {
|
||||||
// console.log('no home_template');
|
// console.log('no home_template')
|
||||||
if(this.dom_html){ // if html prop is available
|
if (this.dom_html) { // if html prop is available
|
||||||
this.html = this.dom_html
|
this.html = this.dom_html
|
||||||
this.compileTemplate()
|
this.compileTemplate()
|
||||||
}else{ // else get it from ajax
|
} else { // else get it from ajax
|
||||||
this.getMenuBlockHtml()
|
this.getMenuBlockHtml()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,25 +43,25 @@ export default {
|
||||||
getMenuBlockHtml(){
|
getMenuBlockHtml(){
|
||||||
MA.get('materio_decoupled/ajax/getheadermenu')
|
MA.get('materio_decoupled/ajax/getheadermenu')
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
// console.log('HeaderMenu getMenuBlockHtml data', data);
|
// console.log('HeaderMenu getMenuBlockHtml data', data)
|
||||||
this.html = data.rendered // record the html src into data
|
this.html = data.rendered // record the html src into data
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with getMenuBlockHtml', error)
|
console.warn('Issue with getMenuBlockHtml', error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onclick (event) {
|
onclick (event) {
|
||||||
// console.log("Clicked on header menu link", event);
|
// console.log("Clicked on header menu link", event)
|
||||||
const href = event.target.getAttribute('href')
|
const href = event.target.getAttribute('href')
|
||||||
// this.openCloseHamMenu(false)
|
// this.openCloseHamMenu(false)
|
||||||
this.$router.push(href)
|
this.$router.push(href)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
// console.log('headerMenu render');
|
// console.log('headerMenu render')
|
||||||
if(!this.template){
|
if (!this.template) {
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
return this.template.render.call(this)
|
return this.template.render.call(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -59,8 +59,8 @@ export default {
|
||||||
return this.loadingItem
|
return this.loadingItem
|
||||||
},
|
},
|
||||||
openModalCard (e) {
|
openModalCard (e) {
|
||||||
console.log('openModalCard', this.isLoggedin);
|
console.log('openModalCard', this.isLoggedin)
|
||||||
if(this.isloggedin){
|
if (this.isloggedin) {
|
||||||
this.$modal.show(
|
this.$modal.show(
|
||||||
ModalCard,
|
ModalCard,
|
||||||
{ item: this.item },
|
{ item: this.item },
|
||||||
|
|
|
@ -21,12 +21,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log('MainContent beforeMount this.html', this.html);
|
// console.log('MainContent beforeMount this.html', this.html)
|
||||||
if(!this.home_template_src){
|
if (!this.home_template_src) {
|
||||||
// console.log('no 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
|
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
|
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()
|
this.getHomeHtml()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,10 @@ export default {
|
||||||
getHomeHtml(){
|
getHomeHtml(){
|
||||||
MA.get('materio_home/ajax/gethome')
|
MA.get('materio_home/ajax/gethome')
|
||||||
.then(({data}) => {
|
.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
|
this.home_template_src = data.rendered // record the html src into data
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with getHomeHtml', error)
|
console.warn('Issue with getHomeHtml', error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ export default {
|
||||||
return this.loadingItem
|
return this.loadingItem
|
||||||
},
|
},
|
||||||
onUnFlagCard (e) {
|
onUnFlagCard (e) {
|
||||||
console.log("Card onFlagActionCard", e, this.item);
|
console.log("Card onFlagActionCard", e, this.item)
|
||||||
if (!this.loadingItem) {
|
if (!this.loadingItem) {
|
||||||
this.loadingItem = true;
|
this.loadingItem = true;
|
||||||
this.flagUnflag({
|
this.flagUnflag({
|
||||||
|
@ -92,14 +92,14 @@ export default {
|
||||||
collid: this.collid
|
collid: this.collid
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("onUnFlagCard then", data);
|
console.log("onUnFlagCard then", data)
|
||||||
this.loadingItem = false;
|
this.loadingItem = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
openModalCard (e) {
|
openModalCard (e) {
|
||||||
console.log('openModalCard', this.isLoggedin);
|
console.log('openModalCard', this.isLoggedin)
|
||||||
if(this.isloggedin){
|
if (this.isloggedin) {
|
||||||
this.$modal.show(
|
this.$modal.show(
|
||||||
ModalCard,
|
ModalCard,
|
||||||
{ item: this.item },
|
{ item: this.item },
|
||||||
|
|
|
@ -361,20 +361,20 @@ export default {
|
||||||
loadMaterial(){
|
loadMaterial(){
|
||||||
console.log('loadMaterial', this.item.id)
|
console.log('loadMaterial', this.item.id)
|
||||||
this.loading = true
|
this.loading = true
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") {
|
materiau(id: ${this.item.id}, lang: "${drupalDecoupled.lang_code}") {
|
||||||
...MateriauFields
|
...MateriauFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ materiauFields }
|
${materiauFields}
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast)
|
MGQ.post('', { query: print(ast)
|
||||||
})
|
})
|
||||||
.then(({ data:{data:{materiau}}}) => {
|
.then(({ data:{data:{materiau}}}) => {
|
||||||
console.log('loadMaterial material loaded', materiau )
|
console.log('loadMaterial material loaded', materiau)
|
||||||
this.material = materiau
|
this.material = materiau
|
||||||
this.loading = false
|
this.loading = false
|
||||||
if(materiau.note && materiau.note.id){
|
if (materiau.note && materiau.note.id) {
|
||||||
this.note_id = materiau.note.id
|
this.note_id = materiau.note.id
|
||||||
this.note = materiau.note.contenu
|
this.note = materiau.note.contenu
|
||||||
}
|
}
|
||||||
|
@ -394,41 +394,41 @@ export default {
|
||||||
this.is_creating_folder = true;
|
this.is_creating_folder = true;
|
||||||
this.createFlagColl(this.new_folder_name)
|
this.createFlagColl(this.new_folder_name)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("Card onCreateFlagColl then", data);
|
console.log("Card onCreateFlagColl then", data)
|
||||||
this.new_folder_name = "";
|
this.new_folder_name = "";
|
||||||
this.is_creating_folder = false;
|
this.is_creating_folder = false;
|
||||||
let collid = data.id
|
let collid = data.id
|
||||||
this.loadingFlag = collid;
|
this.loadingFlag = collid;
|
||||||
this.flagUnflag({ action: 'flag', id: this.item.id, collid: collid})
|
this.flagUnflag({ action: 'flag', id: this.item.id, collid: collid})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("onFlagActionCard then", data);
|
console.log("onFlagActionCard then", data)
|
||||||
this.loadingFlag = false;
|
this.loadingFlag = false;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
flagIsActive(collid) {
|
flagIsActive(collid) {
|
||||||
// console.log(this.item.uuid);
|
// console.log(this.item.uuid)
|
||||||
// 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_uuids.indexOf(this.item.uuid) !== -1;
|
||||||
return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
|
return this.flagcolls[collid].items.indexOf(this.item.id) !== -1;
|
||||||
},
|
},
|
||||||
flagIsLoading(collid) {
|
flagIsLoading(collid) {
|
||||||
// console.log(this.item.uuid);
|
// console.log(this.item.uuid)
|
||||||
// console.log(this.flagcolls[collid].items_uuids);
|
// console.log(this.flagcolls[collid].items_uuids)
|
||||||
return collid === this.loadingFlag;
|
return collid === this.loadingFlag;
|
||||||
},
|
},
|
||||||
onFlagActionCard (e) {
|
onFlagActionCard (e) {
|
||||||
console.log("Card onFlagActionCard", e);
|
console.log("Card onFlagActionCard", e)
|
||||||
if (!this.loadingFlag) {
|
if (!this.loadingFlag) {
|
||||||
let collid = e.target.getAttribute('collid');
|
let collid = e.target.getAttribute('collid');
|
||||||
let isActive = this.flagIsActive(collid);
|
let isActive = this.flagIsActive(collid);
|
||||||
let action = isActive ? 'unflag' : 'flag';
|
let action = isActive ? 'unflag' : 'flag';
|
||||||
// console.log('collid', collid);
|
// console.log('collid', collid)
|
||||||
// console.log("this.item", this.item);
|
// console.log("this.item", this.item)
|
||||||
this.loadingFlag = collid;
|
this.loadingFlag = collid;
|
||||||
this.flagUnflag({ action: action, id: this.item.id, collid: collid})
|
this.flagUnflag({ action: action, id: this.item.id, collid: collid})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("onFlagActionCard then", data);
|
console.log("onFlagActionCard then", data)
|
||||||
this.loadingFlag = false;
|
this.loadingFlag = false;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -448,10 +448,10 @@ export default {
|
||||||
return url.replace(/^http:\/\//, '').replace(/^www\./, '')
|
return url.replace(/^http:\/\//, '').replace(/^www\./, '')
|
||||||
},
|
},
|
||||||
saveNote(){
|
saveNote(){
|
||||||
console.log("saveNote", this.note);
|
console.log("saveNote", this.note)
|
||||||
if(this.note_nid){
|
if (this.note_nid) {
|
||||||
this.updateNote()
|
this.updateNote()
|
||||||
}else{
|
} else {
|
||||||
this.createNote()
|
this.createNote()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -511,7 +511,7 @@ export default {
|
||||||
onTapCard (e) {
|
onTapCard (e) {
|
||||||
console.log('ontapCard', e)
|
console.log('ontapCard', e)
|
||||||
let tools = this.$refs['tools'].querySelectorAll('section.tool')
|
let tools = this.$refs['tools'].querySelectorAll('section.tool')
|
||||||
// console.log();
|
// console.log()
|
||||||
tools.forEach((item, i) => {
|
tools.forEach((item, i) => {
|
||||||
console.log('item', item)
|
console.log('item', item)
|
||||||
item.classList.remove('tapped')
|
item.classList.remove('tapped')
|
||||||
|
|
|
@ -78,25 +78,25 @@ export default {
|
||||||
this.showLoginModal = false;
|
this.showLoginModal = false;
|
||||||
},
|
},
|
||||||
checkaddtocart(e, variation_id) {
|
checkaddtocart(e, variation_id) {
|
||||||
console.log('checkaddtocart');
|
console.log('checkaddtocart')
|
||||||
|
|
||||||
if(!this.isloggedin){
|
if (!this.isloggedin) {
|
||||||
// show popup for login or register
|
// show popup for login or register
|
||||||
// login or register event will be catched by onLogedin or onRegistered
|
// login or register event will be catched by onLogedin or onRegistered
|
||||||
this.showLoginModal = variation_id
|
this.showLoginModal = variation_id
|
||||||
}else{
|
} else {
|
||||||
// if already logedin directly goes to cart operations
|
// if already logedin directly goes to cart operations
|
||||||
this.addtocart(variation_id)
|
this.addtocart(variation_id)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// event bubbled from modal login form
|
// event bubbled from modal login form
|
||||||
onLogedIn (variation_id) {
|
onLogedIn (variation_id) {
|
||||||
console.log('Product: onLogedIn. variation_id', variation_id);
|
console.log('Product: onLogedIn. variation_id', variation_id)
|
||||||
this.addtocart(variation_id)
|
this.addtocart(variation_id)
|
||||||
},
|
},
|
||||||
// event bubbled from modal register form
|
// event bubbled from modal register form
|
||||||
onRegistered (variation_id) {
|
onRegistered (variation_id) {
|
||||||
console.log('Product: onRegistered. variation_id', variation_id);
|
console.log('Product: onRegistered. variation_id', variation_id)
|
||||||
this.addtocart(variation_id)
|
this.addtocart(variation_id)
|
||||||
},
|
},
|
||||||
getCarts () {
|
getCarts () {
|
||||||
|
@ -105,18 +105,18 @@ export default {
|
||||||
// .then(({ data }) => {
|
// .then(({ data }) => {
|
||||||
// console.log('current user carts: data', data)
|
// console.log('current user carts: data', data)
|
||||||
// })
|
// })
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with get cart', error)
|
console.warn('Issue with get cart', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteCart (order_id) {
|
deleteCart (order_id) {
|
||||||
console.log('deleting cart ', order_id);
|
console.log('deleting cart ', order_id)
|
||||||
return REST.delete(`/cart/${order_id}/items?_format=json`)
|
return REST.delete(`/cart/${order_id}/items?_format=json`)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log(`product cart ${order_id} deleted: data`, data)
|
console.log(`product cart ${order_id} deleted: data`, data)
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn(`Issue with cart ${order_id} deleting`, error)
|
console.warn(`Issue with cart ${order_id} deleting`, error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
@ -124,20 +124,20 @@ export default {
|
||||||
clearCarts (data) {
|
clearCarts (data) {
|
||||||
let promises = [];
|
let promises = [];
|
||||||
// clear each cart as a promise
|
// 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))
|
promises.push(this.deleteCart(data[i].order_id))
|
||||||
}
|
}
|
||||||
// return all the promises as one
|
// return all the promises as one
|
||||||
return Promise.all(promises)
|
return Promise.all(promises)
|
||||||
},
|
},
|
||||||
addtocart (variation_id) {
|
addtocart (variation_id) {
|
||||||
console.log("addtocart")
|
console.log('addtocart')
|
||||||
this.getCarts()
|
this.getCarts()
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
console.log('current user carts: data', data)
|
console.log('current user carts: data', data)
|
||||||
this.clearCarts(data)
|
this.clearCarts(data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('all carts cleared');
|
console.log('all carts cleared')
|
||||||
// fill the cart with new product
|
// fill the cart with new product
|
||||||
REST.post(`/cart/add?_format=json`, [{
|
REST.post(`/cart/add?_format=json`, [{
|
||||||
"purchased_entity_type": "commerce_product_variation",
|
"purchased_entity_type": "commerce_product_variation",
|
||||||
|
@ -152,7 +152,7 @@ export default {
|
||||||
// TODO: redirect to checkout instead of cart
|
// TODO: redirect to checkout instead of cart
|
||||||
window.location.href = `/checkout/${data[0].order_id}/order_information`
|
window.location.href = `/checkout/${data[0].order_id}/order_information`
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with product add to cart', error)
|
console.warn('Issue with product add to cart', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
|
|
@ -25,13 +25,13 @@ export default {
|
||||||
// vuejs attributes a inserted by form alter in same module
|
// vuejs attributes a inserted by form alter in same module
|
||||||
MA.get(`/materio_user/login_form`)
|
MA.get(`/materio_user/login_form`)
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
console.log("getLoginForm data");
|
console.log('getLoginForm data')
|
||||||
this.form = Vue.compile(data.rendered)
|
this.form = Vue.compile(data.rendered)
|
||||||
this.$options.staticRenderFns = [];
|
this.$options.staticRenderFns = [];
|
||||||
this._staticTrees = [];
|
this._staticTrees = [];
|
||||||
this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
|
this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with getLoginForm', error)
|
console.warn('Issue with getLoginForm', error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -40,31 +40,31 @@ export default {
|
||||||
mail: this.mail,
|
mail: this.mail,
|
||||||
pass: this.password
|
pass: this.password
|
||||||
}).then( () => {
|
}).then( () => {
|
||||||
console.log('logedin from login component');
|
console.log('logedin from login component')
|
||||||
this.$emit('onLogedIn')
|
this.$emit('onLogedIn')
|
||||||
}
|
}
|
||||||
).catch(( error ) => {
|
).catch((error) => {
|
||||||
console.warn('Issue with login from login component', error)
|
console.warn('Issue with login from login component', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount () {
|
beforeMount () {
|
||||||
if(!this.form){
|
if (!this.form) {
|
||||||
this.getLoginForm()
|
this.getLoginForm()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
// console.log('LoginBlock mounted');
|
// console.log('LoginBlock mounted')
|
||||||
Drupal.attachBehaviors(this.$el);
|
Drupal.attachBehaviors(this.$el);
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
// console.log('LoginBlock render');
|
// console.log('LoginBlock render')
|
||||||
if(!this.form){
|
if (!this.form) {
|
||||||
// console.log('LoginBlock render NAN');
|
// console.log('LoginBlock render NAN')
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
// console.log('LoginBlock render template');
|
// console.log('LoginBlock render template')
|
||||||
return this.form.render.call(this)
|
return this.form.render.call(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,14 +38,14 @@ export default {
|
||||||
// vuejs attributes a inserted by form alter in same module
|
// vuejs attributes a inserted by form alter in same module
|
||||||
MA.get(`/materio_user/register_form`)
|
MA.get(`/materio_user/register_form`)
|
||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
console.log("getRegisterForm data", data);
|
console.log("getRegisterForm data", data)
|
||||||
this.form = Vue.compile(data.rendered)
|
this.form = Vue.compile(data.rendered)
|
||||||
this.$options.staticRenderFns = [];
|
this.$options.staticRenderFns = [];
|
||||||
this._staticTrees = [];
|
this._staticTrees = [];
|
||||||
this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
|
this.form.staticRenderFns.map(fn => (this.$options.staticRenderFns.push(fn)));
|
||||||
this.initFormBehaviours()
|
this.initFormBehaviours()
|
||||||
})
|
})
|
||||||
.catch(( error ) => {
|
.catch((error) => {
|
||||||
console.warn('Issue with getRegisterForm', error)
|
console.warn('Issue with getRegisterForm', error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -54,28 +54,28 @@ export default {
|
||||||
this.checkSubmitEnabled()
|
this.checkSubmitEnabled()
|
||||||
},
|
},
|
||||||
checkSubmitEnabled () {
|
checkSubmitEnabled () {
|
||||||
console.log("checkSubmitEnabled", this);
|
console.log("checkSubmitEnabled", this)
|
||||||
if(this.ps === 'Strong'){
|
if (this.ps === 'Strong') {
|
||||||
this.$refs.register.disabled = false
|
this.$refs.register.disabled = false
|
||||||
}else{
|
} else {
|
||||||
this.$refs.register.disabled = true
|
this.$refs.register.disabled = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
register () {
|
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 identical password
|
||||||
// TODO: check for valide email
|
// TODO: check for valide email
|
||||||
// TODO: check for unique email
|
// TODO: check for unique email
|
||||||
if(this.pass1 === this.pass2){
|
if (this.pass1 === this.pass2) {
|
||||||
this.userRegister({
|
this.userRegister({
|
||||||
name: this.mail,
|
name: this.mail,
|
||||||
mail: this.mail,
|
mail: this.mail,
|
||||||
pass: this.pass1
|
pass: this.pass1
|
||||||
}).then( () => {
|
}).then( () => {
|
||||||
console.log('registered from register component');
|
console.log('registered from register component')
|
||||||
this.$emit('onRegistered')
|
this.$emit('onRegistered')
|
||||||
}
|
}
|
||||||
).catch(( error ) => {
|
).catch((error) => {
|
||||||
console.warn('Issue with register from registerform component', error)
|
console.warn('Issue with register from registerform component', error)
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
|
@ -84,29 +84,29 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount () {
|
beforeMount () {
|
||||||
if(!this.form){
|
if (!this.form) {
|
||||||
this.getRegisterForm()
|
this.getRegisterForm()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
// console.log('LoginBlock mounted');
|
// console.log('LoginBlock mounted')
|
||||||
if(this.form){
|
if (this.form) {
|
||||||
this.initForm()
|
this.initForm()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
// console.log('LoginBlock render');
|
// console.log('LoginBlock render')
|
||||||
if(!this.form){
|
if (!this.form) {
|
||||||
// console.log('LoginBlock render NAN');
|
// console.log('LoginBlock render NAN')
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
// console.log('LoginBlock render template');
|
// console.log('LoginBlock render template')
|
||||||
return this.form.render.call(this)
|
return this.form.render.call(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
pass1: function(n, o){
|
pass1: function(n, o){
|
||||||
if(n){
|
if (n) {
|
||||||
this.ps = passwordStrength(n).value
|
this.ps = passwordStrength(n).value
|
||||||
console.log('watch pass1 n', n, 'ps :', this.ps)
|
console.log('watch pass1 n', n, 'ps :', this.ps)
|
||||||
this.checkSubmitEnabled()
|
this.checkSubmitEnabled()
|
||||||
|
|
|
@ -38,13 +38,13 @@ export default {
|
||||||
},
|
},
|
||||||
onAutoCompleteSelect(event, ui){
|
onAutoCompleteSelect(event, ui){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
console.log('autoCompleteSelect', event, ui);
|
console.log('autoCompleteSelect', event, ui)
|
||||||
this.typed = ui.item.label
|
this.typed = ui.item.label
|
||||||
// we have to wait for typed watch to reset autocomplete before setting it
|
// we have to wait for typed watch to reset autocomplete before setting it
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
console.log('update autocomplete value after settimeout');
|
console.log('update autocomplete value after settimeout')
|
||||||
this.autocomplete = ui.item.value
|
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()
|
this.submit()
|
||||||
}
|
}
|
||||||
}.bind(this), 1)
|
}.bind(this), 1)
|
||||||
|
@ -61,9 +61,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log('SearchForm beforeMount');
|
// console.log('SearchForm beforeMount')
|
||||||
if(this._props.form){
|
if (this._props.form) {
|
||||||
// console.log('SearchForm beforeMount if this._props.form ok');
|
// console.log('SearchForm beforeMount if this._props.form ok')
|
||||||
this.template = Vue.compile(this._props.form)
|
this.template = Vue.compile(this._props.form)
|
||||||
// https://github.com/vuejs/vue/issues/9911
|
// https://github.com/vuejs/vue/issues/9911
|
||||||
this.$options.staticRenderFns = [];
|
this.$options.staticRenderFns = [];
|
||||||
|
@ -73,16 +73,16 @@ export default {
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
typed(n, o){
|
typed(n, o){
|
||||||
console.log('typed changed', o, n);
|
console.log('typed changed', o, n)
|
||||||
// is changed also when autocomplete change it ...
|
// is changed also when autocomplete change it ...
|
||||||
this.autocomplete = null
|
this.autocomplete = null
|
||||||
},
|
},
|
||||||
keys(n, o){
|
keys(n, o){
|
||||||
console.log('keys changed', o, n);
|
console.log('keys changed', o, n)
|
||||||
this.typed = n
|
this.typed = n
|
||||||
},
|
},
|
||||||
term(n, o){
|
term(n, o){
|
||||||
console.log('autocomplete changed', o, n);
|
console.log('autocomplete changed', o, n)
|
||||||
this.autocomplete = n
|
this.autocomplete = n
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,7 @@ export default {
|
||||||
this.autocomplete = this.term
|
this.autocomplete = this.term
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
// console.log('SearchForm mounted');
|
// console.log('SearchForm mounted')
|
||||||
Drupal.attachBehaviors(this.$el);
|
Drupal.attachBehaviors(this.$el);
|
||||||
// get the search input
|
// get the search input
|
||||||
this.$input = this.$el.querySelector('#edit-search')
|
this.$input = this.$el.querySelector('#edit-search')
|
||||||
|
@ -101,10 +101,10 @@ export default {
|
||||||
jQuery(this.$input).on('autocompleteselect', this.onAutoCompleteSelect);
|
jQuery(this.$input).on('autocompleteselect', this.onAutoCompleteSelect);
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
// console.log('searchForm render');
|
// console.log('searchForm render')
|
||||||
if(!this.template){
|
if (!this.template) {
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
return this.template.render.call(this)
|
return this.template.render.call(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default {
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
close () {
|
close () {
|
||||||
console.log('click close');
|
console.log('click close')
|
||||||
this.$emit('close')
|
this.$emit('close')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,30 +169,30 @@ export default {
|
||||||
getPrevNextItems: 'Blabla/getPrevNextItems'
|
getPrevNextItems: 'Blabla/getPrevNextItems'
|
||||||
}),
|
}),
|
||||||
getArticle(){
|
getArticle(){
|
||||||
console.log('getArticle', this.$route);
|
console.log('getArticle', this.$route)
|
||||||
if (this.$route.params.id) {
|
if (this.$route.params.id) {
|
||||||
// we come from internal link with vuejs
|
// we come from internal link with vuejs
|
||||||
// using path to load from route is hasardous
|
// using path to load from route is hasardous
|
||||||
// this.path = this.$route.path
|
// this.path = this.$route.path
|
||||||
this.id = this.$route.params.id
|
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
|
// we landed in an internal page
|
||||||
// get the id from drupalDeclouped, provided by materio_decoupled.module
|
// get the id from drupalDeclouped, provided by materio_decoupled.module
|
||||||
this.id = drupalDecoupled.entity_id
|
this.id = drupalDecoupled.entity_id
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.id){
|
if (this.id) {
|
||||||
this.loadArticle()
|
this.loadArticle()
|
||||||
}else{
|
} else {
|
||||||
// if for any reason we dont have the id redirect to home
|
// if for any reason we dont have the id redirect to home
|
||||||
this.$router.replace({name:'home'})
|
this.$router.replace({name:'home'})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getIndex(){
|
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.getItemIndex(this.article.id).then((index) => {
|
||||||
this.index = index
|
this.index = index
|
||||||
console.log('article index', index, this);
|
console.log('article index', index, this)
|
||||||
this.getPrevNextItems(index).then((pn) => {
|
this.getPrevNextItems(index).then((pn) => {
|
||||||
this.prevnext = pn
|
this.prevnext = pn
|
||||||
})
|
})
|
||||||
|
@ -202,17 +202,17 @@ export default {
|
||||||
console.log('loadArticle')
|
console.log('loadArticle')
|
||||||
this.loading = true
|
this.loading = true
|
||||||
|
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
article(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
|
article(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
|
||||||
...ArticleFields
|
...ArticleFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ articleFields }
|
${articleFields}
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast)
|
MGQ.post('', { query: print(ast)
|
||||||
})
|
})
|
||||||
.then(({ data:{data:{article}}}) => {
|
.then(({ data:{data:{article}}}) => {
|
||||||
console.log('loadArticle', article )
|
console.log('loadArticle', article)
|
||||||
this.parseDataGQL(article)
|
this.parseDataGQL(article)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -225,13 +225,13 @@ export default {
|
||||||
this.article = article
|
this.article = article
|
||||||
|
|
||||||
// get the prev next items
|
// get the prev next items
|
||||||
if(!this.items.length){
|
if (!this.items.length) {
|
||||||
// if items list not yet loaded preload them
|
// if items list not yet loaded preload them
|
||||||
this.getItems().then(() => {
|
this.getItems().then(() => {
|
||||||
// then get the index
|
// then get the index
|
||||||
this.getIndex()
|
this.getIndex()
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
// or directly get the index
|
// or directly get the index
|
||||||
this.getIndex()
|
this.getIndex()
|
||||||
}
|
}
|
||||||
|
@ -241,17 +241,17 @@ export default {
|
||||||
this.lightbox_items = [];
|
this.lightbox_items = [];
|
||||||
|
|
||||||
// fill the lightbox
|
// 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
|
article.images[i].thumb = article.images[i].style_articlecardmedium.url
|
||||||
this.lightbox_items.push(article.images[i]);
|
this.lightbox_items.push(article.images[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse embeded videos pushing it in lightbox
|
// 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 videoUrl = article.videos[i].url
|
||||||
let provider_regex = /https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/;
|
let provider_regex = /https:\/\/(www\.)?(?<provider>youtube|vimeo)\.com\/.+/;
|
||||||
let match = provider_regex.exec(videoUrl)
|
let match = provider_regex.exec(videoUrl)
|
||||||
// console.log('provider', match.groups.provider);
|
// console.log('provider', match.groups.provider)
|
||||||
let video_id = null;
|
let video_id = null;
|
||||||
let video_thumb = null;
|
let video_thumb = null;
|
||||||
switch (match.groups.provider) {
|
switch (match.groups.provider) {
|
||||||
|
@ -260,14 +260,14 @@ export default {
|
||||||
video_id = vimeo_regex.exec(videoUrl).groups.id || null;
|
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
|
// 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"
|
video_thumb = "http://blogpeda.ac-poitiers.fr/ent-lyc/files/2015/06/Vimeo_icon_block.png"
|
||||||
break;
|
break
|
||||||
case 'youtube':
|
case 'youtube':
|
||||||
let youtube_regex = /https:\/\/(www\.)?youtube\.com\/watch\?v=(?<id>.+)/;
|
let youtube_regex = /https:\/\/(www\.)?youtube\.com\/watch\?v=(?<id>.+)/;
|
||||||
video_id = youtube_regex.exec(videoUrl).groups.id || null;
|
video_id = youtube_regex.exec(videoUrl).groups.id || null;
|
||||||
video_thumb = "http://img.youtube.com/vi/"+video_id+"/0.jpg"
|
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({
|
this.lightbox_items.push({
|
||||||
url: videoUrl,
|
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
|
// update main page title
|
||||||
this.$store.commit('Common/setPagetitle', article.title)
|
this.$store.commit('Common/setPagetitle', article.title)
|
||||||
|
@ -285,9 +285,9 @@ export default {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
onPrevNext(pn){
|
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, '')
|
let alias = pn.view_node.replace(/^\/\D{2,3}\/blabla\//g, '')
|
||||||
console.log('alias', alias);
|
console.log('alias', alias)
|
||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name:`article`,
|
name:`article`,
|
||||||
|
|
|
@ -57,20 +57,20 @@ export default {
|
||||||
nextPage: 'Search/nextPage'
|
nextPage: 'Search/nextPage'
|
||||||
}),
|
}),
|
||||||
// infiniteHandler($state){
|
// infiniteHandler($state){
|
||||||
// console.log('inifiniteHandler', $state);
|
// console.log('inifiniteHandler', $state)
|
||||||
// this.nextPage()
|
// this.nextPage()
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// at first page load or first route entering launch a search if params exists in url query
|
// 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)
|
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/setKeys', params.get('keys'))
|
||||||
this.$store.commit('Search/setTerm', params.get('term'))
|
this.$store.commit('Search/setTerm', params.get('term'))
|
||||||
this.pagetitle = params.get('keys')
|
this.pagetitle = params.get('keys')
|
||||||
this.newSearch()
|
this.newSearch()
|
||||||
}else{
|
} else {
|
||||||
// load default base page
|
// load default base page
|
||||||
this.$store.commit('Search/setKeys', '')
|
this.$store.commit('Search/setKeys', '')
|
||||||
this.$store.commit('Search/setTerm', '')
|
this.$store.commit('Search/setTerm', '')
|
||||||
|
@ -80,7 +80,7 @@ export default {
|
||||||
},
|
},
|
||||||
beforeRouteUpdate (to, from, next) {
|
beforeRouteUpdate (to, from, next) {
|
||||||
// when query change launch a new search
|
// 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/setKeys', to.query.keys)
|
||||||
this.$store.commit('Search/setTerm', to.query.term)
|
this.$store.commit('Search/setTerm', to.query.term)
|
||||||
this.pagetitle = to.query.keys
|
this.pagetitle = to.query.keys
|
||||||
|
|
|
@ -17,17 +17,17 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log('Home beforeMount');
|
// console.log('Home beforeMount')
|
||||||
// compile the html src (coming from parent with props or from ajax call)
|
// compile the html src (coming from parent with props or from ajax call)
|
||||||
if(this.html){
|
if (this.html) {
|
||||||
// console.log('html', this.html);
|
// console.log('html', this.html)
|
||||||
this.compileTemplate()
|
this.compileTemplate()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
if(!this.template){
|
if (!this.template) {
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
return this.template.render.call(this)
|
return this.template.render.call(this)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -43,19 +43,19 @@ export default {
|
||||||
setTimeout(this.initShowroomCarroussel.bind(this), 250)
|
setTimeout(this.initShowroomCarroussel.bind(this), 250)
|
||||||
},
|
},
|
||||||
initShowroomCarroussel(){
|
initShowroomCarroussel(){
|
||||||
console.log("startShowroomCarroussel");
|
console.log('startShowroomCarroussel')
|
||||||
this.showrooms = document.querySelectorAll('.field--name-computed-showrooms-reference > .field__item')
|
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) {
|
if (i%2 === 0) {
|
||||||
this.showroomsOdd.push(this.showrooms[i])
|
this.showroomsOdd.push(this.showrooms[i])
|
||||||
}else{
|
} else {
|
||||||
this.showroomsEven.push(this.showrooms[i])
|
this.showroomsEven.push(this.showrooms[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('Odd', this.showroomsOdd);
|
console.log('Odd', this.showroomsOdd)
|
||||||
console.log('Even', this.showroomsEven);
|
console.log('Even', this.showroomsEven)
|
||||||
|
|
||||||
// TODO: share media query and variables between scss and js
|
// TODO: share media query and variables between scss and js
|
||||||
let column_width= 205
|
let column_width= 205
|
||||||
|
@ -67,7 +67,7 @@ export default {
|
||||||
this.checkShowroomMode(mediaQuery)
|
this.checkShowroomMode(mediaQuery)
|
||||||
|
|
||||||
// this.showroomInterval = setInterval(this.switchShowroomCarroussel.bind(this), 5000);
|
// this.showroomInterval = setInterval(this.switchShowroomCarroussel.bind(this), 5000);
|
||||||
// console.log('this.showroomInterval', this.showroomInterval);
|
// console.log('this.showroomInterval', this.showroomInterval)
|
||||||
// this.switchShowroomCarroussel()
|
// this.switchShowroomCarroussel()
|
||||||
},
|
},
|
||||||
checkShowroomMode(mq){
|
checkShowroomMode(mq){
|
||||||
|
@ -80,7 +80,7 @@ export default {
|
||||||
if(newmode !== this.showroomMode) {
|
if(newmode !== this.showroomMode) {
|
||||||
// if new mode different from old mode
|
// if new mode different from old mode
|
||||||
// reset sowrooms classes
|
// 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')
|
this.showrooms[i].classList.remove('active')
|
||||||
}
|
}
|
||||||
// record new mode
|
// record new mode
|
||||||
|
@ -96,16 +96,16 @@ export default {
|
||||||
}
|
}
|
||||||
// in any case (re)launch the animation
|
// in any case (re)launch the animation
|
||||||
this.showroomInterval = setInterval(this.switchShowroomCarroussel.bind(this), 15000);
|
this.showroomInterval = setInterval(this.switchShowroomCarroussel.bind(this), 15000);
|
||||||
console.log('this.showroomInterval', this.showroomInterval);
|
console.log('this.showroomInterval', this.showroomInterval)
|
||||||
this.switchShowroomCarroussel()
|
this.switchShowroomCarroussel()
|
||||||
},
|
},
|
||||||
switchShowroomCarroussel(){
|
switchShowroomCarroussel(){
|
||||||
// console.log('switchShowroomCarroussel i', $elmts, i);
|
// console.log('switchShowroomCarroussel i', $elmts, i)
|
||||||
if (this.showroomMode === 1) {
|
if (this.showroomMode === 1) {
|
||||||
this.showrooms[this.showroomI].classList.add('active')
|
this.showrooms[this.showroomI].classList.add('active')
|
||||||
this.showrooms[this.showroomI-1 < 0 ? this.showrooms.length -1 : this.showroomI-1].classList.remove('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
|
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].classList.add('active')
|
||||||
this.showroomsOdd[this.showroomI-1 < 0 ? this.showroomsOdd.length -1 : this.showroomI-1].classList.remove('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
|
this.showroomI = this.showroomI+1 >= this.showroomsOdd.length ? 0 : this.showroomI+1
|
||||||
|
@ -117,15 +117,15 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClickLink(e){
|
onClickLink(e){
|
||||||
console.log("onClickLink", e, this.$router, this.$route);
|
console.log("onClickLink", e, this.$router, this.$route)
|
||||||
let path = null;
|
let path = null;
|
||||||
// find existing router route compared with link href
|
// 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 (this.$router.options.routes[i].path == e.originalTarget.pathname) {
|
||||||
if (e.originalTarget.pathname !== this.$route.path) {
|
if (e.originalTarget.pathname !== this.$route.path) {
|
||||||
path = e.originalTarget.pathname
|
path = e.originalTarget.pathname
|
||||||
}
|
}
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onClickFieldLabel(e){
|
onClickFieldLabel(e){
|
||||||
console.log("onClickFieldLabel", e, this.$router, this.$route);
|
console.log("onClickFieldLabel", e, this.$router, this.$route)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
|
@ -75,21 +75,21 @@ export default {
|
||||||
// getPrevNextItems: 'Blabla/getPrevNextItems'
|
// getPrevNextItems: 'Blabla/getPrevNextItems'
|
||||||
// }),
|
// }),
|
||||||
getThematique(){
|
getThematique(){
|
||||||
console.log('getThematique', this.$route);
|
console.log('getThematique', this.$route)
|
||||||
if (this.$route.params.id) {
|
if (this.$route.params.id) {
|
||||||
// we come from internal link with vuejs
|
// we come from internal link with vuejs
|
||||||
// using path to load from route is hasardous
|
// using path to load from route is hasardous
|
||||||
// this.path = this.$route.path
|
// this.path = this.$route.path
|
||||||
this.id = this.$route.params.id
|
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
|
// we landed in an internal page
|
||||||
// get the id from drupalDeclouped, provided by materio_decoupled.module
|
// get the id from drupalDeclouped, provided by materio_decoupled.module
|
||||||
this.id = drupalDecoupled.entity_id
|
this.id = drupalDecoupled.entity_id
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.id){
|
if (this.id) {
|
||||||
this.loadThematique()
|
this.loadThematique()
|
||||||
}else{
|
} else {
|
||||||
// if for any reason we dont have the id redirect to home
|
// if for any reason we dont have the id redirect to home
|
||||||
this.$router.replace({name:'home'})
|
this.$router.replace({name:'home'})
|
||||||
}
|
}
|
||||||
|
@ -98,12 +98,12 @@ export default {
|
||||||
console.log('loadThematique')
|
console.log('loadThematique')
|
||||||
this.loading = true
|
this.loading = true
|
||||||
//
|
//
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
thematique(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
|
thematique(id: ${this.id}, lang: "${drupalDecoupled.lang_code}") {
|
||||||
...ThematiqueFields
|
...ThematiqueFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ thematiqueFields }
|
${thematiqueFields}
|
||||||
`
|
`
|
||||||
// ?XDEBUG_SESSION_START=1
|
// ?XDEBUG_SESSION_START=1
|
||||||
MGQ.post('', { query: print(ast)
|
MGQ.post('', { query: print(ast)
|
||||||
|
@ -129,7 +129,7 @@ export default {
|
||||||
// update main page title
|
// update main page title
|
||||||
this.$store.commit('Common/setPagetitle', thematique.title)
|
this.$store.commit('Common/setPagetitle', thematique.title)
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
console.warn('Thematique not loaded');
|
console.warn('Thematique not loaded');
|
||||||
}
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
|
|
@ -10,10 +10,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
// console.log('Home beforeMount');
|
// console.log('Home beforeMount')
|
||||||
// compile the html src (coming from parent with props or from ajax call)
|
// compile the html src (coming from parent with props or from ajax call)
|
||||||
if(this.html){
|
if (this.html) {
|
||||||
console.log('html', this.html);
|
console.log('html', this.html)
|
||||||
this.template = Vue.compile(this.html)
|
this.template = Vue.compile(this.html)
|
||||||
this.$options.staticRenderFns = []
|
this.$options.staticRenderFns = []
|
||||||
this._staticTrees = []
|
this._staticTrees = []
|
||||||
|
@ -21,9 +21,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
if(!this.template){
|
if (!this.template) {
|
||||||
return h('span', 'Loading ...')
|
return h('span', 'Loading ...')
|
||||||
}else{
|
} else {
|
||||||
return this.template.render.call(this)
|
return this.template.render.call(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default {
|
||||||
},
|
},
|
||||||
// watch: {
|
// watch: {
|
||||||
// flagcolls (newv, oldv) {
|
// flagcolls (newv, oldv) {
|
||||||
// console.log('watching flagcolls');
|
// console.log('watching flagcolls')
|
||||||
// if( typeof this.flagcolls[this.collection.id].loadedItems !== 'undefined' ) {
|
// if( typeof this.flagcolls[this.collection.id].loadedItems !== 'undefined' ) {
|
||||||
// this.loadedItems = this.flagcolls[this.collection.id].loadedItems
|
// this.loadedItems = this.flagcolls[this.collection.id].loadedItems
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -81,23 +81,23 @@ export default {
|
||||||
this.is_creating_folder = true;
|
this.is_creating_folder = true;
|
||||||
this.createFlagColl(this.new_folder_name)
|
this.createFlagColl(this.new_folder_name)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("onCreateFlagColl then", data);
|
console.log("onCreateFlagColl then", data)
|
||||||
this.new_folder_name = "";
|
this.new_folder_name = "";
|
||||||
this.is_creating_folder = false;
|
this.is_creating_folder = false;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onDeleteFlagColl (e) {
|
onDeleteFlagColl (e) {
|
||||||
const flagcollid = e.target.getAttribute('flagcollid');
|
const flagcollid = e.target.getAttribute('flagcollid');
|
||||||
console.log("UserFlags onDeleteFlagColl", flagcollid);
|
console.log("UserFlags onDeleteFlagColl", flagcollid)
|
||||||
this.is_deleting_folder = flagcollid;
|
this.is_deleting_folder = flagcollid;
|
||||||
// TODO: confirm suppression
|
// TODO: confirm suppression
|
||||||
this.confirmDeleteFlagColl(flagcollid)
|
this.confirmDeleteFlagColl(flagcollid)
|
||||||
},
|
},
|
||||||
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)
|
// const index = this.flagcolls.findIndex(i => i.id === flagcollid)
|
||||||
let coll = this.flagcolls[flagcollid]
|
let coll = this.flagcolls[flagcollid]
|
||||||
// console.log("coll to delete", coll);
|
// console.log("coll to delete", coll)
|
||||||
this.$modal.show('dialog',
|
this.$modal.show('dialog',
|
||||||
{ // component props
|
{ // component props
|
||||||
title: this.$t("materio.Folder delete"),
|
title: this.$t("materio.Folder delete"),
|
||||||
|
@ -114,10 +114,10 @@ export default {
|
||||||
{
|
{
|
||||||
title: this.$t('default.Delete'),
|
title: this.$t('default.Delete'),
|
||||||
handler: () => {
|
handler: () => {
|
||||||
// console.log('deletion confirmed', flagcollid);
|
// console.log('deletion confirmed', flagcollid)
|
||||||
this.deleteFlagColl(flagcollid)
|
this.deleteFlagColl(flagcollid)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// console.log("onDeleteFlagColl then", data);
|
// console.log("onDeleteFlagColl then", data)
|
||||||
// this.is_deleting_folder = false;
|
// this.is_deleting_folder = false;
|
||||||
this.$modal.hide('dialog')
|
this.$modal.hide('dialog')
|
||||||
})
|
})
|
||||||
|
@ -136,11 +136,11 @@ export default {
|
||||||
},
|
},
|
||||||
onOpenFlagColl (flagcollid) {
|
onOpenFlagColl (flagcollid) {
|
||||||
// const flagcollid = e.target.getAttribute('flagcollid');
|
// const flagcollid = e.target.getAttribute('flagcollid');
|
||||||
console.log("UserFlags onOpenFlagColl", flagcollid);
|
console.log("UserFlags onOpenFlagColl", flagcollid)
|
||||||
this.openCloseHamMenu(false)
|
this.openCloseHamMenu(false)
|
||||||
this.openFlagColl(flagcollid)
|
this.openFlagColl(flagcollid)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// console.log("onDeleteFlagColl then", data);
|
// console.log("onDeleteFlagColl then", data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default {
|
||||||
userLogout: 'User/userLogout'
|
userLogout: 'User/userLogout'
|
||||||
}),
|
}),
|
||||||
onLogout () {
|
onLogout () {
|
||||||
console.log("UserTools onLogout")
|
console.log('UserTools onLogout')
|
||||||
this.userLogout()
|
this.userLogout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
export default {
|
export default {
|
||||||
directives: {
|
directives: {
|
||||||
lazy: {
|
lazy: {
|
||||||
bind(img,binding){
|
bind (img, binding) {
|
||||||
// console.log('lazy bind', img, binding);
|
// console.log('lazy bind', img, binding)
|
||||||
// show only the first image
|
// show only the first image
|
||||||
if(binding.value === 0){
|
if (binding.value === 0) {
|
||||||
img.setAttribute('src', img.getAttribute('data-src'))
|
img.setAttribute('src', img.getAttribute('data-src'))
|
||||||
img.removeAttribute('data-src')
|
img.removeAttribute('data-src')
|
||||||
img.classList.remove('lazy')
|
img.classList.remove('lazy')
|
||||||
|
@ -13,63 +13,63 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
switcher: {
|
switcher: {
|
||||||
inserted(el,binding){
|
inserted (el, binding) {
|
||||||
// switch images on mousemove
|
// switch images on mousemove
|
||||||
el.addEventListener('mousemove', function(event) {
|
el.addEventListener('mousemove', function (event) {
|
||||||
let figs = this.querySelectorAll('figure')
|
const figs = this.querySelectorAll('figure')
|
||||||
// console.log('mousemove', this, event, figs.length);
|
// console.log('mousemove', this, event, figs.length)
|
||||||
// let len = figs.length
|
// let len = figs.length
|
||||||
// let w = this.clientWidth;
|
// let w = this.clientWidth;
|
||||||
// let g = w / len;
|
// let g = w / len;
|
||||||
// let delta = Math.floor(event.layerX / g)
|
// let delta = Math.floor(event.layerX / g)
|
||||||
let delta = Math.floor(event.layerX / (this.clientWidth / figs.length))
|
const delta = Math.floor(event.layerX / (this.clientWidth / figs.length))
|
||||||
// console.log('delta', delta);
|
// console.log('delta', delta)
|
||||||
figs.forEach((fig, index) => {
|
figs.forEach((fig, index) => {
|
||||||
// console.log(index);
|
// console.log(index)
|
||||||
if(index == delta){
|
if (index === delta) {
|
||||||
// fig.style.display = "block"
|
// fig.style.display = "block"
|
||||||
fig.classList.remove("hide")
|
fig.classList.remove('hide')
|
||||||
fig.classList.add("show")
|
fig.classList.add('show')
|
||||||
}else{
|
} else {
|
||||||
// fig.style.display = "none"
|
// fig.style.display = "none"
|
||||||
fig.classList.remove("show")
|
fig.classList.remove('show')
|
||||||
fig.classList.add("hide")
|
fig.classList.add('hide')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted () {
|
||||||
// lazy load images on mouseover
|
// lazy load images on mouseover
|
||||||
console.log('card mounted', this.$options.name);
|
console.log('card mounted', this.$options.name)
|
||||||
// if (this.$options.name ==! 'ModalCard') {
|
// if (this.$options.name ==! 'ModalCard') {
|
||||||
this.$el.addEventListener('mouseover', function(event) {
|
this.$el.addEventListener('mouseover', function (event) {
|
||||||
let imgs = this.querySelectorAll('.images figure img.lazy')
|
const imgs = this.querySelectorAll('.images figure img.lazy')
|
||||||
console.log('mousemove', this, imgs);
|
console.log('mousemove', this, imgs)
|
||||||
imgs.forEach((img) => {
|
imgs.forEach((img) => {
|
||||||
// console.log('forEach img',img);
|
// console.log('forEach img',img)
|
||||||
img.setAttribute('src', img.getAttribute('data-src'))
|
img.setAttribute('src', img.getAttribute('data-src'))
|
||||||
img.removeAttribute('data-src')
|
img.removeAttribute('data-src')
|
||||||
img.classList.remove('lazy')
|
img.classList.remove('lazy')
|
||||||
})
|
})
|
||||||
}, {once : true})
|
}, { once: true })
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
activateLazyLoad () {
|
activateLazyLoad () {
|
||||||
console.log('card activateLazyLoad', this.$options.name);
|
console.log('card activateLazyLoad', this.$options.name)
|
||||||
|
|
||||||
this.$el.addEventListener('mousemove', function(event) {
|
this.$el.addEventListener('mousemove', function (event) {
|
||||||
let imgs = this.querySelectorAll('.images figure img.lazy')
|
const imgs = this.querySelectorAll('.images figure img.lazy')
|
||||||
console.log('mousemove', this, imgs);
|
console.log('mousemove', this, imgs)
|
||||||
imgs.forEach((img) => {
|
imgs.forEach((img) => {
|
||||||
// console.log('forEach img',img);
|
// console.log('forEach img',img)
|
||||||
img.setAttribute('src', img.getAttribute('data-src'))
|
img.setAttribute('src', img.getAttribute('data-src'))
|
||||||
img.removeAttribute('data-src')
|
img.removeAttribute('data-src')
|
||||||
img.classList.remove('lazy')
|
img.classList.remove('lazy')
|
||||||
})
|
})
|
||||||
}, {once : true})
|
}, { once: true })
|
||||||
}
|
}
|
||||||
// deg2rad (deg) {
|
// deg2rad (deg) {
|
||||||
// return deg * (Math.PI / 180)
|
// return deg * (Math.PI / 180)
|
||||||
|
|
|
@ -17,7 +17,7 @@ Vue.use(VueRouter)
|
||||||
// We could use aliases to never reload the page on language changement
|
// 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
|
// BUT beforeupdate is not triggered when push alias instead of path or name
|
||||||
// const languages = ['en', 'fr'];
|
// 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
|
const basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import Blabla from './modules/blabla'
|
||||||
import Showrooms from './modules/showrooms'
|
import Showrooms from './modules/showrooms'
|
||||||
import Pages from './modules/pages'
|
import Pages from './modules/pages'
|
||||||
|
|
||||||
|
|
||||||
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
|
// https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
@ -38,16 +37,16 @@ export default createStore(Vuex.Store, {
|
||||||
loadMaterialsGQL ({ dispatch }, { ids, gqlfragment, callBack, callBackArgs }) {
|
loadMaterialsGQL ({ dispatch }, { ids, gqlfragment, callBack, callBackArgs }) {
|
||||||
console.log('loadMaterialsGQL ids', ids)
|
console.log('loadMaterialsGQL ids', ids)
|
||||||
|
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
materiaux(ids: [${ids}]) {
|
materiaux(ids: [${ids}]) {
|
||||||
...MateriauFields
|
...MateriauFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ gqlfragment }
|
${gqlfragment}
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast) })
|
MGQ.post('', { query: print(ast) })
|
||||||
.then(( resp ) => {
|
.then((resp) => {
|
||||||
console.log('loadMaterialsGQL resp', resp )
|
console.log('loadMaterialsGQL resp', resp)
|
||||||
// dispatch('parseMaterialsGQL', {
|
// dispatch('parseMaterialsGQL', {
|
||||||
// items: resp.data.data.materiaux,
|
// items: resp.data.data.materiaux,
|
||||||
// callBack: callBack,
|
// callBack: callBack,
|
||||||
|
@ -79,7 +78,7 @@ export default createStore(Vuex.Store, {
|
||||||
// params[`filter[${uuid}][condition][operator]`] = '='
|
// params[`filter[${uuid}][condition][operator]`] = '='
|
||||||
// params[`filter[${uuid}][condition][memberOf]`] = 'uuids-groupe'
|
// params[`filter[${uuid}][condition][memberOf]`] = 'uuids-groupe'
|
||||||
// }
|
// }
|
||||||
// // console.log('search JSONAPI params', params);
|
// // console.log('search JSONAPI params', params)
|
||||||
// const q = qs.stringify(params)
|
// const q = qs.stringify(params)
|
||||||
// return JSONAPI.get('node/materiau?' + q)
|
// return JSONAPI.get('node/materiau?' + q)
|
||||||
// .then(({ data }) => {
|
// .then(({ data }) => {
|
||||||
|
@ -98,12 +97,12 @@ export default createStore(Vuex.Store, {
|
||||||
// // so we loop from uuids to conserve the original order
|
// // so we loop from uuids to conserve the original order
|
||||||
// console.log('mixin parseMaterials', data, uuids, callBack, callBackArgs)
|
// console.log('mixin parseMaterials', data, uuids, callBack, callBackArgs)
|
||||||
// const items = []
|
// 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++) {
|
// for (let i = 0; i < uuids.length; i++) {
|
||||||
// const uuid = uuids[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
|
// // 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)
|
// 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
|
// if (item_index === -1) continue
|
||||||
//
|
//
|
||||||
// const item_src = data[item_index]
|
// const item_src = data[item_index]
|
||||||
|
@ -121,14 +120,14 @@ export default createStore(Vuex.Store, {
|
||||||
//
|
//
|
||||||
// // get images included values
|
// // get images included values
|
||||||
// const img_src = relations.images.data
|
// 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
|
// // this is a temporary deactivation of images
|
||||||
// // img_src = [];
|
// // img_src = [];
|
||||||
// item.images = []
|
// item.images = []
|
||||||
// for (let j = 0; j < img_src.length; j++) {
|
// for (let j = 0; j < img_src.length; j++) {
|
||||||
// if (img_src[j].meta.imageDerivatives) {
|
// if (img_src[j].meta.imageDerivatives) {
|
||||||
// let img_styles = {}
|
// 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
|
// img_styles[imgStyle[k]] = img_src[j].meta.imageDerivatives.links.[imgStyle[k]].href
|
||||||
// }
|
// }
|
||||||
// item.images.push({
|
// item.images.push({
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default {
|
||||||
console.log('blabla REST: data', data)
|
console.log('blabla REST: data', data)
|
||||||
if (data.length) {
|
if (data.length) {
|
||||||
commit('setItems', data)
|
commit('setItems', data)
|
||||||
// console.log('items.length', this.items.length);
|
// console.log('items.length', this.items.length)
|
||||||
if (state.infiniteLoadingState) { state.infiniteLoadingState.loaded() }
|
if (state.infiniteLoadingState) { state.infiniteLoadingState.loaded() }
|
||||||
} else {
|
} else {
|
||||||
if (state.infiniteLoadingState) { state.infiniteLoadingState.complete() }
|
if (state.infiniteLoadingState) { state.infiniteLoadingState.complete() }
|
||||||
|
@ -60,8 +60,8 @@ export default {
|
||||||
getItemIndex ({ dispatch, commit, state }, nid) {
|
getItemIndex ({ dispatch, commit, state }, nid) {
|
||||||
console.log('getItemIndex nid', nid)
|
console.log('getItemIndex nid', nid)
|
||||||
return state.items.findIndex((e) => {
|
return state.items.findIndex((e) => {
|
||||||
console.log('findIndex', e.nid, nid);
|
console.log('findIndex', e.nid, nid)
|
||||||
return e.nid == nid
|
return e.nid === nid
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPrevNextItems ({ dispatch, commit, state }, index) {
|
getPrevNextItems ({ dispatch, commit, state }, index) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default {
|
||||||
console.log('Common, setPagetitle', title)
|
console.log('Common, setPagetitle', title)
|
||||||
state.pagetitle = title
|
state.pagetitle = title
|
||||||
},
|
},
|
||||||
setHamMenuState (state, s){
|
setHamMenuState (state, s) {
|
||||||
state.hamburgerMenuToggle.checked = s
|
state.hamburgerMenuToggle.checked = s
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,15 +29,15 @@ export default {
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
actions: {
|
actions: {
|
||||||
getProducts({ dispatch, commit, state }) {
|
getProducts ({ dispatch, commit, state }) {
|
||||||
dispatch('loadProductsIds')
|
dispatch('loadProductsIds')
|
||||||
},
|
},
|
||||||
loadProductsIds({ dispatch, commit, state }) {
|
loadProductsIds ({ dispatch, commit, state }) {
|
||||||
REST.get('/pricing_rest?_format=json', {})
|
REST.get('/pricing_rest?_format=json', {})
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('getProducts REST: data', data)
|
console.log('getProducts REST: data', data)
|
||||||
let ids = [];
|
const ids = []
|
||||||
for (var i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
ids.push(data[i].product_id)
|
ids.push(data[i].product_id)
|
||||||
}
|
}
|
||||||
commit('setProductsIds', ids)
|
commit('setProductsIds', ids)
|
||||||
|
@ -48,17 +48,17 @@ export default {
|
||||||
Promise.reject(error)
|
Promise.reject(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadProducts({ dispatch, commit, state }) {
|
loadProducts ({ dispatch, commit, state }) {
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
products(ids: [${state.products_ids}]) {
|
products(ids: [${state.products_ids}]) {
|
||||||
...ProductsFields
|
...ProductsFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ productsGQL }
|
${productsGQL}
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast) })
|
MGQ.post('', { query: print(ast) })
|
||||||
.then(( resp ) => {
|
.then((resp) => {
|
||||||
console.log('loadProductsGQL resp', resp )
|
console.log('loadProductsGQL resp', resp)
|
||||||
commit('setProducts', resp.data.data.products)
|
commit('setProducts', resp.data.data.products)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|
|
@ -41,11 +41,11 @@ export default {
|
||||||
state.uuids = []
|
state.uuids = []
|
||||||
},
|
},
|
||||||
setResults (state, items) {
|
setResults (state, items) {
|
||||||
// console.log('setResults, items', items);
|
// console.log('setResults, items', items)
|
||||||
if(items){ // avoid bug like items = [null]
|
if (items) { // avoid bug like items = [null]
|
||||||
state.items = state.items.concat(items)
|
state.items = state.items.concat(items)
|
||||||
}
|
}
|
||||||
// console.log('setResults, state.items', state.items);
|
// console.log('setResults, state.items', state.items)
|
||||||
},
|
},
|
||||||
updateItem (state, item) {
|
updateItem (state, item) {
|
||||||
// state.items[data.index] = data.item // this is not triggering vuejs refresh
|
// state.items[data.index] = data.item // this is not triggering vuejs refresh
|
||||||
|
@ -101,9 +101,9 @@ export default {
|
||||||
commit('resetCount')
|
commit('resetCount')
|
||||||
commit('resetNoresults')
|
commit('resetNoresults')
|
||||||
commit('resetOffset')
|
commit('resetOffset')
|
||||||
if(state.keys || state.term){
|
if (state.keys || state.term) {
|
||||||
this.commit('Common/setPagetitle', state.keys)
|
this.commit('Common/setPagetitle', state.keys)
|
||||||
}else{
|
} else {
|
||||||
this.commit('Common/setPagetitle', 'Base')
|
this.commit('Common/setPagetitle', 'Base')
|
||||||
}
|
}
|
||||||
dispatch('getResults')
|
dispatch('getResults')
|
||||||
|
@ -121,7 +121,7 @@ export default {
|
||||||
offset: state.offset,
|
offset: state.offset,
|
||||||
limit: state.limit
|
limit: state.limit
|
||||||
}
|
}
|
||||||
// console.log('Search getResults params', params);
|
// console.log('Search getResults params', params)
|
||||||
const q = qs.stringify(params)
|
const q = qs.stringify(params)
|
||||||
return MA.get('/materio_sapi/getresults?' + q)
|
return MA.get('/materio_sapi/getresults?' + q)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
|
@ -138,17 +138,17 @@ export default {
|
||||||
// gqlfragment: materiauGQL,
|
// gqlfragment: materiauGQL,
|
||||||
// callBack: 'loadSearchResultsCallBack'
|
// callBack: 'loadSearchResultsCallBack'
|
||||||
// })
|
// })
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
searchresults(ids: [${data.nids}], lang: "${drupalDecoupled.lang_code}") {
|
searchresults(ids: [${data.nids}], lang: "${drupalDecoupled.lang_code}") {
|
||||||
...SearchResultFields
|
...SearchResultFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ searchresultGQL }
|
${searchresultGQL}
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast) })
|
MGQ.post('', { query: print(ast) })
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
console.log('loadSearchResultsGQL resp', resp )
|
console.log('loadSearchResultsGQL resp', resp)
|
||||||
dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
|
dispatch('loadSearchResultsCallBack', { items: resp.data.data.searchresults })
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Issue with loadSearchResults', error)
|
console.warn('Issue with loadSearchResults', error)
|
||||||
|
@ -178,20 +178,20 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refreshItem({ commit, state }, { id }) {
|
refreshItem ({ commit, state }, { id }) {
|
||||||
console.log("Search refreshItem: id", id);
|
console.log('Search refreshItem: id', id)
|
||||||
let ast = gql`{
|
const ast = gql`{
|
||||||
searchresult(id: ${id}, lang: "${drupalDecoupled.lang_code}") {
|
searchresult(id: ${id}, lang: "${drupalDecoupled.lang_code}") {
|
||||||
...SearchResultFields
|
...SearchResultFields
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ searchresultGQL }
|
${searchresultGQL}
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast) })
|
MGQ.post('', { query: print(ast) })
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
console.log('refreshItem searchresult resp', resp )
|
console.log('refreshItem searchresult resp', resp)
|
||||||
// dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
|
// dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
|
||||||
commit("updateItem", resp.data.data.searchresult)
|
commit('updateItem', resp.data.data.searchresult)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Issue with refreshItem', error)
|
console.warn('Issue with refreshItem', error)
|
||||||
|
|
|
@ -49,11 +49,11 @@ export default {
|
||||||
state.logout_token = data.logout_token
|
state.logout_token = data.logout_token
|
||||||
},
|
},
|
||||||
setLoginMessage (state, message) {
|
setLoginMessage (state, message) {
|
||||||
console.log('setLoginMessage', message);
|
console.log('setLoginMessage', message)
|
||||||
state.loginMessage = message
|
state.loginMessage = message
|
||||||
},
|
},
|
||||||
setRegisterMessage (state, message) {
|
setRegisterMessage (state, message) {
|
||||||
console.log('setRegisterMessage', message);
|
console.log('setRegisterMessage', message)
|
||||||
state.registerMessage = message
|
state.registerMessage = message
|
||||||
},
|
},
|
||||||
setUid (state, uid) {
|
setUid (state, uid) {
|
||||||
|
@ -75,12 +75,12 @@ export default {
|
||||||
state.roles.indexOf('admin') !== -1 ||
|
state.roles.indexOf('admin') !== -1 ||
|
||||||
state.roles.indexOf('root') !== -1
|
state.roles.indexOf('root') !== -1
|
||||||
) {
|
) {
|
||||||
// console.log('is admin');
|
// console.log('is admin')
|
||||||
state.isAdmin = true
|
state.isAdmin = true
|
||||||
}
|
}
|
||||||
// check if has access to search
|
// check if has access to search
|
||||||
if (state.roles.indexOf('adherent') !== -1) {
|
if (state.roles.indexOf('adherent') !== -1) {
|
||||||
// console.log('is admin');
|
// console.log('is admin')
|
||||||
state.canSearch = true
|
state.canSearch = true
|
||||||
state.isAdherent = true
|
state.isAdherent = true
|
||||||
}
|
}
|
||||||
|
@ -140,21 +140,21 @@ export default {
|
||||||
REST.post('/user/register?_format=json', credentials, {
|
REST.post('/user/register?_format=json', credentials, {
|
||||||
'X-CSRF-Token': state.csrftoken,
|
'X-CSRF-Token': state.csrftoken,
|
||||||
validateStatus: function (status) {
|
validateStatus: function (status) {
|
||||||
return status >= 200 && status < 500;
|
return status >= 200 && status < 500
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log('user REST registered', response)
|
console.log('user REST registered', response)
|
||||||
if(response.status === 200){
|
if (response.status === 200) {
|
||||||
dispatch('userLogin', credentials).then(() => {
|
dispatch('userLogin', credentials).then(() => {
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
let message = ''
|
let message = ''
|
||||||
switch (response.status) {
|
switch (response.status) {
|
||||||
case 422:
|
case 422:
|
||||||
message = "email is already registered"
|
message = 'email is already registered'
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
message = response.data.message
|
message = response.data.message
|
||||||
}
|
}
|
||||||
|
@ -168,15 +168,15 @@ export default {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
userLogin ({ dispatch, state }, credentials) {
|
userLogin ({ dispatch, commit, state }, credentials) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
dispatch('getToken', credentials)
|
dispatch('getToken', credentials)
|
||||||
// TODO: catch failed login
|
// TODO: catch failed login
|
||||||
.then(() => {
|
.then((response) => {
|
||||||
// there no response here, check the original getToken method
|
console.log('userLogin dispatch getToken response', response)
|
||||||
// console.log('dispatch getToken response', response);
|
|
||||||
// check if getToken (login) went well
|
if (response.status === 200) {
|
||||||
if(state.isloggedin){
|
commit('setToken', response.data)
|
||||||
dispatch('getUser').then(userdata => {
|
dispatch('getUser').then(userdata => {
|
||||||
console.log('User Loggedin')
|
console.log('User Loggedin')
|
||||||
if (state.isAdmin) {
|
if (state.isAdmin) {
|
||||||
|
@ -184,9 +184,11 @@ export default {
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
|
commit('setLoginMessage', response.data.message)
|
||||||
|
console.warn('Issue with getToken', response)
|
||||||
console.log('user loggein failed')
|
console.log('user loggein failed')
|
||||||
Promise.reject('user loggein failed')
|
Promise.reject(new Error('user loggein failed'))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
@ -200,23 +202,9 @@ export default {
|
||||||
credentials,
|
credentials,
|
||||||
{
|
{
|
||||||
validateStatus: function (status) {
|
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 }) {
|
getUser ({ dispatch, commit, state }) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
@ -248,7 +236,7 @@ export default {
|
||||||
getUserFlagColls ({ dispatch, commit, state }) {
|
getUserFlagColls ({ dispatch, commit, state }) {
|
||||||
// flags
|
// flags
|
||||||
// REST.get('/flagging_collection/1?_format=json')
|
// REST.get('/flagging_collection/1?_format=json')
|
||||||
// .then(( data ) => {
|
// .then((data) => {
|
||||||
// console.log('TEST FLAG REST data', data)
|
// console.log('TEST FLAG REST data', data)
|
||||||
// })
|
// })
|
||||||
// .catch(error => {
|
// .catch(error => {
|
||||||
|
@ -267,11 +255,11 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// https://drupal.stackexchange.com/questions/248539/cant-get-flagging-api-to-accept-post-request
|
// https://drupal.stackexchange.com/questions/248539/cant-get-flagging-api-to-accept-post-request
|
||||||
createFlagColl ({ dispatch, commit, state }, new_collection_name) {
|
createFlagColl ({ dispatch, commit, state }, newCollectionName) {
|
||||||
console.log('user createFlagColl', new_collection_name)
|
console.log('user createFlagColl', newCollectionName)
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const params = {
|
const params = {
|
||||||
name: new_collection_name
|
name: newCollectionName
|
||||||
}
|
}
|
||||||
MA.post('materio_flag/create_user_flagging_collection', params)
|
MA.post('materio_flag/create_user_flagging_collection', params)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
|
@ -321,7 +309,6 @@ export default {
|
||||||
// reload the fulllist of flagcolleciton
|
// reload the fulllist of flagcolleciton
|
||||||
dispatch('getUserFlagColls').then(() => {
|
dispatch('getUserFlagColls').then(() => {
|
||||||
if (state.flagcolls[collid].items.length) {
|
if (state.flagcolls[collid].items.length) {
|
||||||
|
|
||||||
dispatch('loadMaterialsGQL', {
|
dispatch('loadMaterialsGQL', {
|
||||||
ids: state.flagcolls[collid].items,
|
ids: state.flagcolls[collid].items,
|
||||||
gqlfragment: materiauGQL,
|
gqlfragment: materiauGQL,
|
||||||
|
@ -373,7 +360,6 @@ export default {
|
||||||
// callBack: 'loadMaterialsCallBack',
|
// callBack: 'loadMaterialsCallBack',
|
||||||
// callBackArgs: { collid: collid }
|
// callBackArgs: { collid: collid }
|
||||||
// })
|
// })
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// call the mutation without data to only trigger the FlagCollection component update
|
// call the mutation without data to only trigger the FlagCollection component update
|
||||||
console.log('committing setLoadedCollItems without args')
|
console.log('committing setLoadedCollItems without args')
|
||||||
|
@ -399,6 +385,7 @@ export default {
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
console.log('userLogout resp', resp)
|
console.log('userLogout resp', resp)
|
||||||
commit('setLoggedOut')
|
commit('setLoggedOut')
|
||||||
|
// window.location.reload(true) ???
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Issue with logout', error)
|
console.warn('Issue with logout', error)
|
||||||
|
|
Loading…
Reference in New Issue