Hi,
Something I started doing a few months ago is to declare Sitemaps a
bit different than what you normally see.
For example, now we have:
def sitemap = SiteMap(
Menu.i("Home" ) / "index",
Menu.i("Log In" ) / "logIn" >> notLoggedIn,
Menu.i("Students" ) / "students" >> loggedIn,
Menu.i("Instruments") / "instruments" / "list" >> loggedIn,
Menu.i("New Instrument") / "instruments" / "create" >>
loggedIn >> Hidden,
Menu.i("Edit Instrument") / "instruments" / "edit" >>
loggedIn >> Hidden,
Menu.i("View Instrument") / "instruments" / "view" >>
loggedIn >> Hidden,
Menu.i("Delete Instrument") / "instruments" / "delete" >>
loggedIn >> Hidden,
Menu.i("No Groups" ) / "noGroups" >> loggedIn,
Menu.i("Details" ) / "studentDetails" >> loggedIn >> Hidden,
Menu.i("Problems" ) / "problems" >> loggedIn,
Menu.i("Statistics") / "stats" >> loggedIn,
Menu.i("Log Out" ) / "logOut" >> loggedIn
)
and if you want to link to the list pagem you hardcode the text path
in your code (this is taken from Carlos fork).
The one issue I have run to in the past is that if you decide to
change the path, let's say for instruments/edit to some other path,
you will have to do a search/replace on several places.
One alternative is to have all sitemap information in a separate
object, something like:
object Paths {
val home = Menu.i("home") / "index"
...
val newInstruments = Menu.i("new.instruments") / "instruments" / "create"
def sitemap = SiteMap(
home,
newInstrument >> loggedIn >> Hidden ,
...
)
}
and then, if you want to add a link to the create page, you can do
this from any snippet:
SHtml.link(Paths.newInstrument.loc.calcDefaultHref, ...)
I find this way a lot easier to maintain.
P.S. I got this tip from Tim Nelson
Regards,
Diego
--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com