Now we can see Snackbars notifications instead of console.logs passing visual: true in main.js configuration for ConsolePlugin.
This commit is contained in:
parent
dad2bf180f
commit
de439c8246
|
@ -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',
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue