From de439c82460a771d916c4457b70f59ea8562aa17 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 26 Mar 2018 09:38:01 -0300 Subject: [PATCH] Now we can see Snackbars notifications instead of console.logs passing visual: true in main.js configuration for ConsolePlugin. --- src/admin/js/main.js | 11 +++++------ src/admin/js/utilities.js | 16 ++++++++-------- src/admin/scss/tainacan-admin.scss | 4 ++-- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/admin/js/main.js b/src/admin/js/main.js index f0d8ca29f..7a82fd3b8 100644 --- a/src/admin/js/main.js +++ b/src/admin/js/main.js @@ -37,13 +37,14 @@ router.beforeEach((to, from, next) => { document.title = to.meta.title next() }); -Vue.use(Buefy); +Vue.use(Buefy); Vue.use(I18NPlugin); Vue.use(UserPrefsPlugin); Vue.use(RouterHelperPlugin); Vue.use(ConsolePlugin, {visual: false}); // Register Components +/* Fields */ Vue.component('tainacan-text', Text); Vue.component('tainacan-textarea', Textarea); Vue.component('tainacan-selectbox', Selectbox); @@ -55,20 +56,18 @@ Vue.component('tainacan-category', Category); Vue.component('tainacan-form-relationship', FormRelationship); Vue.component('tainacan-form-category', FormCategory); Vue.component('tainacan-form-selectbox', FormSelectbox); - Vue.component('tainacan-form-item', TaincanFormItem); Vue.component('tainacan-filters-list', TaincanFiltersList); -Vue.component('help-button', HelpButton); -Vue.component('draggable', draggable); - /* Filters */ - Vue.component('tainacan-filter-custom-interval', FilterCustomInterval); Vue.component('tainacan-filter-selectbox', FilterSelectbox); Vue.component('tainacan-filter-autocomplete', FilterAutocomplete); Vue.component('tainacan-filter-checkbox', FilterCheckbox); Vue.component('tainacan-filter-taginput', FilterTaginput); +/* Others */ +Vue.component('help-button', HelpButton); +Vue.component('draggable', draggable); new Vue({ el: '#tainacan-admin-app', diff --git a/src/admin/js/utilities.js b/src/admin/js/utilities.js index 6f5ccef13..4eafa67e4 100644 --- a/src/admin/js/utilities.js +++ b/src/admin/js/utilities.js @@ -7,19 +7,19 @@ const wpApi = axios.create({ wpApi.defaults.headers.common['X-WP-Nonce'] = tainacan_plugin.nonce; -// I18N PLUGIN - Allows access to Wordpress translation file. +// CONSOLE PLUGIN - Allows custom use of console functions and avoids eslint warnings. export const ConsolePlugin = {}; ConsolePlugin.install = function (Vue, options = { visual: false }) { - + Vue.prototype.$console = { log(something) { if (options.visual) { - this.$snackbar.open({ + Vue.prototype.$snackbar.open({ message: something, type: 'is-secondary', position: 'is-bottom-right', indefinite: true, - queue: true + queue: false }); } else { console.log(something); @@ -27,12 +27,12 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) { }, info(someInfo) { if (options.visual) { - this.$snackbar.open({ + Vue.prototype.$snackbar.open({ message: someInfo, type: 'is-primary', position: 'is-bottom-right', duration: 5000, - queue: true + queue: false }); } else { console.info(someInfo); @@ -40,12 +40,12 @@ ConsolePlugin.install = function (Vue, options = { visual: false }) { }, error(someError) { if (options.visual) { - this.$snackbar.open({ + Vue.prototype.$snackbar.open({ message: someError, type: 'is-danger', position: 'is-bottom-right', indefinite: true, - queue: true + queue: false }); } else { console.error(someError); diff --git a/src/admin/scss/tainacan-admin.scss b/src/admin/scss/tainacan-admin.scss index 78adada7a..b194d28fe 100644 --- a/src/admin/scss/tainacan-admin.scss +++ b/src/admin/scss/tainacan-admin.scss @@ -70,9 +70,9 @@ html { } } -// Buefy notices (toast) +// Buefy notices (toast, snackbar...) .notices { - z-index: 99999999 !important; + z-index: 99999999999999 !important; } // Input components used in forms are gray in Tainacan