Skip to content

Commit

Permalink
javaScriptSettings returns Box[LiftSession=>JsObj]
Browse files Browse the repository at this point in the history
We remove autoIncludeJSSettings in favor of an Empty Box
returned from javaScriptSettings; we also fix the
capitalization of javaScriptSettings (it was
javascriptSettings).
  • Loading branch information
Shadowfiend committed May 13, 2014
1 parent 3c1f33f commit c6f033b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
7 changes: 3 additions & 4 deletions web/webkit/src/main/scala/net/liftweb/http/LiftMerge.scala
Expand Up @@ -34,10 +34,9 @@ private[http] trait LiftMerge {
// Gather all page-specific JS into one JsCmd.
private def assemblePageSpecificJavaScript: JsCmd = {
val allJs =
Some(LiftRules.autoIncludeJSSettings.vend().apply(this)).collect {
case true =>
LiftJavaScript.initCmd(LiftRules.javascriptSettings.vend().apply(this))
} ++
LiftRules.javaScriptSettings.vend().map { settingsFn =>
LiftJavaScript.initCmd(settingsFn(this))
}.toList ++
S.jsToAppend

allJs.foldLeft(js.JsCmds.Noop)(_ & _)
Expand Down
13 changes: 4 additions & 9 deletions web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
Expand Up @@ -1573,16 +1573,11 @@ class LiftRules() extends Factory with FormVendor with LazyLoggable {
new FactoryMaker(() => () => (session: LiftSession) => true) {}

/**
* Tells Lift if the Ajax/Comet JavaScript should be initialized with LiftRules via LiftJavaScript
* Tells Lift which JavaScript settings to use. If Empty, does not
* include the JS settings.
*/
val autoIncludeJSSettings: FactoryMaker[() => LiftSession => Boolean] =
new FactoryMaker(() => () => (session: LiftSession) => true) {}

/**
* Tells Lift which JavaScript settings to use.
*/
val javascriptSettings: FactoryMaker[() => LiftSession => JsObj] =
new FactoryMaker(() => () => (session: LiftSession) => LiftJavaScript.settings) {}
val javaScriptSettings: FactoryMaker[() => Box[LiftSession => JsObj]] =
new FactoryMaker(() => () => (Full((session: LiftSession) => LiftJavaScript.settings): Box[LiftSession => JsObj])) {}

/**
* Define the XHTML validator
Expand Down

0 comments on commit c6f033b

Please sign in to comment.