From 13f172978f2556cf804211718bf2b05a22504512 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 2 Jul 2019 01:48:19 -0400 Subject: [PATCH] feat: pages admin + path parsing fixes --- client/components/admin.vue | 4 + client/components/admin/admin-navigation.vue | 8 +- client/components/admin/admin-pages-edit.vue | 236 ++++++++++++++++++ client/components/admin/admin-pages.vue | 50 +++- .../graph/admin/pages/pages-query-single.gql | 27 ++ client/static/svg/icon-view-details.svg | 44 ++++ server/controllers/common.js | 48 ++-- server/graph/resolvers/page.js | 12 + server/graph/schemas/page.graphql | 27 ++ server/helpers/error.js | 4 + server/helpers/page.js | 4 +- server/master.js | 1 + server/models/pages.js | 34 +-- 13 files changed, 454 insertions(+), 45 deletions(-) create mode 100644 client/components/admin/admin-pages-edit.vue create mode 100644 client/graph/admin/pages/pages-query-single.gql create mode 100644 client/static/svg/icon-view-details.svg diff --git a/client/components/admin.vue b/client/components/admin.vue index 8149722f..1376a5fb 100644 --- a/client/components/admin.vue +++ b/client/components/admin.vue @@ -56,6 +56,9 @@ v-list-tile(to='/auth') v-list-tile-avatar: v-icon lock_outline v-list-tile-title {{ $t('admin:auth.title') }} + v-list-tile(to='/comments', disabled) + v-list-tile-avatar: v-icon(color='grey lighten-2') comment + v-list-tile-title {{ $t('admin:comments.title') }} v-list-tile(to='/editor', disabled) v-list-tile-avatar: v-icon(color='grey lighten-2') transform v-list-tile-title {{ $t('admin:editor.title') }} @@ -141,6 +144,7 @@ const router = new VueRouter({ { path: '/locale', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-locale.vue') }, { path: '/navigation', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-navigation.vue') }, { path: '/pages', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-pages.vue') }, + { path: '/pages/:id', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-pages-edit.vue') }, { path: '/theme', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-theme.vue') }, { path: '/groups', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-groups.vue') }, { path: '/groups/:id', component: () => import(/* webpackChunkName: "admin" */ './admin/admin-groups-edit.vue') }, diff --git a/client/components/admin/admin-navigation.vue b/client/components/admin/admin-navigation.vue index 682e82f9..36637f5b 100644 --- a/client/components/admin/admin-navigation.vue +++ b/client/components/admin/admin-navigation.vue @@ -97,6 +97,7 @@ v-else-if='current.targetType === "page"' color='indigo' dark + @click='selectPage' ) v-icon(left) search span Select Page... @@ -162,8 +163,8 @@ export default { return [ { text: this.$t('navigation.navType.external'), value: 'external' }, { text: this.$t('navigation.navType.home'), value: 'home' }, - { text: this.$t('navigation.navType.page'), value: 'page' }, - { text: this.$t('navigation.navType.searchQuery'), value: 'search' } + { text: this.$t('navigation.navType.page'), value: 'page' } + // { text: this.$t('navigation.navType.searchQuery'), value: 'search' } ] } }, @@ -197,6 +198,9 @@ export default { selectItem(item) { this.current = item }, + selectPage() { + window.alert(`Coming soon. Use External Link for now (you can still specify internal links).`) + }, async save() { this.$store.commit(`loadingStart`, 'admin-navigation-save') try { diff --git a/client/components/admin/admin-pages-edit.vue b/client/components/admin/admin-pages-edit.vue new file mode 100644 index 00000000..06bac9cf --- /dev/null +++ b/client/components/admin/admin-pages-edit.vue @@ -0,0 +1,236 @@ + + + + diff --git a/client/components/admin/admin-pages.vue b/client/components/admin/admin-pages.vue index 0da626a6..3df456e8 100644 --- a/client/components/admin/admin-pages.vue +++ b/client/components/admin/admin-pages.vue @@ -3,17 +3,17 @@ v-layout(row wrap) v-flex(xs12) .admin-header - img(src='/svg/icon-file.svg', alt='Page', style='width: 80px;') + img.animated.fadeInUp(src='/svg/icon-file.svg', alt='Page', style='width: 80px;') .admin-header-title - .headline.blue--text.text--darken-2 Pages - .subheading.grey--text Manage pages #[v-chip(label, color='primary', small).white--text coming soon] + .headline.blue--text.text--darken-2.animated.fadeInLeft Pages + .subheading.grey--text.animated.fadeInLeft.wait-p2s Manage pages v-spacer - v-btn(color='grey', outline, @click='refresh', large) + v-btn.animated.fadeInDown.wait-p1s(color='grey', outline, @click='refresh', large) v-icon.grey--text refresh - v-btn(color='primary', depressed, large, @click='newpage', disabled) + v-btn.animated.fadeInDown(color='primary', depressed, large, @click='newpage', disabled) v-icon(left) add span New Page - v-card.wiki-form.mt-3 + v-card.wiki-form.mt-3.animated.fadeInUp v-toolbar(flat, :color='$vuetify.dark ? `grey darken-3-d5` : `grey lighten-5`', height='80') v-spacer v-text-field( @@ -29,17 +29,21 @@ hide-details single-line label='Locale' + :items='langs' + v-model='selectedLang' ) v-select.ml-2( outline hide-details single-line label='Publish State' + :items='states' + v-model='selectedState' ) v-spacer v-divider v-data-table( - :items='pages' + :items='filteredPages' :headers='headers' :search='search' :pagination.sync='pagination' @@ -61,11 +65,12 @@ td {{ props.item.updatedAt | moment('calendar') }} template(slot='no-data') v-alert.ma-3(icon='warning', :value='true', outline) No pages to display. - .text-xs-center.py-2(v-if='this.pageTotal > 1') + .text-xs-center.py-2.animated.fadeInDown(v-if='this.pageTotal > 1') v-pagination(v-model='pagination.page', :length='pageTotal')