From 197b6b41605ddc5ebee70b39baea28e240e6d161 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 10 Jun 2018 23:23:09 -0400 Subject: [PATCH] feat: theming resolvers + config fixes --- client/components/admin.vue | 21 ++++--- client/components/admin/admin-rendering.vue | 2 +- client/components/admin/admin-theme.vue | 67 +++++++++++++++++++-- client/components/common/user-search.vue | 6 +- client/components/nav-header.vue | 7 ++- client/graph/admin-theme-mutation-save.gql | 12 ++++ dev/templates/master.pug | 4 +- server/app/data.yml | 30 ++++----- server/core/auth.js | 3 +- server/core/logger.js | 18 ++++-- server/graph/resolvers/theming.js | 42 +++++++++++++ server/graph/schemas/theming.graphql | 46 ++++++++++++++ server/master.js | 2 +- server/setup.js | 3 + server/views/master.pug | 4 +- 15 files changed, 221 insertions(+), 46 deletions(-) create mode 100644 client/graph/admin-theme-mutation-save.gql create mode 100644 server/graph/resolvers/theming.js create mode 100644 server/graph/schemas/theming.graphql diff --git a/client/components/admin.vue b/client/components/admin.vue index 2790496c..cb8ecb00 100644 --- a/client/components/admin.vue +++ b/client/components/admin.vue @@ -7,7 +7,7 @@ v-list-tile-avatar: v-icon dashboard v-list-tile-title Dashboard v-divider.my-2 - v-subheader Site + v-subheader.pl-4 Site v-list-tile(to='/general') v-list-tile-avatar: v-icon widgets v-list-tile-title General @@ -21,7 +21,7 @@ v-list-tile-avatar: v-icon palette v-list-tile-title Theme v-divider.my-2 - v-subheader Users + v-subheader.pl-4 Users v-list-tile(to='/groups') v-list-tile-avatar: v-icon people v-list-tile-title Groups @@ -33,19 +33,19 @@ v-chip(small, disabled, color='grey lighten-4') .caption.grey--text 1 v-divider.my-2 - v-subheader Modules + v-subheader.pl-4 Modules v-list-tile(to='/auth') v-list-tile-avatar: v-icon lock_outline v-list-tile-title Authentication - v-list-tile(to='/rendering') - v-list-tile-avatar: v-icon system_update_alt - v-list-tile-title Content Rendering v-list-tile(to='/editor') v-list-tile-avatar: v-icon transform v-list-tile-title Editor v-list-tile(to='/logging') v-list-tile-avatar: v-icon graphic_eq v-list-tile-title Logging + v-list-tile(to='/rendering') + v-list-tile-avatar: v-icon system_update_alt + v-list-tile-title Rendering v-list-tile(to='/search') v-list-tile-avatar: v-icon search v-list-tile-title Search Engine @@ -53,7 +53,7 @@ v-list-tile-avatar: v-icon storage v-list-tile-title Storage v-divider.my-2 - v-subheader System + v-subheader.pl-4 System v-list-tile(to='/api') v-list-tile-avatar: v-icon call_split v-list-tile-title API Access @@ -96,7 +96,7 @@ import { mapState } from 'vuex' import adminStore from '@/store/admin' -/* global WIKI */ +/* global WIKI, siteConfig */ WIKI.$store.registerModule('admin', adminStore) @@ -143,7 +143,10 @@ export default { set(newState) { this.$store.commit('updateNotificationState', newState) } } }, - router + router, + mounted() { + this.$store.commit('admin/setThemeDarkMode', siteConfig.darkMode) + } } diff --git a/client/components/admin/admin-rendering.vue b/client/components/admin/admin-rendering.vue index dc4514af..a44dae69 100644 --- a/client/components/admin/admin-rendering.vue +++ b/client/components/admin/admin-rendering.vue @@ -2,7 +2,7 @@ v-container(fluid, fill-height) v-layout(row wrap) v-flex(xs12) - .headline.primary--text Content Rendering + .headline.primary--text Rendering .subheading.grey--text Configure how content is rendered diff --git a/client/components/admin/admin-theme.vue b/client/components/admin/admin-theme.vue index 6a0f845d..85066f30 100644 --- a/client/components/admin/admin-theme.vue +++ b/client/components/admin/admin-theme.vue @@ -12,7 +12,14 @@ v-toolbar-title .subheading Theme v-card-text - v-select(:items='themes', prepend-icon='palette', v-model='selectedTheme', label='Site Theme', persistent-hint, hint='Themes affect how content pages are displayed. Other site sections (such as the editor or admin area) are not affected.') + v-select( + :items='themes' + prepend-icon='palette' + v-model='selectedTheme' + label='Site Theme' + persistent-hint + hint='Themes affect how content pages are displayed. Other site sections (such as the editor or admin area) are not affected.' + ) template(slot='item', slot-scope='data') v-list-tile-avatar v-icon.blue--text(dark) filter_frames @@ -20,7 +27,13 @@ v-list-tile-title(v-html='data.item.text') v-list-tile-sub-title(v-html='data.item.author') v-divider - v-switch(v-model='darkMode', label='Dark Mode', color='primary', persistent-hint, hint='Not recommended for accessibility.') + v-switch( + v-model='darkMode' + label='Dark Mode' + color='primary' + persistent-hint + hint='Not recommended for accessibility. May not be supported by all themes.' + ) v-card-chin v-spacer v-btn(color='primary', :loading='loading', @click='save') @@ -35,20 +48,66 @@