Removes references from router. Plugin inside plugin is not working properly.

This commit is contained in:
mateuswetah 2018-02-26 14:19:03 -03:00
parent 74bc25e682
commit 5aa78c9a4a
2 changed files with 31 additions and 29 deletions

View File

@ -3,10 +3,28 @@ import Buefy from 'buefy'
Vue.use(Buefy);
//------------------------------------------------
// I18N PLUGIN
const I18NPlugin = {};
I18NPlugin.install = function (Vue, options = {}) {
Vue.prototype.$i18n = {
get: function (key) {
let string = wp_settings.i18n[key];
return (string != undefined && string != null && string != '' ) ? string : "ERROR: Invalid i18n key!";
}
}
}
Vue.use(I18NPlugin);
import AdminPage from '../admin.vue'
import store from '../../js/store/store'
import router from './router'
//------------------------------------------------
// Router
router.beforeEach((to, from, next) => {
document.title = to.meta.title
next()
@ -37,22 +55,6 @@ Vue.component('tainacan-relationship', Relationship);
Vue.component('tainacan-form-item', TaincanFormItem);
//------------------------------------------------
// I18N PLUGIN
const I18NPlugin = {};
I18NPlugin.install = function (Vue, options = {}) {
Vue.prototype.$i18n = {
get: function (key) {
let string = wp_settings.i18n[key];
return (string != undefined && string != null && string != '' ) ? string : "ERROR: Invalid i18n key!";
}
}
}
Vue.use(I18NPlugin);
new Vue({
el: '#tainacan-admin-app',
store,

View File

@ -24,32 +24,32 @@ Vue.use(VueRouter);
const routes = [
{ path: '/', redirect:'/collections' },
{ path: '/collections', name: 'CollectionsPage', component: CollectionsPage, meta: {title: $i18n.get('page_title_collections_page')} },
{ path: '/collections/new', name: 'CollectionEditionPage', component: CollectionEditionPage, meta: {title: $i18n.get('page_title_create_collection')} },
{ path: '/collections', name: 'CollectionsPage', component: CollectionsPage, meta: {title: 'page_title_collections_page'} },
{ path: '/collections/new', name: 'CollectionEditionPage', component: CollectionEditionPage, meta: {title: 'page_title_create_collection'} },
{ path: '/collections/:id', name: 'CollectionPage', component: CollectionPage, meta: {title: $i18n.get('page_title_collection_page')},
{ path: '/collections/:id', name: 'CollectionPage', component: CollectionPage, meta: {title: 'page_title_collection_page'},
children: [
{ path: '', component: ItemsList, name: 'ItemsList', meta: {title: 'Items List'} },
{ path: 'items', component: ItemsList, name: 'ItemsList', meta: {title: 'Items List'} },
{ path: 'edit', component: CollectionEditionPage, name: 'CollectionEditionPage', meta: {title: $i18n.get('page_title_collection_edition')} },
{ path: 'edit', component: CollectionEditionPage, name: 'CollectionEditionPage', meta: {title: 'page_title_collection_edition'} },
{ path: 'fields', component: FieldsList, name: 'FieldsList', meta: {title: 'Fields List'} },
{ path: 'filters', component: FiltersList, name: 'FiltersList', meta: {title: 'Filters List'} }
]
},
{ path: 'items/new', name: 'ItemEditionPage', component: ItemEditionPage, meta: {title: $i18n.get('page_title_create_item')} },
{ path: '/collections/:collection_id/items/:id/edit', name: 'ItemEditionPage', component: ItemEditionPage, meta: {title: $i18n.get('page_title_item_edition')} },
{ path: '/collections/:collection_id/items/new', name: 'ItemCreatePage', component: ItemEditionPage, meta: {title: $i18n.get('page_title_create_item')} },
{ path: '/collections/:collection_id/items/:id', name: 'ItemPage', component: ItemPage, meta: {title: $i18n.get('page_title_item_page')} },
{ path: 'items/new', name: 'ItemEditionPage', component: ItemEditionPage, meta: {title: 'page_title_create_item'} },
{ path: '/collections/:collection_id/items/:id/edit', name: 'ItemEditionPage', component: ItemEditionPage, meta: {title: 'page_title_item_edition'} },
{ path: '/collections/:collection_id/items/new', name: 'ItemCreatePage', component: ItemEditionPage, meta: {title: 'page_title_create_item'} },
{ path: '/collections/:collection_id/items/:id', name: 'ItemPage', component: ItemPage, meta: {title: 'page_title_item_page'} },
{ path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: $i18n.get('page_title_items_page')} },
{ path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: 'page_title_items_page'} },
{ path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: $i18n.get('page_title_filters_page')} },
{ path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: 'page_title_filters_page'} },
{ path: '/fields', name: 'FieldsPage', component: FieldsPage, meta: {title: $i18n.get('page_title_fields_page')} },
{ path: '/fields', name: 'FieldsPage', component: FieldsPage, meta: {title: 'page_title_fields_page'} },
{ path: '/categories', name: 'CategoriesPage', component: CategoriesPage, meta: {title: $i18n.get('page_title_categories_page')} },
{ path: '/categories', name: 'CategoriesPage', component: CategoriesPage, meta: {title: 'page_title_categories_page'} },
{ path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: $i18n.get('page_title_events_page')} },
{ path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: 'page_title_events_page'} },
{ path: '*', redirect: '/'}
]