2020-11-25 22:49:17 +01:00
|
|
|
/* eslint-disable import/first */
|
2019-04-09 00:21:00 +02:00
|
|
|
import Vue from 'vue'
|
2019-05-31 15:01:54 +02:00
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
import InfiniteLoading from 'vue-infinite-loading'
|
2019-06-12 12:16:15 +02:00
|
|
|
Vue.use(InfiniteLoading, {
|
|
|
|
props: {
|
2020-11-25 22:49:17 +01:00
|
|
|
spinner: 'spiral'
|
2019-06-12 12:16:15 +02:00
|
|
|
// slots.noMore: ''
|
2020-11-25 22:49:17 +01:00
|
|
|
}
|
2019-06-12 12:16:15 +02:00
|
|
|
// system: {
|
|
|
|
// throttleLimit: 50,
|
|
|
|
// /* other settings need to configure */
|
|
|
|
// }
|
2020-11-25 22:49:17 +01:00
|
|
|
})
|
2019-06-12 12:16:15 +02:00
|
|
|
|
2020-02-20 12:12:35 +01:00
|
|
|
// import vueVimeoPlayer from 'vue-vimeo-player'
|
|
|
|
// Vue.use(vueVimeoPlayer)
|
|
|
|
// import VueYouTubeEmbed from 'vue-youtube-embed'
|
|
|
|
// Vue.use(VueYouTubeEmbed)
|
2022-02-22 13:43:18 +01:00
|
|
|
// LOADED IN COMPONENT
|
|
|
|
// import CoolLightBox from 'vue-cool-lightbox'
|
|
|
|
// Vue.use(CoolLightBox)
|
2020-02-19 17:59:26 +01:00
|
|
|
|
2020-12-01 23:02:35 +01:00
|
|
|
import VModal from 'vue-js-modal'
|
2021-03-11 19:00:09 +01:00
|
|
|
Vue.use(VModal, { dialog: true })
|
2020-12-01 23:02:35 +01:00
|
|
|
|
2019-06-03 13:06:44 +02:00
|
|
|
import router from 'vuejs/route'
|
2022-03-08 14:30:49 +01:00
|
|
|
import store from 'vuejs/store'
|
2019-05-31 15:01:54 +02:00
|
|
|
|
2020-12-07 23:11:31 +01:00
|
|
|
// import VueI18n from 'vue-i18n'
|
|
|
|
// Vue.use(VueI18n)
|
|
|
|
// import * as Locales from 'assets/i18n/locales.json'
|
2020-12-08 15:26:56 +01:00
|
|
|
import { i18n, loadLanguageAsync } from 'vuejs/i18n'
|
2020-12-07 23:11:31 +01:00
|
|
|
|
2020-12-24 19:05:45 +01:00
|
|
|
import VueMeta from 'vue-meta'
|
|
|
|
Vue.use(VueMeta)
|
|
|
|
|
2021-07-09 11:35:37 +02:00
|
|
|
// LOADED IN COMPONENT
|
2021-04-06 10:42:49 +02:00
|
|
|
// import VueSimpleAccordion from 'vue-simple-accordion'
|
|
|
|
// Vue.use(VueSimpleAccordion, {
|
|
|
|
// // ... Options go here
|
|
|
|
// })
|
|
|
|
// import 'vue-simple-accordion/dist/vue-simple-accordion.css'
|
2021-03-30 15:42:40 +02:00
|
|
|
|
|
|
|
import Vue2TouchEvents from 'vue2-touch-events'
|
|
|
|
Vue.use(Vue2TouchEvents)
|
|
|
|
|
2019-05-31 15:01:54 +02:00
|
|
|
import VUserBlock from 'vuejs/components/Block/UserBlock'
|
2019-05-23 18:11:06 +02:00
|
|
|
import VMainContent from 'vuejs/components/Content/MainContent'
|
2019-05-31 15:01:54 +02:00
|
|
|
import VSearchBlock from 'vuejs/components/Block/SearchBlock'
|
2020-11-26 22:45:46 +01:00
|
|
|
import VLeftContent from 'vuejs/components/Content/LeftContent'
|
2021-03-08 21:11:14 +01:00
|
|
|
import VHeaderMenu from 'vuejs/components/Content/HeaderMenu'
|
2022-10-31 11:10:51 +01:00
|
|
|
import VLanguageSwitcher from 'vuejs/components/Content/LanguageSwitcher'
|
2022-02-22 13:43:18 +01:00
|
|
|
import GlobCoolLightBox from 'vuejs/components/Content/GlobCoolLightBox'
|
2019-04-11 00:12:23 +02:00
|
|
|
|
|
|
|
import { mapState } from 'vuex'
|
2019-03-25 18:27:56 +01:00
|
|
|
|
2022-02-22 13:43:18 +01:00
|
|
|
// import 'vue-cool-lightbox/dist/vue-cool-lightbox.min.css'
|
2021-04-02 16:35:29 +02:00
|
|
|
import 'slim-select/slimselect.min.css'
|
2021-07-09 11:35:37 +02:00
|
|
|
|
2019-04-09 00:21:00 +02:00
|
|
|
import 'theme/assets/styles/main.scss'
|
2021-01-25 22:19:21 +01:00
|
|
|
import 'theme/assets/styles/print.scss'
|
2019-04-09 00:21:00 +02:00
|
|
|
|
2021-09-16 21:40:18 +02:00
|
|
|
import MA from 'vuejs/api/ma-axios'
|
2021-03-06 22:02:48 +01:00
|
|
|
|
2022-10-31 11:10:51 +01:00
|
|
|
export let _v_sitebranding_block, _v_user_block, _v_header_menu, _v_language_switcher,
|
2021-03-31 19:17:55 +02:00
|
|
|
_v_pagetitle_block, _v_search_block,
|
2022-02-22 13:43:18 +01:00
|
|
|
_v_main_content, _v_left_content,
|
|
|
|
_v_glob_coollightbox
|
2021-03-31 19:17:55 +02:00
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
(function (Drupal, drupalSettings, drupalDecoupled) {
|
|
|
|
const MaterioTheme = function () {
|
|
|
|
const _is_front = drupalSettings.path.isFront
|
|
|
|
console.log('drupalSettings', drupalSettings)
|
2019-04-11 00:12:23 +02:00
|
|
|
|
2020-12-07 23:11:31 +01:00
|
|
|
// let _I18n
|
|
|
|
|
2019-03-25 18:27:56 +01:00
|
|
|
// ___ _ _
|
|
|
|
// |_ _|_ _ (_) |_
|
|
|
|
// | || ' \| | _|
|
|
|
|
// |___|_||_|_|\__|
|
2020-11-25 22:49:17 +01:00
|
|
|
function init () {
|
|
|
|
console.log('MaterioTheme init()')
|
2019-04-11 00:12:23 +02:00
|
|
|
initVues()
|
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function checkNoVuePages () {
|
2019-10-07 20:26:23 +02:00
|
|
|
// return drupalDecoupled.sys_path != '/cart'
|
|
|
|
// && drupalDecoupled.sys_path.indexOf('checkout') != 1;
|
2021-07-01 16:33:15 +02:00
|
|
|
// if (drupalDecoupled.route_name.indexOf('commerce') === -1 &&
|
|
|
|
// drupalDecoupled.route_name.indexOf('flagging_collection') === -1 &&
|
|
|
|
// drupalDecoupled.route_name.indexOf('user') === -1 &&
|
|
|
|
// drupalDecoupled.route_name !== 'entity.webform.canonical' &&
|
|
|
|
// (drupalDecoupled.route_name === 'entity.webform.canonical' && drupalDecoupled.sys_path.indexOf('/webform/multi_joueur') === -1)) {
|
|
|
|
// return false
|
|
|
|
// } else {
|
|
|
|
// return true
|
|
|
|
// }
|
|
|
|
if (drupalDecoupled.route_name.indexOf('commerce') !== -1 ||
|
|
|
|
drupalDecoupled.route_name.indexOf('flagging_collection') !== -1 ||
|
|
|
|
drupalDecoupled.route_name.indexOf('user') !== -1 ||
|
2021-07-05 12:31:11 +02:00
|
|
|
drupalDecoupled.route_name.indexOf('entity.webform.canonical') !== -1 ||
|
2021-08-17 21:59:56 +02:00
|
|
|
drupalDecoupled.route_name.indexOf('entity.webform.confirmation') !== -1 ||
|
2021-09-07 00:50:12 +02:00
|
|
|
drupalDecoupled.route_name.indexOf('materio_expo.qr_controller_getfile') !== -1 ||
|
2022-03-31 20:27:59 +02:00
|
|
|
(drupalDecoupled.route_name === 'entity.node.canonical' && drupalDecoupled.entity_bundle === 'simplenews_issue') ||
|
|
|
|
drupalDecoupled.route_name.indexOf('simplenews') !== -1
|
2021-08-17 21:59:56 +02:00
|
|
|
) {
|
2021-07-01 16:33:15 +02:00
|
|
|
console.debug('NO VUEJS')
|
2020-11-25 22:49:17 +01:00
|
|
|
return true
|
2021-07-01 16:33:15 +02:00
|
|
|
} else {
|
|
|
|
console.debug('VUJS')
|
|
|
|
return false
|
2019-10-07 20:26:23 +02:00
|
|
|
}
|
2019-10-07 17:32:14 +02:00
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVues () {
|
2019-10-07 17:32:14 +02:00
|
|
|
// only launch views if we are not in commerce pages
|
2020-11-25 22:49:17 +01:00
|
|
|
if (!checkNoVuePages()) {
|
|
|
|
initVRouter()
|
2019-10-07 17:32:14 +02:00
|
|
|
initVSiteBrandingBlock()
|
|
|
|
initVPagetitleBlock()
|
|
|
|
initVHeaderMenu()
|
2022-10-31 11:10:51 +01:00
|
|
|
initVLanguageSwitcher()
|
2021-03-29 22:28:24 +02:00
|
|
|
initHamburgerMenu()
|
2019-10-07 17:32:14 +02:00
|
|
|
initVSearchBlock()
|
2021-05-25 22:22:00 +02:00
|
|
|
initVMainContent()
|
|
|
|
initVStore()
|
2021-06-02 11:21:03 +02:00
|
|
|
initVi18n()
|
2020-11-26 22:45:46 +01:00
|
|
|
initVLeftContent()
|
2022-02-22 13:43:18 +01:00
|
|
|
initCoolLightBox()
|
2019-10-07 17:32:14 +02:00
|
|
|
}
|
2019-11-06 12:16:33 +01:00
|
|
|
initVUserBlock()
|
2019-04-11 00:12:23 +02:00
|
|
|
}
|
2019-03-25 18:27:56 +01:00
|
|
|
|
2020-12-07 23:11:31 +01:00
|
|
|
function initVi18n () {
|
2020-12-08 15:26:56 +01:00
|
|
|
// i18n.locale = drupalDecoupled.lang_code
|
|
|
|
// console.log('i18n.messages', i18n.messages)
|
|
|
|
loadLanguageAsync(drupalDecoupled.lang_code)
|
|
|
|
.then(() => {
|
|
|
|
console.log('main.js language loaded')
|
|
|
|
})
|
2020-12-07 23:11:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function initVStore () {
|
2022-09-19 15:58:11 +02:00
|
|
|
store.dispatch('Showrooms/getShowrooms')
|
2020-12-07 23:11:31 +01:00
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVRouter () {
|
2019-07-24 17:20:44 +02:00
|
|
|
// we need this to update the title and body classes while using history nav
|
2019-07-12 22:15:09 +02:00
|
|
|
router.beforeEach((to, from, next) => {
|
2021-06-02 11:21:03 +02:00
|
|
|
console.log('router beforeEach to ', to, router.app.$i18n)
|
2019-07-24 17:20:44 +02:00
|
|
|
// commit new title to store
|
2020-11-25 22:49:17 +01:00
|
|
|
let title = null
|
2019-07-25 21:23:23 +02:00
|
|
|
switch (to.name) {
|
|
|
|
case 'home':
|
|
|
|
title = null
|
2020-11-25 22:49:17 +01:00
|
|
|
break
|
2019-07-25 21:23:23 +02:00
|
|
|
case 'article':
|
|
|
|
title = false
|
2020-11-25 22:49:17 +01:00
|
|
|
break
|
2021-06-01 23:14:33 +02:00
|
|
|
case 'pricing':
|
2021-06-02 11:21:03 +02:00
|
|
|
title = i18n.t('materio.' + to.name)
|
2021-06-01 23:14:33 +02:00
|
|
|
break
|
2019-07-25 21:23:23 +02:00
|
|
|
default:
|
|
|
|
title = to.name
|
|
|
|
}
|
|
|
|
if (title !== false) {
|
|
|
|
store.commit('Common/setPagetitle', title)
|
|
|
|
}
|
2019-07-24 17:20:44 +02:00
|
|
|
|
|
|
|
// remove all path related body classes
|
2020-11-25 22:49:17 +01:00
|
|
|
const body_classes = document.querySelector('body').classList
|
|
|
|
const classes_to_rm = []
|
2021-03-31 18:42:05 +02:00
|
|
|
for (let i = 0; i < body_classes.length; i++) {
|
2020-11-25 22:49:17 +01:00
|
|
|
if (body_classes[i].startsWith('path-')) {
|
|
|
|
classes_to_rm.push(body_classes[i])
|
2019-07-24 17:20:44 +02:00
|
|
|
}
|
|
|
|
}
|
2020-11-25 22:49:17 +01:00
|
|
|
document.querySelector('body').classList.remove(...classes_to_rm)
|
2019-07-24 17:20:44 +02:00
|
|
|
// add new path classes to body
|
2020-11-25 22:49:17 +01:00
|
|
|
const classes = []
|
2021-03-31 18:42:05 +02:00
|
|
|
if (to.name === 'home') {
|
2020-11-25 22:49:17 +01:00
|
|
|
classes.push('path-home')
|
|
|
|
} else {
|
2021-01-19 16:30:14 +01:00
|
|
|
const path_parts = to.path
|
|
|
|
.replace(/^\//, '')
|
2021-03-31 18:42:05 +02:00
|
|
|
.replace(/^\D{2,3}\//, '') // remove language relative prefix from path classes (fr, en, etc)
|
|
|
|
.split('/')
|
|
|
|
let c
|
|
|
|
for (let j = 0; j < path_parts.length; j++) {
|
|
|
|
if (j === 0) {
|
|
|
|
c = 'path-' + path_parts[j]
|
|
|
|
} else if (path_parts[j] !== '') {
|
|
|
|
c = classes[j - 1] + '-' + path_parts[j]
|
2019-07-24 17:20:44 +02:00
|
|
|
}
|
|
|
|
classes.push(c)
|
|
|
|
}
|
|
|
|
}
|
2020-11-25 22:49:17 +01:00
|
|
|
document.querySelector('body').classList.add(...classes)
|
2019-07-24 17:20:44 +02:00
|
|
|
|
2021-03-31 18:42:05 +02:00
|
|
|
updateLanguageLinksBlock(to.path)
|
2021-03-29 22:28:24 +02:00
|
|
|
|
|
|
|
// close the hamburger menu
|
|
|
|
store.dispatch('Common/openCloseHamMenu', false)
|
|
|
|
|
2021-03-06 22:02:48 +01:00
|
|
|
// trigger router
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
}
|
2021-01-27 21:21:20 +01:00
|
|
|
|
2022-10-31 11:10:51 +01:00
|
|
|
function initVLanguageSwitcher () {
|
|
|
|
console.log('initVLanguageSwitcher')
|
|
|
|
const id = 'block-languageswitcher'
|
|
|
|
const $html_obj = document.querySelector('#' + id)
|
|
|
|
console.log('initVLanguageSwitcher $html_obj', $html_obj)
|
|
|
|
const html = $html_obj.outerHTML
|
|
|
|
console.log('initVLanguageSwitcher html', html)
|
|
|
|
_v_language_switcher = new Vue({
|
|
|
|
store,
|
|
|
|
i18n,
|
|
|
|
router,
|
|
|
|
render: h => h(VLanguageSwitcher, { props: { id: id, dom_html: html } })
|
|
|
|
}).$mount('#' + id)
|
|
|
|
}
|
|
|
|
|
2021-03-31 18:42:05 +02:00
|
|
|
function updateLanguageLinksBlock (path) {
|
2021-03-06 22:02:48 +01:00
|
|
|
// update block language selection
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log('router beforeEach path ', path)
|
|
|
|
const links = document.querySelectorAll('#block-languageswitcher a.language-link')
|
2021-01-27 21:21:20 +01:00
|
|
|
|
2021-03-31 18:42:05 +02:00
|
|
|
const params = {
|
2021-03-06 22:02:48 +01:00
|
|
|
path: path
|
|
|
|
// XDEBUG_SESSION_START: true
|
|
|
|
}
|
2021-01-27 21:21:20 +01:00
|
|
|
|
2021-03-31 18:42:05 +02:00
|
|
|
MA.post('materio_decoupled/path_translation_links?', params)
|
2021-03-06 22:02:48 +01:00
|
|
|
.then(({ data }) => {
|
|
|
|
console.log('Path translations links', data)
|
2021-03-08 14:41:22 +01:00
|
|
|
if (data.error) {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.warn('error getting translation paths', data.error)
|
2021-03-08 14:41:22 +01:00
|
|
|
}
|
2021-03-08 18:45:19 +01:00
|
|
|
|
|
|
|
links.forEach((link, i) => {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log('language link', path, link)
|
|
|
|
const hreflang = link.getAttribute('hreflang')
|
2021-03-08 18:45:19 +01:00
|
|
|
|
|
|
|
link.setAttribute('href', data.links[hreflang].url)
|
|
|
|
link.setAttribute('data-drupal-link-system-path', data.links[hreflang].sys_path)
|
|
|
|
|
|
|
|
link.innerHTML = data.links[hreflang].title
|
2021-03-31 18:42:05 +02:00
|
|
|
})
|
2021-03-06 22:02:48 +01:00
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.warn('Path translations links', error)
|
|
|
|
})
|
2019-07-12 22:15:09 +02:00
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVSiteBrandingBlock () {
|
2019-06-03 13:06:44 +02:00
|
|
|
_v_sitebranding_block = new Vue({
|
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2019-06-03 13:06:44 +02:00
|
|
|
router,
|
|
|
|
el: '#block-sitebranding',
|
|
|
|
methods: {
|
2020-11-25 22:49:17 +01:00
|
|
|
onclick (event) {
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2020-11-25 22:49:17 +01:00
|
|
|
const href = event.target.getAttribute('href')
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2019-06-06 17:37:43 +02:00
|
|
|
this.$router.push(href)
|
2019-07-12 22:15:09 +02:00
|
|
|
// replaced by router.beforeEach
|
|
|
|
// this.$store.commit('Common/setPagetitle', null)
|
2019-06-03 13:06:44 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVPagetitleBlock () {
|
|
|
|
const $blk = document.querySelector('#block-pagetitle')
|
|
|
|
const $h2 = $blk.querySelector('h2')
|
2019-06-22 16:13:47 +02:00
|
|
|
// get the loaded pagetitle
|
2020-11-25 22:49:17 +01:00
|
|
|
const title = $h2.innerText
|
2019-06-22 16:13:47 +02:00
|
|
|
// if not front recorde the loaded pagetitle in store
|
|
|
|
if (!_is_front) {
|
|
|
|
store.commit('Common/setPagetitle', title)
|
|
|
|
}
|
|
|
|
// replace in template the pagetitle by vue binding
|
2021-06-01 23:14:33 +02:00
|
|
|
$h2.innerText = '{{ pagetitle }}'
|
2019-06-22 16:13:47 +02:00
|
|
|
// create the vue
|
|
|
|
_v_pagetitle_block = new Vue({
|
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2019-06-22 16:13:47 +02:00
|
|
|
router,
|
|
|
|
el: $blk,
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
pagetitle: state => state.Common.pagetitle
|
|
|
|
})
|
2020-11-25 22:49:17 +01:00
|
|
|
}
|
2019-06-22 16:13:47 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVUserBlock () {
|
|
|
|
const mount_point = drupalSettings.user.uid !== 0 ? 'block-userblock' : 'block-userlogin'
|
|
|
|
const props = {
|
|
|
|
title: '',
|
|
|
|
loginblock: ''
|
|
|
|
}
|
|
|
|
let $block
|
2019-05-21 14:56:34 +02:00
|
|
|
switch (mount_point) {
|
2019-05-31 23:05:37 +02:00
|
|
|
case 'block-userlogin':
|
2020-11-25 22:49:17 +01:00
|
|
|
$block = document.getElementById(mount_point)
|
|
|
|
console.log('initVUserBlock login form html', $block)
|
2019-05-31 23:05:37 +02:00
|
|
|
props.loginblock = $block.outerHTML.trim()
|
2020-11-25 22:49:17 +01:00
|
|
|
break
|
2019-05-31 23:05:37 +02:00
|
|
|
case 'block-userblock':
|
2019-05-21 14:56:34 +02:00
|
|
|
default:
|
2020-11-25 22:49:17 +01:00
|
|
|
break
|
2019-05-21 14:56:34 +02:00
|
|
|
}
|
2019-05-23 17:52:46 +02:00
|
|
|
|
2019-05-31 15:01:54 +02:00
|
|
|
_v_user_block = new Vue({
|
2019-04-11 00:12:23 +02:00
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2019-05-31 15:01:54 +02:00
|
|
|
// computed: {
|
|
|
|
// ...mapState({
|
|
|
|
// isloggedin: state => state.User.isloggedin
|
|
|
|
// })
|
|
|
|
// },
|
2019-04-11 00:12:23 +02:00
|
|
|
created () {
|
2019-05-31 23:05:37 +02:00
|
|
|
// if already loggedin, call store.user to get the user infos
|
2020-11-25 22:49:17 +01:00
|
|
|
if (drupalSettings.user.uid !== 0) {
|
2019-04-11 00:12:23 +02:00
|
|
|
this.$store.commit('User/setUid', drupalSettings.user.uid)
|
|
|
|
this.$store.dispatch('User/getUser')
|
|
|
|
}
|
|
|
|
},
|
2020-11-25 22:49:17 +01:00
|
|
|
render: h => h(VUserBlock, { props: props })
|
|
|
|
}).$mount('#' + mount_point)
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2019-04-11 00:12:23 +02:00
|
|
|
}
|
2019-03-25 18:27:56 +01:00
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVHeaderMenu () {
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2021-03-08 21:11:14 +01:00
|
|
|
const id = 'block-header'
|
|
|
|
const $html_obj = document.querySelector('#' + id)
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2021-03-08 21:11:14 +01:00
|
|
|
const html = $html_obj.outerHTML
|
2019-07-12 22:15:09 +02:00
|
|
|
_v_header_menu = new Vue({
|
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2019-07-12 22:15:09 +02:00
|
|
|
router,
|
2021-03-08 21:11:14 +01:00
|
|
|
render: h => h(VHeaderMenu, { props: { id: id, dom_html: html } })
|
|
|
|
}).$mount('#' + id)
|
2019-07-12 22:15:09 +02:00
|
|
|
}
|
|
|
|
|
2021-03-31 18:42:05 +02:00
|
|
|
function initHamburgerMenu () {
|
2021-03-29 22:28:24 +02:00
|
|
|
const input = document.querySelector('input#header-block-right-toggle')
|
|
|
|
input.addEventListener('change', (e) => {
|
2021-03-31 18:42:05 +02:00
|
|
|
console.log('initHamburgerMenu input change ', e)
|
2021-03-29 22:28:24 +02:00
|
|
|
store.dispatch('Common/openCloseHamMenu', e.currentTarget.checked)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVMainContent () {
|
|
|
|
const id = 'main-content'
|
|
|
|
const $main_content = document.querySelector('#' + id)
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2020-11-25 22:49:17 +01:00
|
|
|
const main_html = $main_content.innerHTML
|
2019-05-31 15:01:54 +02:00
|
|
|
_v_main_content = new Vue({
|
2019-04-11 00:12:23 +02:00
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2020-12-24 19:05:45 +01:00
|
|
|
metaInfo: {
|
|
|
|
// if no subcomponents specify a metaInfo.title, this title will be used
|
|
|
|
title: "materiO'",
|
|
|
|
// all titles will be injected into this template
|
|
|
|
titleTemplate: "%s | materiO'"
|
|
|
|
},
|
2020-11-25 22:49:17 +01:00
|
|
|
render: h => h(VMainContent, { props: { id: id, html: main_html, isfront: drupalSettings.path.isFront } })
|
|
|
|
}).$mount('#' + id)
|
2019-04-11 00:12:23 +02:00
|
|
|
}
|
2019-03-25 18:27:56 +01:00
|
|
|
|
2020-11-25 22:49:17 +01:00
|
|
|
function initVSearchBlock () {
|
2021-03-31 18:42:05 +02:00
|
|
|
// console.log('router beforeEach to ', to)
|
2020-11-25 22:49:17 +01:00
|
|
|
const id = 'block-materiosapisearchblock'
|
2019-05-31 15:01:54 +02:00
|
|
|
let $search_block = document.getElementById(id)
|
2020-11-25 22:49:17 +01:00
|
|
|
let formhtml = null
|
|
|
|
if ($search_block) {
|
2019-05-31 15:01:54 +02:00
|
|
|
// get the search form html to pass it as template to the vue
|
|
|
|
// we gain display speed vs async downloaded data
|
|
|
|
formhtml = $search_block.innerHTML
|
2020-11-25 22:49:17 +01:00
|
|
|
} else {
|
2019-05-31 15:01:54 +02:00
|
|
|
// else create the empty block to fill it later with async data
|
|
|
|
$search_block = document.createElement('div')
|
|
|
|
$search_block.setAttribute('id', id)
|
2019-06-22 16:13:47 +02:00
|
|
|
// TODO: get region by REST
|
2020-11-25 22:49:17 +01:00
|
|
|
const $region = document.getElementById('header-bottom')
|
|
|
|
$region.appendChild($search_block)
|
2019-05-31 15:01:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// in any case create the vue
|
|
|
|
_v_search_block = new Vue({
|
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2020-11-25 22:49:17 +01:00
|
|
|
render: h => h(VSearchBlock, { props: { blockid: id, formhtml: formhtml } })
|
|
|
|
}).$mount('#' + id)
|
2019-05-31 15:01:54 +02:00
|
|
|
}
|
2020-11-26 22:45:46 +01:00
|
|
|
function initVLeftContent () {
|
|
|
|
const id = 'content-left'
|
2021-03-31 18:42:05 +02:00
|
|
|
// const $leftContent = document.getElementById(id)
|
2020-11-26 22:45:46 +01:00
|
|
|
// in any case create the vue
|
|
|
|
_v_left_content = new Vue({
|
|
|
|
store,
|
2020-12-07 23:11:31 +01:00
|
|
|
i18n,
|
2020-11-26 22:45:46 +01:00
|
|
|
render: h => h(VLeftContent, { props: { id: id } })
|
|
|
|
}).$mount('#' + id)
|
|
|
|
}
|
2022-02-22 13:43:18 +01:00
|
|
|
function initCoolLightBox () {
|
|
|
|
const id = 'glog-coollightbox'
|
|
|
|
const $clb_elmt = document.createElement('div')
|
|
|
|
$clb_elmt.setAttribute('id', id)
|
|
|
|
const $body = document.querySelector('body')
|
|
|
|
$body.appendChild($clb_elmt)
|
|
|
|
|
|
|
|
_v_glob_coollightbox = new Vue({
|
|
|
|
store,
|
|
|
|
i18n,
|
|
|
|
render: h => h(GlobCoolLightBox, { props: { } })
|
|
|
|
}).$mount('#' + id)
|
|
|
|
console.log('_v_glob_coollightbox', _v_glob_coollightbox)
|
|
|
|
}
|
2019-04-11 00:12:23 +02:00
|
|
|
init()
|
2019-03-25 18:27:56 +01:00
|
|
|
} // end MaterioTheme()
|
|
|
|
|
2021-03-31 18:42:05 +02:00
|
|
|
// const materiotheme = new MaterioTheme()
|
|
|
|
MaterioTheme()
|
2020-11-25 22:49:17 +01:00
|
|
|
})(Drupal, drupalSettings, drupalDecoupled)
|