From 498a2e0af891e6900caefd237875b6dcc157e7f7 Mon Sep 17 00:00:00 2001
From: mateuswetah
Date: Mon, 26 Feb 2018 15:52:33 -0300
Subject: [PATCH] Adds back i18n function to router. Adds buttons ids for tests
in collection and items lists.
---
src/admin/components/collections-list.vue | 6 +--
src/admin/components/items-list.vue | 10 +++--
src/admin/js/router.js | 43 +++++++++++--------
.../pages/edition/collection-edition-page.vue | 2 +
4 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/src/admin/components/collections-list.vue b/src/admin/components/collections-list.vue
index 5d17f31c7..1d4676770 100644
--- a/src/admin/components/collections-list.vue
+++ b/src/admin/components/collections-list.vue
@@ -47,9 +47,9 @@
-
-
-
+
+
+
diff --git a/src/admin/components/items-list.vue b/src/admin/components/items-list.vue
index 55375fd54..277da3935 100644
--- a/src/admin/components/items-list.vue
+++ b/src/admin/components/items-list.vue
@@ -59,9 +59,9 @@
-
-
-
+
+
+
@@ -77,7 +77,9 @@
Nenhum item ainda nesta coleção.
-
Criar Item
diff --git a/src/admin/js/router.js b/src/admin/js/router.js
index 2b3faf6f1..0cd04a504 100644
--- a/src/admin/js/router.js
+++ b/src/admin/js/router.js
@@ -18,38 +18,43 @@ import ItemsList from '../components/items-list.vue'
import FiltersList from '../components/filters-list.vue'
import CategoriesList from '../components/categories-list.vue'
import FieldsList from '../components/fields-list.vue'
-
-Vue.use(VueRouter);
+
+Vue.use(VueRouter);
+
+const i18nGet = function (key) {
+ let string = wp_settings.i18n[key];
+ return (string != undefined && string != null && string != '' ) ? string : "ERROR: Invalid i18n key!";
+}
const routes = [
{ path: '/', redirect:'/collections' },
- { 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', name: 'CollectionsPage', component: CollectionsPage, meta: {title: i18nGet('page_title_collections_page')} },
+ { path: '/collections/new', name: 'CollectionEditionPage', component: CollectionEditionPage, meta: {title: i18nGet('page_title_create_collection')} },
- { path: '/collections/:id', name: 'CollectionPage', component: CollectionPage, meta: {title: 'page_title_collection_page'},
+ { path: '/collections/:id', name: 'CollectionPage', component: CollectionPage, meta: {title: i18nGet('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: '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: '', component: ItemsList, name: 'ItemsList', meta: {title: i18nGet('page_title_collection_page')} },
+ { path: 'items', component: ItemsList, name: 'ItemsList', meta: {title: i18nGet('page_title_collection_page')} },
+ { path: 'edit', component: CollectionEditionPage, name: 'CollectionEditionPage', meta: {title: i18nGet('page_title_collection_edition')} },
+ { path: 'fields', component: FieldsList, name: 'FieldsList', meta: {title: i18nGet('page_title_collection_page')} },
+ { path: 'filters', component: FiltersList, name: 'FiltersList', meta: {title: i18nGet('page_title_collection_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/new', name: 'ItemEditionPage', component: ItemEditionPage, meta: {title: i18nGet('page_title_create_item')} },
+ { path: '/collections/:collection_id/items/:id/edit', name: 'ItemEditionPage', component: ItemEditionPage, meta: {title: i18nGet('page_title_item_edition')} },
+ { path: '/collections/:collection_id/items/new', name: 'ItemCreatePage', component: ItemEditionPage, meta: {title: i18nGet('page_title_create_item')} },
+ { path: '/collections/:collection_id/items/:id', name: 'ItemPage', component: ItemPage, meta: {title: i18nGet('page_title_item_page')} },
- { path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: 'page_title_items_page'} },
+ { path: '/items', name: 'ItemsPage', component: ItemsPage, meta: {title: i18nGet('page_title_items_page')} },
- { path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: 'page_title_filters_page'} },
+ { path: '/filters', name: 'FiltersPage', component: FiltersPage, meta: {title: i18nGet('page_title_filters_page')} },
- { path: '/fields', name: 'FieldsPage', component: FieldsPage, meta: {title: 'page_title_fields_page'} },
+ { path: '/fields', name: 'FieldsPage', component: FieldsPage, meta: {title: i18nGet('page_title_fields_page')} },
- { path: '/categories', name: 'CategoriesPage', component: CategoriesPage, meta: {title: 'page_title_categories_page'} },
+ { path: '/categories', name: 'CategoriesPage', component: CategoriesPage, meta: {title: i18nGet('page_title_categories_page')} },
- { path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: 'page_title_events_page'} },
+ { path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: i18nGet('page_title_events_page')} },
{ path: '*', redirect: '/'}
]
diff --git a/src/admin/pages/edition/collection-edition-page.vue b/src/admin/pages/edition/collection-edition-page.vue
index 56da12ac5..b74b8eb5d 100644
--- a/src/admin/pages/edition/collection-edition-page.vue
+++ b/src/admin/pages/edition/collection-edition-page.vue
@@ -48,10 +48,12 @@
Salvar