From 421cd1ad7326c789ae2f23658d06bbec6f9f5ff6 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Fri, 23 Feb 2018 10:20:04 -0300 Subject: [PATCH] Improvements in Router by adding child routes, allowing nested router-views. Changes folder structure under page for better organization. Creates empty list components for fields, categories and filters. --- src/admin/components/categories-list.vue | 21 +++++++ src/admin/components/fields-list.vue | 21 +++++++ src/admin/components/filters-list.vue | 21 +++++++ src/admin/components/items-list.vue | 14 +++-- src/admin/components/primary-menu.vue | 17 +++--- src/admin/components/secondary-menu.vue | 21 +++++-- src/admin/js/router.js | 57 +++++++++++-------- .../{ => edition}/collection-edition-page.vue | 0 .../pages/{ => edition}/item-edition-page.vue | 0 .../pages/{ => lists}/categories-page.vue | 0 .../pages/{ => lists}/collections-page.vue | 2 +- src/admin/pages/{ => lists}/events-page.vue | 0 src/admin/pages/{ => lists}/fields-page.vue | 0 src/admin/pages/{ => lists}/filters-page.vue | 0 src/admin/pages/{ => lists}/items-page.vue | 0 .../pages/{ => singles}/collection-page.vue | 22 ++----- src/admin/pages/{ => singles}/item-page.vue | 0 17 files changed, 136 insertions(+), 60 deletions(-) create mode 100644 src/admin/components/categories-list.vue create mode 100644 src/admin/components/fields-list.vue create mode 100644 src/admin/components/filters-list.vue rename src/admin/pages/{ => edition}/collection-edition-page.vue (100%) rename src/admin/pages/{ => edition}/item-edition-page.vue (100%) rename src/admin/pages/{ => lists}/categories-page.vue (100%) rename src/admin/pages/{ => lists}/collections-page.vue (87%) rename src/admin/pages/{ => lists}/events-page.vue (100%) rename src/admin/pages/{ => lists}/fields-page.vue (100%) rename src/admin/pages/{ => lists}/filters-page.vue (100%) rename src/admin/pages/{ => lists}/items-page.vue (100%) rename src/admin/pages/{ => singles}/collection-page.vue (69%) rename src/admin/pages/{ => singles}/item-page.vue (100%) diff --git a/src/admin/components/categories-list.vue b/src/admin/components/categories-list.vue new file mode 100644 index 000000000..4b6400719 --- /dev/null +++ b/src/admin/components/categories-list.vue @@ -0,0 +1,21 @@ + + + + + + + diff --git a/src/admin/components/fields-list.vue b/src/admin/components/fields-list.vue new file mode 100644 index 000000000..9d6c6c3bf --- /dev/null +++ b/src/admin/components/fields-list.vue @@ -0,0 +1,21 @@ + + + + + + + diff --git a/src/admin/components/filters-list.vue b/src/admin/components/filters-list.vue new file mode 100644 index 000000000..471fc72dc --- /dev/null +++ b/src/admin/components/filters-list.vue @@ -0,0 +1,21 @@ + + + + + + + diff --git a/src/admin/components/items-list.vue b/src/admin/components/items-list.vue index dbe783713..55375fd54 100644 --- a/src/admin/components/items-list.vue +++ b/src/admin/components/items-list.vue @@ -101,12 +101,10 @@ export default { isLoading: false, totalItems: 0, page: 1, - itemsPerPage: 2 + itemsPerPage: 2, + collectionId: Number } }, - props: { - collectionId: Number - }, methods: { ...mapActions('collection', [ 'fetchItems', @@ -212,6 +210,14 @@ export default { return this.getItems(); } }, + created() { + this.collectionId = this.$route.fullPath.split("/").pop(); + if (isNaN(this.collectionId)) { + let routeArray = this.$route.fullPath.split("/"); + routeArray.pop(); + this.collectionId = routeArray.pop(); + } + }, mounted(){ this.loadItems(); this.fetchFields(this.collectionId).then((res) => { diff --git a/src/admin/components/primary-menu.vue b/src/admin/components/primary-menu.vue index 32c6ef1f6..981441d65 100644 --- a/src/admin/components/primary-menu.vue +++ b/src/admin/components/primary-menu.vue @@ -2,22 +2,22 @@