Permalink
Browse files

Added TemplateBox for better integration with Templates() template lo…

…okup
  • Loading branch information...
1 parent cf2a525 commit a3eca646b926ffcae5e318c41999fcf02bc8f36f @dpp dpp committed Aug 26, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 web/webkit/src/main/scala/net/liftweb/sitemap/Loc.scala
@@ -333,6 +333,8 @@ trait Loc[T] {
allParams.flatMap {
case Loc.Template(f) => Some(f());
case Loc.ValueTemplate(f) => Some(f(currentValue));
+ case Loc.TemplateBox(f) => f()
+ case Loc.ValueTemplateBox(f) => f(currentValue)
case _ => None
}.headOption
@@ -613,6 +615,14 @@ object Loc {
case class Template(template: () => NodeSeq) extends AnyLocParam
case class ValueTemplate[T](template: Box[T] => NodeSeq) extends LocParam[T]
+ /**
+ * Allows a user to specify a template based upon a function from the current
+ * value encapsulated in the Loc. Allow the return of Box[NodeSeq] so that it's more
+ * friendly to Templates.
+ */
+ case class TemplateBox(template: () => Box[NodeSeq]) extends AnyLocParam
+ case class ValueTemplateBox[T](template: Box[T] => Box[NodeSeq]) extends LocParam[T]
+
/**
* This LocParam may be used to specify a function that calculates a title for the page
* based upon the current value encapsulated by this Loc.

0 comments on commit a3eca64

Please sign in to comment.