From 8afe768d04f0b71ccd54d30c8c4cd39f0cbcdc25 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 28 Aug 2019 15:56:19 +0200 Subject: [PATCH] done #2983 @0:10 --- app/Http/Kernel.php | 1 + resources/js/app.js | 65 ++++++++++++++++++++++----------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index aa92b73..bb45c5f 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -21,6 +21,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\TrustProxies::class, \Spatie\MissingPageRedirector\RedirectsMissingPages::class, \Spatie\Honeypot\ProtectAgainstSpam::class, + \Cubist\Backpack\app\Middleware\EmailObfuscate::class, ]; /** diff --git a/resources/js/app.js b/resources/js/app.js index 96de17e..d4402db 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,4 +1,3 @@ - /** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when @@ -7,11 +6,13 @@ require('./bootstrap'); require('./menu'); +require('../../vendor/cubist/cms-back/src/public/emailobfuscator/emailobfuscator'); window.Vue = require('vue'); window.eventBus = new Vue(); import PortalVue from 'portal-vue'; + Vue.use(PortalVue); /** @@ -35,11 +36,11 @@ const app = new Vue({ el: '#app', data: { - items: {}, // Populated from data attribute on root element so we can pass data from PHP + items: {}, // Populated from data attribute on root element so we can pass data from PHP }, beforeMount() { - this.items = JSON.parse(this.$el.dataset.cartItems); + this.items = JSON.parse(this.$el.dataset.cartItems); }, mounted() { @@ -63,42 +64,40 @@ const app = new Vue({ }, computed: { - cartItemCount() { - // Todo: See if this should count just number of items or make a sum of all quantities? What is more useful? The sum of quantities can be found using map/reduce functions but this needs to be adapted for the object structure using Object.keys as the source. - return Object.keys(this.items).length; - }, - - cartData() { - return JSON.stringify(this.items.reduce((obj, item) => Object.assign(obj, { [item.id]: item.quantity }), {})); - } + cartItemCount() { + // Todo: See if this should count just number of items or make a sum of all quantities? What is more useful? The sum of quantities can be found using map/reduce functions but this needs to be adapted for the object structure using Object.keys as the source. + return Object.keys(this.items).length; + }, + + cartData() { + return JSON.stringify(this.items.reduce((obj, item) => Object.assign(obj, {[item.id]: item.quantity}), {})); + } }, methods: { - saveCart(data) { - let root = this; - - axios.post('/ajax/cart', data) - .then(function(response) { - //console.log('Cart updated'); - //console.table(response.data); - root.items = response.data; - }) - .catch(function(error) { - console.error('Error saving cart!', error); - }); - }, - - openCart() { - document.body.classList.add('cart-open'); - }, - closeCart() { - document.body.classList.remove('cart-open'); - }, + saveCart(data) { + let root = this; + + axios.post('/ajax/cart', data) + .then(function (response) { + //console.log('Cart updated'); + //console.table(response.data); + root.items = response.data; + }) + .catch(function (error) { + console.error('Error saving cart!', error); + }); + }, + + openCart() { + document.body.classList.add('cart-open'); + }, + closeCart() { + document.body.classList.remove('cart-open'); + }, } - }); - -- 2.39.5