Hello,
I'm having some trouble generating a link basing on a Loc.
My original use-case is to redirect the user to a login page if the user is
not logged in. I found a wiki on this and it says there to simply redirect to
"/user_mgt/login", however I think it would be much nicer if I could generate
the link basing on looking up the right Loc.
However having the Loc I can only generate a NodeSeq, not a plain String.
So the solution would be to add a method into the Loc trait parallel to this
one:
def createDefaultLink: Option[NodeSeq] = currentValue.flatMap(p =>
link.createLink(p)).toOption
which would be:
def createDefaultPath: Option[String] = currentValue.flatMap(p =>
link.createPath(p)).toOption
(btw., why is it Option here, not Box?)
Then generating a link to the login page would simply be:
SiteMap.findLoc("Login").open_!.createDefaultPath
--
Adam Warski
http://www.warski.org
http://www.softwaremill.eu
--
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en.