Permalink
Browse files

Added helper methods

  • Loading branch information...
1 parent cbc5a96 commit a9a83d218f0336d6d9812eaa56608f0efc772eb4 @dpp dpp committed Feb 24, 2011
@@ -57,6 +57,11 @@ trait Loc[T] {
case _ => Nil
}.headOption.map(_.cssClass.func)
+ /**
+ * Given a value calculate the HREF to this item
+ */
+ def calcHref(in: T): String = link.createPath(in)
+
def defaultValue: Box[T]
def currentValue: Box[T] = overrideValue or requestValue.is or defaultValue
@@ -175,6 +175,13 @@ object Menu extends MenuSingleton {
* Convert a Menuable into a Menu when you need a Menu.
*/
implicit def toMenu(able: ParamMenuable[_]): Menu = able.toMenu
+
+ /**
+ * Convert a Menuable into a Loc[T]
+ */
+ implicit def toLoc[T](able: ParamMenuable[T]): Loc[T] =
+ able.toMenu.loc.asInstanceOf[Loc[T]]
+
}
/**

0 comments on commit a9a83d2

Please sign in to comment.