From 085c2529d979f7cd7987c6ef276e859065218e1b Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Mon, 13 Aug 2018 12:13:44 +0100 Subject: [PATCH] Inject isOverleaf setting globally --- services/web/app/coffee/infrastructure/ExpressLocals.coffee | 4 ++++ services/web/app/views/layout.pug | 1 + 2 files changed, 5 insertions(+) diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index 5c71afbe5d..f31d94b8e2 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -333,3 +333,7 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)-> defaultLineHeight : if isOl then 'normal' else 'compact' renderAnnouncements : !isOl next() + + webRouter.use (req, res, next) -> + res.locals.exposedSettings = + isOverleaf: Settings.overleaf? diff --git a/services/web/app/views/layout.pug b/services/web/app/views/layout.pug index 9e633667eb..d820f2b4a1 100644 --- a/services/web/app/views/layout.pug +++ b/services/web/app/views/layout.pug @@ -70,6 +70,7 @@ html(itemscope, itemtype='http://schema.org/Product') window.systemMessages = !{JSON.stringify(systemMessages).replace(/\//g, '\\/')}; window.ab = {}; window.user_id = '#{getLoggedInUserId()}'; + window.exposedSettings = JSON.parse('!{JSON.stringify(exposedSettings).replace(/\//g, "\\/")}'); - if (typeof(settings.algolia) != "undefined") script.