Permalink
Browse files

Closes #919. Makes it easier to invoke LiftScreen and Wizard from Lo…

…c.Snippet params
  • Loading branch information...
dpp committed Aug 23, 2011
1 parent 23bfc86 commit f40deb760caa982c18230dfa5c802a03bd03bae5
Showing with 11 additions and 0 deletions.
  1. +11 −0 web/webkit/src/main/scala/net/liftweb/sitemap/Loc.scala
@@ -655,6 +655,17 @@ object Loc {
}
object Snippet {
+ /**
+ * Build a Loc.Snippet instance out of a name and a DispatchSnippet (or StatefulSnippet, LiftScreen or Wizard).
+ * The "render" method will be invoked on the Dispatch snippet
+ */
+ def apply(name: String, snippet: DispatchSnippet): Snippet =
+ new Snippet(name, ns => snippet.dispatch("render")(ns)) // Issue #919
+
+ /**
+ * Build a Loc.Snippet instance for a given name and a function. Note that the function is call-by-name
+ * so that it will be created each time it's used. This is useful for CSS Selector Transforms
+ */
def apply(name: String, func: => NodeSeq => NodeSeq): Snippet = new Snippet(name, func)
def unapply(in: Snippet): Option[(String, NodeSeq => NodeSeq)] = Some(in.name -> in.func)
}

0 comments on commit f40deb7

Please sign in to comment.