From 1dfb55e8034eb128a0820e5633b41158f2e51af3 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 21 Jun 2019 23:39:04 -0400 Subject: [PATCH] feat: default locale with namespacing --- client/components/common/nav-header.vue | 13 +-- client/components/common/page-selector.vue | 80 ++++++++++--------- .../editor/editor-modal-properties.vue | 4 +- client/themes/default/components/page.vue | 2 +- server/app/data.yml | 3 +- server/graph/resolvers/localization.js | 2 +- server/helpers/page.js | 2 +- 7 files changed, 56 insertions(+), 50 deletions(-) diff --git a/client/components/common/nav-header.vue b/client/components/common/nav-header.vue index 7b16bec8..2b75d7e7 100644 --- a/client/components/common/nav-header.vue +++ b/client/components/common/nav-header.vue @@ -145,7 +145,7 @@ v-list.py-0 template(v-for='(lc, idx) of locales') v-list-tile(@click='changeLocale(lc)') - v-list-tile-action: v-chip(:color='lc.code === $i18n.i18next.language ? `blue` : `grey`', small, label, dark) {{lc.code.toUpperCase()}} + v-list-tile-action: v-chip(:color='lc.code === locale ? `blue` : `grey`', small, label, dark) {{lc.code.toUpperCase()}} v-list-tile-title {{lc.name}} v-divider.my-0(v-if='idx < locales.length - 1') v-tooltip(bottom, v-if='isAuthenticated && isAdmin') @@ -231,6 +231,7 @@ export default { isLoading: get('isLoading'), title: get('site/title'), path: get('page/path'), + locale: get('page/locale'), mode: get('page/mode'), name: get('user/name'), email: get('user/email'), @@ -293,19 +294,19 @@ export default { this.newPageModal = true }, pageNewCreate ({ path, locale }) { - window.location.assign(`/e/${path}`) + window.location.assign(`/e/${locale}/${path}`) }, pageView () { - window.location.assign(`/${this.path}`) + window.location.assign(`/${this.locale}/${this.path}`) }, pageEdit () { - window.location.assign(`/e/${this.path}`) + window.location.assign(`/e/${this.locale}/${this.path}`) }, pageHistory () { - window.location.assign(`/h/${this.path}`) + window.location.assign(`/h/${this.locale}/${this.path}`) }, pageSource () { - window.location.assign(`/s/${this.path}`) + window.location.assign(`/s/${this.locale}/${this.path}`) }, pageMove () { this.$store.commit('showNotification', { diff --git a/client/components/common/page-selector.vue b/client/components/common/page-selector.vue index 82300801..d39ae7e1 100644 --- a/client/components/common/page-selector.vue +++ b/client/components/common/page-selector.vue @@ -12,44 +12,44 @@ :width='2' v-show='searchLoading' ) - .d-flex(style='min-height:400px;') - v-flex(xs4).grey(:class='darkMode ? `darken-4` : `lighten-3`') - v-toolbar(color='grey darken-3', dark, dense, flat) - .body-2 Folders - v-spacer - v-btn(icon): v-icon create_new_folder - v-treeview( - v-model='tree' - :items='treeFolders' - :load-children='fetchFolders' - activatable - open-on-click - hoverable - ) - template(slot='prepend', slot-scope='{ item, open, leaf }') - v-icon {{ open ? 'folder_open' : 'folder' }} - v-flex(xs8) - v-toolbar(color='grey darken-2', dark, dense, flat) - .body-2 Pages - v-spacer - v-btn(icon): v-icon forward - v-btn(icon): v-icon delete - v-list(dense) - v-list-tile - v-list-tile-avatar: v-icon insert_drive_file - v-list-tile-title File A - v-divider - v-list-tile - v-list-tile-avatar: v-icon insert_drive_file - v-list-tile-title File B - v-divider - v-list-tile - v-list-tile-avatar: v-icon insert_drive_file - v-list-tile-title File C - v-divider - v-list-tile - v-list-tile-avatar: v-icon insert_drive_file - v-list-tile-title File D + //- .d-flex(style='min-height:400px;') + //- v-flex(xs4).grey(:class='darkMode ? `darken-4` : `lighten-3`') + //- v-toolbar(color='grey darken-3', dark, dense, flat) + //- .body-2 Folders + //- v-spacer + //- v-btn(icon): v-icon create_new_folder + //- v-treeview( + //- v-model='tree' + //- :items='treeFolders' + //- :load-children='fetchFolders' + //- activatable + //- open-on-click + //- hoverable + //- ) + //- template(slot='prepend', slot-scope='{ item, open, leaf }') + //- v-icon {{ open ? 'folder_open' : 'folder' }} + //- v-flex(xs8) + //- v-toolbar(color='grey darken-2', dark, dense, flat) + //- .body-2 Pages + //- v-spacer + //- v-btn(icon): v-icon forward + //- v-btn(icon): v-icon delete + //- v-list(dense) + //- v-list-tile + //- v-list-tile-avatar: v-icon insert_drive_file + //- v-list-tile-title File A + //- v-divider + //- v-list-tile + //- v-list-tile-avatar: v-icon insert_drive_file + //- v-list-tile-title File B + //- v-divider + //- v-list-tile + //- v-list-tile-avatar: v-icon insert_drive_file + //- v-list-tile-title File C + //- v-divider + //- v-list-tile + //- v-list-tile-avatar: v-icon insert_drive_file + //- v-list-tile-title File D v-card-actions.grey.pa-2(:class='darkMode ? `darken-3-d5` : `lighten-1`') v-select( solo @@ -80,6 +80,8 @@