瀏覽代碼

Create uiConfig Pug local; render it in the HTML.

Paulo Reis 9 年之前
父節點
當前提交
71604ebd5c

+ 9 - 0
services/web/app/coffee/infrastructure/ExpressLocals.coffee

@@ -290,3 +290,12 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
 		res.locals.moduleIncludes = Modules.moduleIncludes
 		res.locals.moduleIncludes = Modules.moduleIncludes
 		res.locals.moduleIncludesAvailable = Modules.moduleIncludesAvailable
 		res.locals.moduleIncludesAvailable = Modules.moduleIncludesAvailable
 		next()
 		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()

+ 1 - 0
services/web/app/views/project/editor.pug

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