From 1914d405748ffceb903356a71d095de8e4deb58a Mon Sep 17 00:00:00 2001 From: NGPixel Date: Fri, 31 Jan 2020 22:29:40 -0500 Subject: [PATCH] fix: set rtl correctly if default lang is non-rtl --- client/components/admin/admin-groups.vue | 2 +- server/controllers/common.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client/components/admin/admin-groups.vue b/client/components/admin/admin-groups.vue index cfbfd6f5..8af224c6 100644 --- a/client/components/admin/admin-groups.vue +++ b/client/components/admin/admin-groups.vue @@ -57,7 +57,7 @@ v-icon(v-on='on') mdi-lock-outline span System Group template(slot='no-data') - v-alert.ma-3(icon='warning', :value='true', outline) No groups to display. + v-alert.ma-3(icon='mdi-alert', :value='true', outline) No groups to display. .text-xs-center.py-2(v-if='pageCount > 1') v-pagination(v-model='pagination', :length='pageCount') diff --git a/server/controllers/common.js b/server/controllers/common.js index 10de9490..e915946c 100644 --- a/server/controllers/common.js +++ b/server/controllers/common.js @@ -47,6 +47,7 @@ router.get(['/e', '/e/*'], async (req, res, next) => { } _.set(res, 'locals.siteConfig.lang', pageArgs.locale) + _.set(res, 'locals.siteConfig.rtl', req.i18n.dir()) if (pageHelper.isReservedPath(pageArgs.path)) { return next(new Error('Cannot create this page because it starts with a system reserved path.')) @@ -110,6 +111,7 @@ router.get(['/h', '/h/*'], async (req, res, next) => { } _.set(res, 'locals.siteConfig.lang', pageArgs.locale) + _.set(res, 'locals.siteConfig.rtl', req.i18n.dir()) const page = await WIKI.models.pages.getPageFromDb({ path: pageArgs.path, @@ -195,6 +197,7 @@ router.get(['/s', '/s/*'], async (req, res, next) => { } _.set(res, 'locals.siteConfig.lang', pageArgs.locale) + _.set(res, 'locals.siteConfig.rtl', req.i18n.dir()) if (!WIKI.auth.checkAccess(req.user, ['read:source'], pageArgs)) { return res.render('unauthorized', { action: 'source' }) @@ -252,11 +255,12 @@ router.get('/*', async (req, res, next) => { } _.set(res, 'locals.siteConfig.lang', pageArgs.locale) + _.set(res, 'locals.siteConfig.rtl', req.i18n.dir()) if (page) { _.set(res.locals, 'pageMeta.title', page.title) _.set(res.locals, 'pageMeta.description', page.description) - const sidebar = await WIKI.models.navigation.getTree({ cache: true }) + const sidebar = await WIKI.models.navigation.getTree({ cache: true, locale: pageArgs.locale }) const injectCode = { css: WIKI.config.theming.injectCSS, head: WIKI.config.theming.injectHead,