|
|
@@ -45,7 +45,6 @@ pathList = [
|
|
|
"/stylesheets/style.css"
|
|
|
"/stylesheets/ol-style.css"
|
|
|
"/stylesheets/ol-light-style.css"
|
|
|
- "/stylesheets/ol-ieee-style.css"
|
|
|
].concat(Modules.moduleAssetFiles(jsPath))
|
|
|
|
|
|
if !Settings.useMinifiedJs
|
|
|
@@ -127,6 +126,7 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
res.locals.lib = PackageVersions.lib
|
|
|
|
|
|
|
|
|
+
|
|
|
res.locals.buildJsPath = (jsFile, opts = {})->
|
|
|
path = Path.join(jsPath, jsFile)
|
|
|
|
|
|
@@ -157,39 +157,20 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
else
|
|
|
return res.locals.buildJsPath(jsFile, opts)
|
|
|
|
|
|
-
|
|
|
- IEEE_BRAND_ID = 15
|
|
|
- res.locals.isIEEE = (brandVariation) ->
|
|
|
- brandVariation?.brand_id == IEEE_BRAND_ID
|
|
|
-
|
|
|
- _buildCssFileName = (themeModifier) ->
|
|
|
- return "/" + Settings.brandPrefix + (if themeModifier then themeModifier else "") + "style.css"
|
|
|
-
|
|
|
- _buildCssPath = (cssFileName, isHashed) ->
|
|
|
- path = Path.join("/stylesheets/", cssFileName)
|
|
|
- if isHashed && hashedFiles[path]?
|
|
|
+ res.locals.buildCssPath = (cssFile, opts)->
|
|
|
+ path = Path.join("/stylesheets/", cssFile)
|
|
|
+ if opts?.hashedPath && hashedFiles[path]?
|
|
|
hashedPath = hashedFiles[path]
|
|
|
return Url.resolve(staticFilesBase, hashedPath)
|
|
|
return Url.resolve(staticFilesBase, path)
|
|
|
|
|
|
- res.locals.getCssThemeModifier = (userSettings, brandVariation) ->
|
|
|
- # Themes only exist in OL v2
|
|
|
- if Settings.overleaf?
|
|
|
- # The IEEE theme takes precedence over the user personal setting, i.e. a user with
|
|
|
- # a theme setting of "light" will still get the IEE theme in IEEE branded projects.
|
|
|
- if res.locals.isIEEE(brandVariation)
|
|
|
- themeModifier = "ieee-"
|
|
|
- else if userSettings?.overallTheme?
|
|
|
- themeModifier = userSettings.overallTheme
|
|
|
- return themeModifier
|
|
|
-
|
|
|
- res.locals.buildCssPath = (themeModifier, buildOpts) ->
|
|
|
- cssFileName = _buildCssFileName themeModifier
|
|
|
- path = Path.join("/stylesheets/", cssFileName)
|
|
|
- if buildOpts?.isHashed && hashedFiles[path]?
|
|
|
- hashedPath = hashedFiles[path]
|
|
|
- return Url.resolve(staticFilesBase, hashedPath)
|
|
|
- return Url.resolve(staticFilesBase, path)
|
|
|
+ res.locals.buildCssFileNameForUser = (userSettings) ->
|
|
|
+ if userSettings?.overallTheme? and Settings.overleaf?
|
|
|
+ themeModifier = userSettings.overallTheme
|
|
|
+ return res.locals.buildCssFileName(themeModifier)
|
|
|
+
|
|
|
+ res.locals.buildCssFileName = (themeModifier) ->
|
|
|
+ return "/" + Settings.brandPrefix + (if themeModifier then themeModifier else "") + "style.css"
|
|
|
|
|
|
res.locals.buildImgPath = (imgFile)->
|
|
|
path = Path.join("/img/", imgFile)
|
|
|
@@ -202,6 +183,8 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
|
|
|
next()
|
|
|
|
|
|
+
|
|
|
+
|
|
|
webRouter.use (req, res, next)->
|
|
|
res.locals.settings = Settings
|
|
|
next()
|
|
|
@@ -361,11 +344,10 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
next()
|
|
|
|
|
|
webRouter.use (req, res, next) ->
|
|
|
- #TODO
|
|
|
if Settings.overleaf?
|
|
|
res.locals.overallThemes = [
|
|
|
- { name: "Default", val: "", path: res.locals.buildCssPath(null, { hashedPath: true }) }
|
|
|
- { name: "Light", val: "light-", path: res.locals.buildCssPath("light-", { hashedPath: true }) }
|
|
|
+ { name: "Default", val: "", path: res.locals.buildCssPath(res.locals.buildCssFileName(), {hashedPath:true}) }
|
|
|
+ { name: "Light", val: "light-", path: res.locals.buildCssPath(res.locals.buildCssFileName("light-"), {hashedPath:true}) }
|
|
|
]
|
|
|
next()
|
|
|
|