Create uiConfig Pug local; render it in the HTML.

This commit is contained in:
Paulo Reis 2017-11-30 15:12:36 +00:00
parent 74ba7402de
commit 71604ebd5c
2 changed files with 10 additions and 0 deletions

View file

@ -290,3 +290,12 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
res.locals.moduleIncludes = Modules.moduleIncludes
res.locals.moduleIncludesAvailable = Modules.moduleIncludesAvailable
next()
webRouter.use (req, res, next) ->
isOl = (Settings.brandPrefix == 'ol-')
res.locals.uiConfig =
defaultResizerSizeOpen : if isOl then 2 else 24
defaultResizerSizeClosed : if isOl then 2 else 24
chatResizerSizeOpen : if isOl then 2 else 6
chatResizerSizeClosed : 0
next()

View file

@ -157,6 +157,7 @@ block requirejs
window.aceFingerprint = "#{fingerprint(jsPath + lib('ace') + '/ace.js')}"
window.aceWorkerPath = "#{aceWorkerPath}";
window.pdfCMapsPath = "#{pdfCMapsPath}"
window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}');
script(
data-main=buildJsPath("ide.js", {fingerprint:false}),