Seems I'm pushing the boundaries of Menu/Snippets lately, but I think
it's worth it. I can remove a lot of our homegrown Locs and the
resulting code is much cleaner.
Current problem:
We have snippets like this
class Order(o: Order) {
def editForm = ...
}
So there has to be a Loc[Order].currentValue in place for this snippet
to be instantiated. We will reuse the editForm snippet when creating a
new Order.
But it seems like it's not easy to create a Menu for this purpose: The
only way to create a Loc[T] where T<>Unit is to use Menu.param, but
this requires parsing/encoding functions which are not needed when
creating a new Order and it generates the wrong link (an extra "/" at
the end). My current workaround is this:
def createOp:Menu = Menu.param[Order]("x", "x", _ => Empty, _ => "") /
prefix / "new" >> Loc.CalcValue(() => Full(Order.create)) >>
Loc.Template(() => {
which sort of works except for the parts noted above.
It seems like it could be useful to add a way to create a Loc[T] where
the value is supplied via Loc parameters?
/Jeppe
Can you put together a sample e
Yep had the same idea that it's probably a good idea to have a test
bed for this stuff :-)
I'll be back.
/Jeppe
I've started creating the scenarios here:
https://github.com/jeppenejsum/lift-crud
Look at the Menutest page.
Not much is working atm (i've got it working better in another app,
but this may be due to not having all the menu items as in this
example)
I'm also getting into an endless loop with the URL parse function
(on urls of the form /orders/1). Not sure what causes this
One outstanding design problem is what the type signature of the Loc
for this url should be: /orders/1/lineitems/new
I've also added some comments in Order.scala. Let me know how I can
help move this awesome stuff forward ;-)
/Jeppe