From 4b33a83d4e097a4e4110d7114baee277ce95ccd4 Mon Sep 17 00:00:00 2001 From: Bamieh Date: Sun, 27 Aug 2017 15:19:44 +0300 Subject: [PATCH] viewSource theme config --- config.sample.yml | 1 + server/app/data.yml | 1 + server/libs/config.js | 1 + server/views/pages/view.pug | 7 ++++--- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config.sample.yml b/config.sample.yml index e6a9d748..75a95711 100644 --- a/config.sample.yml +++ b/config.sample.yml @@ -162,6 +162,7 @@ externalLogging: theme: primary: indigo alt: blue-grey + viewSource: "all" footer: blue-grey code: dark: true diff --git a/server/app/data.yml b/server/app/data.yml index da16577b..8c00837b 100644 --- a/server/app/data.yml +++ b/server/app/data.yml @@ -61,6 +61,7 @@ defaults: primary: indigo alt: blue-grey footer: blue-grey + viewSource: "none" code: dark: true colorize: true diff --git a/server/libs/config.js b/server/libs/config.js index 92eac339..810af0d7 100644 --- a/server/libs/config.js +++ b/server/libs/config.js @@ -28,6 +28,7 @@ module.exports = (confPaths) => { fs.readFileSync(confPaths.config, 'utf8') ) ) + appdata = yaml.safeLoad(fs.readFileSync(confPaths.data, 'utf8')) appdata.regex = require(confPaths.dataRegex) } catch (ex) { diff --git a/server/views/pages/view.pug b/server/views/pages/view.pug index 885fd5b6..90d66f0f 100644 --- a/server/views/pages/view.pug +++ b/server/views/pages/view.pug @@ -15,9 +15,10 @@ block rootNavRight a.button.is-outlined(v-on:click='$store.dispatch("modalMovePage/open")') i.nc-icon-outline.arrows-1_shuffle-98 span= t('nav.move') - a.button.is-outlined(href='/source/' + pageData.meta.path) - i.nc-icon-outline.education_paper - span= t('nav.source') + if appconfig.theme.viewSource == "all" || rights.write && appconfig.theme.viewSource == "write" + a.button.is-outlined(href='/source/' + pageData.meta.path) + i.nc-icon-outline.education_paper + span= t('nav.source') //-a.button.is-outlined(href='/hist/' + pageData.meta.path) i.nc-icon-outline.ui-2_time span= t('nav.history')