|
@@ -45,6 +45,7 @@ pathList = [
|
|
|
"/stylesheets/style.css"
|
|
"/stylesheets/style.css"
|
|
|
"/stylesheets/ol-style.css"
|
|
"/stylesheets/ol-style.css"
|
|
|
"/stylesheets/ol-light-style.css"
|
|
"/stylesheets/ol-light-style.css"
|
|
|
|
|
+ "/stylesheets/ol-ieee-style.css"
|
|
|
].concat(Modules.moduleAssetFiles(jsPath))
|
|
].concat(Modules.moduleAssetFiles(jsPath))
|
|
|
|
|
|
|
|
if !Settings.useMinifiedJs
|
|
if !Settings.useMinifiedJs
|
|
@@ -126,7 +127,6 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
res.locals.lib = PackageVersions.lib
|
|
res.locals.lib = PackageVersions.lib
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
res.locals.buildJsPath = (jsFile, opts = {})->
|
|
res.locals.buildJsPath = (jsFile, opts = {})->
|
|
|
path = Path.join(jsPath, jsFile)
|
|
path = Path.join(jsPath, jsFile)
|
|
|
|
|
|
|
@@ -157,20 +157,39 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
else
|
|
else
|
|
|
return res.locals.buildJsPath(jsFile, opts)
|
|
return res.locals.buildJsPath(jsFile, opts)
|
|
|
|
|
|
|
|
- res.locals.buildCssPath = (cssFile, opts)->
|
|
|
|
|
- path = Path.join("/stylesheets/", cssFile)
|
|
|
|
|
- if opts?.hashedPath && hashedFiles[path]?
|
|
|
|
|
|
|
+
|
|
|
|
|
+ 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]?
|
|
|
hashedPath = hashedFiles[path]
|
|
hashedPath = hashedFiles[path]
|
|
|
return Url.resolve(staticFilesBase, hashedPath)
|
|
return Url.resolve(staticFilesBase, hashedPath)
|
|
|
return Url.resolve(staticFilesBase, path)
|
|
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.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.buildImgPath = (imgFile)->
|
|
res.locals.buildImgPath = (imgFile)->
|
|
|
path = Path.join("/img/", imgFile)
|
|
path = Path.join("/img/", imgFile)
|
|
@@ -183,8 +202,6 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
|
|
|
|
|
next()
|
|
next()
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
webRouter.use (req, res, next)->
|
|
webRouter.use (req, res, next)->
|
|
|
res.locals.settings = Settings
|
|
res.locals.settings = Settings
|
|
|
next()
|
|
next()
|
|
@@ -344,10 +361,11 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)->
|
|
|
next()
|
|
next()
|
|
|
|
|
|
|
|
webRouter.use (req, res, next) ->
|
|
webRouter.use (req, res, next) ->
|
|
|
|
|
+ #TODO
|
|
|
if Settings.overleaf?
|
|
if Settings.overleaf?
|
|
|
res.locals.overallThemes = [
|
|
res.locals.overallThemes = [
|
|
|
- { 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}) }
|
|
|
|
|
|
|
+ { name: "Default", val: "", path: res.locals.buildCssPath(null, { hashedPath: true }) }
|
|
|
|
|
+ { name: "Light", val: "light-", path: res.locals.buildCssPath("light-", { hashedPath: true }) }
|
|
|
]
|
|
]
|
|
|
next()
|
|
next()
|
|
|
|
|
|