From 8c6aca6623e5b4459914226f02cbeb629e247b6a Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Tue, 1 Jan 2019 17:03:30 -0500 Subject: [PATCH] feat: unsaved changes prompt + beta preparations UI --- client/components/admin/admin-general.vue | 48 ++++--- client/components/admin/admin-groups.vue | 2 +- client/components/admin/admin-pages.vue | 8 +- client/components/admin/admin-search.vue | 1 + .../admin/admin-users-authorize.vue | 95 -------------- .../components/admin/admin-users-create.vue | 48 +++++-- client/components/admin/admin-users.vue | 14 +- client/components/editor.vue | 123 ++++++------------ .../editor/editor-modal-editorselect.vue | 103 +++++++++++++++ .../editor/editor-modal-unsaved.vue | 40 ++++++ .../admin/site/site-mutation-save-config.gql | 6 +- client/graph/admin/site/site-query-config.gql | 3 +- client/store/editor.js | 1 + server/graph/resolvers/site.js | 3 +- server/graph/schemas/site.graphql | 6 +- server/setup.js | 3 +- 16 files changed, 272 insertions(+), 232 deletions(-) delete mode 100644 client/components/admin/admin-users-authorize.vue create mode 100644 client/components/editor/editor-modal-editorselect.vue create mode 100644 client/components/editor/editor-modal-unsaved.vue diff --git a/client/components/admin/admin-general.vue b/client/components/admin/admin-general.vue index 1ddcf341..79928ab0 100644 --- a/client/components/admin/admin-general.vue +++ b/client/components/admin/admin-general.vue @@ -61,36 +61,41 @@ persistent-hint ) v-divider - v-subheader Analytics + v-subheader Analytics #[v-chip.ml-2(label, color='grey', small, outline) coming soon] .px-3.pb-3 - v-text-field( + v-select.mt-2( outline - label='Google Analytics ID' + label='Analytics Service Provider' + :items='analyticsServices' + v-model='config.analyticsService' + prepend-icon='timeline' + ) + v-text-field.mt-2( + v-if='config.analyticsService !== ``' + outline + label='Property Tracking ID' :counter='255' - v-model='config.ga' + v-model='config.analyticsId' prepend-icon='timeline' persistent-hint - hint='Property tracking ID for Google Analytics. Leave empty to disable.' + hint='A unique identifier provided by your analytics service provider.' ) v-flex(lg6 xs12) v-card.wiki-form v-toolbar(color='primary', dark, dense, flat) v-toolbar-title .subheading {{ $t('admin:general.siteBranding') }} - v-spacer - v-chip(label, color='white', small).primary--text coming soon - v-subheader Logo + v-subheader Logo #[v-chip.ml-2(label, color='grey', small, outline) coming soon] v-card-text v-layout.px-3(row, align-center) v-avatar(size='120', :color='$vuetify.dark ? `grey darken-2` : `grey lighten-3`', :tile='config.logoIsSquare') .ml-4 - v-layout(row, align-center) - v-btn(color='teal', depressed, dark) - v-icon(left) cloud_upload - span Upload Logo - v-btn(color='teal', depressed, disabled) - v-icon(left) clear - span Clear + v-btn.mx-0(color='teal', depressed, disabled) + v-icon(left) cloud_upload + span Upload Logo + v-btn(color='teal', depressed, disabled) + v-icon(left) clear + span Clear .caption.grey--text An image of 120x120 pixels is recommended for best results. .caption.grey--text SVG, PNG or JPG files only. v-switch( @@ -117,6 +122,8 @@ v-toolbar(color='primary', dark, dense, flat) v-toolbar-title .subheading Features + v-spacer + v-chip(label, color='white', small).primary--text coming soon v-card-text v-switch( label='Page Ratings' @@ -153,6 +160,11 @@ import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.g export default { data() { return { + analyticsServices: [ + { text: 'None', value: '' }, + { text: 'Google Analytics', value: 'ga' }, + { text: 'Google Tag Manager', value: 'gtm' }, + ], metaRobots: [ { text: 'Index', value: 'index' }, { text: 'Follow', value: 'follow' }, @@ -164,7 +176,8 @@ export default { title: '', description: '', robots: [], - ga: '', + analyticsService: '', + analyticsId: '', company: '', hasLogo: false, logoIsSquare: false, @@ -189,7 +202,8 @@ export default { title: this.config.title || '', description: this.config.description || '', robots: this.config.robots || [], - ga: this.config.ga || '', + analyticsService: this.config.analyticsService || '', + analyticsId: this.config.analyticsId || '', company: this.config.company || '', hasLogo: this.config.hasLogo || false, logoIsSquare: this.config.logoIsSquare || false, diff --git a/client/components/admin/admin-groups.vue b/client/components/admin/admin-groups.vue index 12009a15..0a43b695 100644 --- a/client/components/admin/admin-groups.vue +++ b/client/components/admin/admin-groups.vue @@ -54,7 +54,7 @@ span System Group template(slot='no-data') v-alert.ma-3(icon='warning', :value='true', outline) No groups to display. - .text-xs-center.py-2(v-if='groups.length > 15') + .text-xs-center.py-2(v-if='this.pages > 0') v-pagination(v-model='pagination.page', :length='pages') diff --git a/client/components/admin/admin-pages.vue b/client/components/admin/admin-pages.vue index 1b884364..dec02278 100644 --- a/client/components/admin/admin-pages.vue +++ b/client/components/admin/admin-pages.vue @@ -6,11 +6,11 @@ img(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 + .subheading.grey--text Manage pages #[v-chip(label, color='primary', small).white--text coming soon] v-spacer - v-btn(color='grey', outline, @click='refresh', large) + v-btn(color='grey', outline, @click='refresh', large, disabled) v-icon.grey--text refresh - v-btn(color='primary', depressed, large, @click='newpage') + v-btn(color='primary', depressed, large, @click='newpage', disabled) v-icon(left) add span New Page v-card.mt-3 @@ -31,7 +31,7 @@ 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='groups.length > 15') + .text-xs-center.py-2(v-if='this.pages > 0') v-pagination(v-model='pagination.page', :length='pages') page-selector(v-model='pageSelectorShown', mode='new') diff --git a/client/components/admin/admin-search.vue b/client/components/admin/admin-search.vue index 07f1d241..06c2fce3 100644 --- a/client/components/admin/admin-search.vue +++ b/client/components/admin/admin-search.vue @@ -35,6 +35,7 @@ :value='engine.key' color='primary' hide-details + disabled ) v-tab-item(v-for='(engine, n) in activeEngines', :key='engine.key', :transition='false', :reverse-transition='false') diff --git a/client/components/admin/admin-users-authorize.vue b/client/components/admin/admin-users-authorize.vue deleted file mode 100644 index 8fdd7775..00000000 --- a/client/components/admin/admin-users-authorize.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - diff --git a/client/components/admin/admin-users-create.vue b/client/components/admin/admin-users-create.vue index c9842fd0..d813d9f7 100644 --- a/client/components/admin/admin-users-create.vue +++ b/client/components/admin/admin-users-create.vue @@ -1,8 +1,18 @@ diff --git a/client/components/admin/admin-users.vue b/client/components/admin/admin-users.vue index e2458a29..b637d8ea 100644 --- a/client/components/admin/admin-users.vue +++ b/client/components/admin/admin-users.vue @@ -10,12 +10,9 @@ v-spacer v-btn(outline, color='grey', large, @click='refresh') v-icon refresh - v-btn(color='primary', large, outline, @click='authorizeUser') - v-icon(left) lock_outline - span Authorize Social User v-btn(color='primary', large, depressed, @click='createUser') v-icon(left) add - span New Local User + span New User v-card.mt-3 v-data-table( v-model='selected' @@ -54,24 +51,21 @@ template(slot='no-data') .pa-3 v-alert(icon='warning', :value='true', outline) No users to display! - v-card-chin + v-card-chin(v-if='this.pages > 0') v-spacer v-pagination(v-model='pagination.page', :length='pages') v-spacer - user-authorize(v-model='isAuthorizeDialogShown') user-create(v-model='isCreateDialogShown') + + diff --git a/client/components/editor/editor-modal-unsaved.vue b/client/components/editor/editor-modal-unsaved.vue new file mode 100644 index 00000000..e5e583cb --- /dev/null +++ b/client/components/editor/editor-modal-unsaved.vue @@ -0,0 +1,40 @@ + + + diff --git a/client/graph/admin/site/site-mutation-save-config.gql b/client/graph/admin/site/site-mutation-save-config.gql index d018f159..6a0fc4e2 100644 --- a/client/graph/admin/site/site-mutation-save-config.gql +++ b/client/graph/admin/site/site-mutation-save-config.gql @@ -3,7 +3,8 @@ mutation ( $title: String! $description: String! $robots: [String]! - $ga: String! + $analyticsService: String! + $analyticsId: String! $company: String! $hasLogo: Boolean! $logoIsSquare: Boolean! @@ -17,7 +18,8 @@ mutation ( title: $title, description: $description, robots: $robots, - ga: $ga, + analyticsService: $analyticsService, + analyticsId: $analyticsId, company: $company, hasLogo: $hasLogo, logoIsSquare: $logoIsSquare, diff --git a/client/graph/admin/site/site-query-config.gql b/client/graph/admin/site/site-query-config.gql index 1ef1f3ec..0a1295d7 100644 --- a/client/graph/admin/site/site-query-config.gql +++ b/client/graph/admin/site/site-query-config.gql @@ -5,7 +5,8 @@ title description robots - ga + analyticsService + analyticsId company hasLogo logoIsSquare diff --git a/client/store/editor.js b/client/store/editor.js index 5af3d0b7..8011f427 100644 --- a/client/store/editor.js +++ b/client/store/editor.js @@ -1,6 +1,7 @@ import { make } from 'vuex-pathify' const state = { + editor: '', content: '', mode: 'create' } diff --git a/server/graph/resolvers/site.js b/server/graph/resolvers/site.js index ee6356c1..0e1cf308 100644 --- a/server/graph/resolvers/site.js +++ b/server/graph/resolvers/site.js @@ -31,7 +31,8 @@ module.exports = { WIKI.config.seo = { description: args.description, robots: args.robots, - ga: args.ga + analyticsService: args.analyticsService, + analyticsId: args.analyticsId } WIKI.config.logo = { hasLogo: args.hasLogo, diff --git a/server/graph/schemas/site.graphql b/server/graph/schemas/site.graphql index 64455ae5..ae23ca8d 100644 --- a/server/graph/schemas/site.graphql +++ b/server/graph/schemas/site.graphql @@ -28,7 +28,8 @@ type SiteMutation { title: String! description: String! robots: [String]! - ga: String! + analyticsService: String! + analyticsId: String! company: String! hasLogo: Boolean! logoIsSquare: Boolean! @@ -47,7 +48,8 @@ type SiteConfig { title: String! description: String! robots: [String]! - ga: String! + analyticsService: String! + analyticsId: String! company: String! hasLogo: Boolean! logoIsSquare: Boolean! diff --git a/server/setup.js b/server/setup.js index 961429ad..b35cde35 100644 --- a/server/setup.js +++ b/server/setup.js @@ -140,7 +140,8 @@ module.exports = () => { _.set(WIKI.config, 'seo', { description: '', robots: ['index', 'follow'], - ga: '' + analyticsService: '', + analyticsId: '' }) _.set(WIKI.config, 'sessionSecret', (await crypto.randomBytesAsync(32)).toString('hex')) _.set(WIKI.config, 'telemetry', {