[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Peter Robinett

Thanks, David. Unfortunately I'm having a hard time figuring out how
to get the foundParam.

Using your code, I have:
val loc = for {req - S.request; loc - req.location} yield loc
val l = loc openOr Couldn't open
println(loc)
println(l)

The first println give me:
Full(Loc(View List(nodes), function, LinkText(function), List()))

While the second shows that I am opening the Box:
Loc(View List(nodes), function, LinkText(function), List())

If I try to access my Loc object, I get compilation errors. For
example, val p = l.foundParam leads to the error value foundParam
is not a member of java.lang.Object. The toString method works, while
the title parameter gives me the same error. I believe I am using the
latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
something very simple here.

Any advice is much appreciated!

Peter

On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:



  Thanks, Derek and Jeppe, your responses were very helpful. I
  implemented Jeppe's solution and added my own snippet tag within
  _viewTemplate.  Unfortunately, I spent the whole day trying to figure
  out how pass the current CRUDified object to my snippet. Do I retrieve
  it in _viewTemplate from S.params and add an attribute to the snippet
  tag? Or just retrieve it from S in the snippet?

 I've just made Loc.foundParam public.  If you get the Loc from the Req from
 S (for {req - S.request; loc - req.location}) you can access foundParam
 which contains the current crudified object.

 Thanks,

 David



  I think I'm missing
  something fundamental with the S object and snippets. As you can tell,
  I'm very new to Lift! Any advice is much appreciated.

  Peter

  On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
   On 24 Jun 2009, Peter Robinett wrote:

Hi all,

I'm using CRUDify on one of my models and I'd like to display some
additional data on the view template. I believe that I need to
override one of the model definitions with some sort of reference to
my own XHTML file. Which one? _viewTemplate? Or perhaps the
viewTemplate method?

   If you look at the source to CRUDify, you'll see

   def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

   where

   def pageWrapper(body: NodeSeq): NodeSeq =
     lift:surround with=default at=content
       {
         body
       }
     /lift:surround

   def _viewTemplate =
     lift:crud.view
       table id={viewId} class={viewClass}
         crud:row
           tr
             tdcrud:name//td
             tdcrud:value//td
           /tr
         /crud:row
       /table
     /lift:crud.view

   So the simplest thing is to override _viewTemplate with something similar
   to the above. This should be done on the companion objects where CRUDify
   is mixed in

   /Jeppe

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

Well if the box is empty l will be a String so of course you can't access 
foundParam.

-
Peter Robinettpe...@bubblefoundry.com wrote:


Thanks, David. Unfortunately I'm having a hard time figuring out how
to get the foundParam.

Using your code, I have:
val loc = for {req - S.request; loc - req.location} yield loc
val l = loc openOr Couldn't open
println(loc)
println(l)

The first println give me:
Full(Loc(View List(nodes), function, LinkText(function), List()))

While the second shows that I am opening the Box:
Loc(View List(nodes), function, LinkText(function), List())

If I try to access my Loc object, I get compilation errors. For
example, val p = l.foundParam leads to the error value foundParam
is not a member of java.lang.Object. The toString method works, while
the title parameter gives me the same error. I believe I am using the
latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
something very simple here.

Any advice is much appreciated!

Peter

On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:



  Thanks, Derek and Jeppe, your responses were very helpful. I
  implemented Jeppe's solution and added my own snippet tag within
  _viewTemplate.  Unfortunately, I spent the whole day trying to figure
  out how pass the current CRUDified object to my snippet. Do I retrieve
  it in _viewTemplate from S.params and add an attribute to the snippet
  tag? Or just retrieve it from S in the snippet?

 I've just made Loc.foundParam public.  If you get the Loc from the Req from
 S (for {req - S.request; loc - req.location}) you can access foundParam
 which contains the current crudified object.

 Thanks,

 David



  I think I'm missing
  something fundamental with the S object and snippets. As you can tell,
  I'm very new to Lift! Any advice is much appreciated.

  Peter

  On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
   On 24 Jun 2009, Peter Robinett wrote:

Hi all,

I'm using CRUDify on one of my models and I'd like to display some
additional data on the view template. I believe that I need to
override one of the model definitions with some sort of reference to
my own XHTML file. Which one? _viewTemplate? Or perhaps the
viewTemplate method?

   If you look at the source to CRUDify, you'll see

   def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

   where

   def pageWrapper(body: NodeSeq): NodeSeq =
     lift:surround with=default at=content
       {
         body
       }
     /lift:surround

   def _viewTemplate =
     lift:crud.view
       table id={viewId} class={viewClass}
         crud:row
           tr
             tdcrud:name//td
             tdcrud:value//td
           /tr
         /crud:row
       /table
     /lift:crud.view

   So the simplest thing is to override _viewTemplate with something similar
   to the above. This should be done on the companion objects where CRUDify
   is mixed in

   /Jeppe

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

Instead of yielding loc which is taking it out of the box and putting it back 
in, access foundParam inside the for loop.

-
Peter Robinettpe...@bubblefoundry.com wrote:


Thanks, David. Unfortunately I'm having a hard time figuring out how
to get the foundParam.

Using your code, I have:
val loc = for {req - S.request; loc - req.location} yield loc
val l = loc openOr Couldn't open
println(loc)
println(l)

The first println give me:
Full(Loc(View List(nodes), function, LinkText(function), List()))

While the second shows that I am opening the Box:
Loc(View List(nodes), function, LinkText(function), List())

If I try to access my Loc object, I get compilation errors. For
example, val p = l.foundParam leads to the error value foundParam
is not a member of java.lang.Object. The toString method works, while
the title parameter gives me the same error. I believe I am using the
latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
something very simple here.

Any advice is much appreciated!

Peter

On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
wrote:
 On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
 pe...@bubblefoundry.comwrote:



  Thanks, Derek and Jeppe, your responses were very helpful. I
  implemented Jeppe's solution and added my own snippet tag within
  _viewTemplate.  Unfortunately, I spent the whole day trying to figure
  out how pass the current CRUDified object to my snippet. Do I retrieve
  it in _viewTemplate from S.params and add an attribute to the snippet
  tag? Or just retrieve it from S in the snippet?

 I've just made Loc.foundParam public.  If you get the Loc from the Req from
 S (for {req - S.request; loc - req.location}) you can access foundParam
 which contains the current crudified object.

 Thanks,

 David



  I think I'm missing
  something fundamental with the S object and snippets. As you can tell,
  I'm very new to Lift! Any advice is much appreciated.

  Peter

  On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
   On 24 Jun 2009, Peter Robinett wrote:

Hi all,

I'm using CRUDify on one of my models and I'd like to display some
additional data on the view template. I believe that I need to
override one of the model definitions with some sort of reference to
my own XHTML file. Which one? _viewTemplate? Or perhaps the
viewTemplate method?

   If you look at the source to CRUDify, you'll see

   def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

   where

   def pageWrapper(body: NodeSeq): NodeSeq =
     lift:surround with=default at=content
       {
         body
       }
     /lift:surround

   def _viewTemplate =
     lift:crud.view
       table id={viewId} class={viewClass}
         crud:row
           tr
             tdcrud:name//td
             tdcrud:value//td
           /tr
         /crud:row
       /table
     /lift:crud.view

   So the simplest thing is to override _viewTemplate with something similar
   to the above. This should be done on the companion objects where CRUDify
   is mixed in

   /Jeppe

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread David Pollak
On Wed, Jul 1, 2009 at 2:02 PM, Peter Robinett pe...@bubblefoundry.comwrote:


 Thanks, David. Unfortunately I'm having a hard time figuring out how
 to get the foundParam.

 Using your code, I have:
 val loc = for {req - S.request; loc - req.location} yield loc
 val l = loc openOr Couldn't open


When in doubt, specify a type explicitly:

val l: Loc[_] = loc openOr Couldn't open

This will fail because you've got a Box[Loc[_]] and you're doing an openOr
with a String... the only common class between the two is Object.

As another post suggested, do the foundParam.is inside the yield



 println(loc)
 println(l)

 The first println give me:
 Full(Loc(View List(nodes), function, LinkText(function), List()))

 While the second shows that I am opening the Box:
 Loc(View List(nodes), function, LinkText(function), List())

 If I try to access my Loc object, I get compilation errors. For
 example, val p = l.foundParam leads to the error value foundParam
 is not a member of java.lang.Object. The toString method works, while
 the title parameter gives me the same error. I believe I am using the
 latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
 something very simple here.

 Any advice is much appreciated!

 Peter

 On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett pe...@bubblefoundry.com
 wrote:
 
 
 
   Thanks, Derek and Jeppe, your responses were very helpful. I
   implemented Jeppe's solution and added my own snippet tag within
   _viewTemplate.  Unfortunately, I spent the whole day trying to figure
   out how pass the current CRUDified object to my snippet. Do I retrieve
   it in _viewTemplate from S.params and add an attribute to the snippet
   tag? Or just retrieve it from S in the snippet?
 
  I've just made Loc.foundParam public.  If you get the Loc from the Req
 from
  S (for {req - S.request; loc - req.location}) you can access foundParam
  which contains the current crudified object.
 
  Thanks,
 
  David
 
 
 
   I think I'm missing
   something fundamental with the S object and snippets. As you can tell,
   I'm very new to Lift! Any advice is much appreciated.
 
   Peter
 
   On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
On 24 Jun 2009, Peter Robinett wrote:
 
 Hi all,
 
 I'm using CRUDify on one of my models and I'd like to display some
 additional data on the view template. I believe that I need to
 override one of the model definitions with some sort of reference
 to
 my own XHTML file. Which one? _viewTemplate? Or perhaps the
 viewTemplate method?
 
If you look at the source to CRUDify, you'll see
 
def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
 
where
 
def pageWrapper(body: NodeSeq): NodeSeq =
  lift:surround with=default at=content
{
  body
}
  /lift:surround
 
def _viewTemplate =
  lift:crud.view
table id={viewId} class={viewClass}
  crud:row
tr
  tdcrud:name//td
  tdcrud:value//td
/tr
  /crud:row
/table
  /lift:crud.view
 
So the simplest thing is to override _viewTemplate with something
 similar
to the above. This should be done on the companion objects where
 CRUDify
is mixed in
 
/Jeppe
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp
 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Peter Robinett

Thanks Naftoli and David, I'm starting to understand what I need to
do. However, the solution has revealed a gap in my beginner's
knowledge of Scala: why was my code printing out the Loc instead of
Couldn't open?

Second, even with foundParam.is within the for comprehension, I still
need to get the the value out of the comprehension – the rest of my
snippet is based upon it. So, I still need to openOr the Box, no? If
so, how? Is there a more functional and Scalarific way to do this?

Thanks for your help,
Peter

On Jul 1, 2:45 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Wed, Jul 1, 2009 at 2:02 PM, Peter Robinett pe...@bubblefoundry.comwrote:



  Thanks, David. Unfortunately I'm having a hard time figuring out how
  to get the foundParam.

  Using your code, I have:
  val loc = for {req - S.request; loc - req.location} yield loc
  val l = loc openOr Couldn't open

 When in doubt, specify a type explicitly:

 val l: Loc[_] = loc openOr Couldn't open

 This will fail because you've got a Box[Loc[_]] and you're doing an openOr
 with a String... the only common class between the two is Object.

 As another post suggested, do the foundParam.is inside the yield





  println(loc)
  println(l)

  The first println give me:
  Full(Loc(View List(nodes), function, LinkText(function), List()))

  While the second shows that I am opening the Box:
  Loc(View List(nodes), function, LinkText(function), List())

  If I try to access my Loc object, I get compilation errors. For
  example, val p = l.foundParam leads to the error value foundParam
  is not a member of java.lang.Object. The toString method works, while
  the title parameter gives me the same error. I believe I am using the
  latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
  something very simple here.

  Any advice is much appreciated!

  Peter

  On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett pe...@bubblefoundry.com
  wrote:

Thanks, Derek and Jeppe, your responses were very helpful. I
implemented Jeppe's solution and added my own snippet tag within
_viewTemplate.  Unfortunately, I spent the whole day trying to figure
out how pass the current CRUDified object to my snippet. Do I retrieve
it in _viewTemplate from S.params and add an attribute to the snippet
tag? Or just retrieve it from S in the snippet?

   I've just made Loc.foundParam public.  If you get the Loc from the Req
  from
   S (for {req - S.request; loc - req.location}) you can access foundParam
   which contains the current crudified object.

   Thanks,

   David

I think I'm missing
something fundamental with the S object and snippets. As you can tell,
I'm very new to Lift! Any advice is much appreciated.

Peter

On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 On 24 Jun 2009, Peter Robinett wrote:

  Hi all,

  I'm using CRUDify on one of my models and I'd like to display some
  additional data on the view template. I believe that I need to
  override one of the model definitions with some sort of reference
  to
  my own XHTML file. Which one? _viewTemplate? Or perhaps the
  viewTemplate method?

 If you look at the source to CRUDify, you'll see

 def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

 where

 def pageWrapper(body: NodeSeq): NodeSeq =
   lift:surround with=default at=content
     {
       body
     }
   /lift:surround

 def _viewTemplate =
   lift:crud.view
     table id={viewId} class={viewClass}
       crud:row
         tr
           tdcrud:name//td
           tdcrud:value//td
         /tr
       /crud:row
     /table
   /lift:crud.view

 So the simplest thing is to override _viewTemplate with something
  similar
 to the above. This should be done on the companion objects where
  CRUDify
 is mixed in

 /Jeppe

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Git some:http://github.com/dpp

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread David Pollak
On Wed, Jul 1, 2009 at 3:34 PM, Peter Robinett pe...@bubblefoundry.comwrote:


 Thanks Naftoli and David, I'm starting to understand what I need to
 do. However, the solution has revealed a gap in my beginner's
 knowledge of Scala: why was my code printing out the Loc instead of
 Couldn't open?


Are you coming from Java/C# or Ruby/Python?




 Second, even with foundParam.is within the for comprehension, I still
 need to get the the value out of the comprehension – the rest of my
 snippet is based upon it. So, I still need to openOr the Box, no? If
 so, how? Is there a more functional and Scalarific way to do this?


I don't think you have to pull the value out of the for comprehension... do
all the work inside the for comprehension.

When you're doing your design, think about transformation.  You'll
transforming input to output.  In this particular instance, what kind of
transformation are you performing?




 Thanks for your help,
 Peter

 On Jul 1, 2:45 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
  On Wed, Jul 1, 2009 at 2:02 PM, Peter Robinett pe...@bubblefoundry.com
 wrote:
 
 
 
   Thanks, David. Unfortunately I'm having a hard time figuring out how
   to get the foundParam.
 
   Using your code, I have:
   val loc = for {req - S.request; loc - req.location} yield loc
   val l = loc openOr Couldn't open
 
  When in doubt, specify a type explicitly:
 
  val l: Loc[_] = loc openOr Couldn't open
 
  This will fail because you've got a Box[Loc[_]] and you're doing an
 openOr
  with a String... the only common class between the two is Object.
 
  As another post suggested, do the foundParam.is inside the yield
 
 
 
 
 
   println(loc)
   println(l)
 
   The first println give me:
   Full(Loc(View List(nodes), function, LinkText(function), List()))
 
   While the second shows that I am opening the Box:
   Loc(View List(nodes), function, LinkText(function), List())
 
   If I try to access my Loc object, I get compilation errors. For
   example, val p = l.foundParam leads to the error value foundParam
   is not a member of java.lang.Object. The toString method works, while
   the title parameter gives me the same error. I believe I am using the
   latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
   something very simple here.
 
   Any advice is much appreciated!
 
   Peter
 
   On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
   wrote:
On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
 pe...@bubblefoundry.com
   wrote:
 
 Thanks, Derek and Jeppe, your responses were very helpful. I
 implemented Jeppe's solution and added my own snippet tag within
 _viewTemplate.  Unfortunately, I spent the whole day trying to
 figure
 out how pass the current CRUDified object to my snippet. Do I
 retrieve
 it in _viewTemplate from S.params and add an attribute to the
 snippet
 tag? Or just retrieve it from S in the snippet?
 
I've just made Loc.foundParam public.  If you get the Loc from the
 Req
   from
S (for {req - S.request; loc - req.location}) you can access
 foundParam
which contains the current crudified object.
 
Thanks,
 
David
 
 I think I'm missing
 something fundamental with the S object and snippets. As you can
 tell,
 I'm very new to Lift! Any advice is much appreciated.
 
 Peter
 
 On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On 24 Jun 2009, Peter Robinett wrote:
 
   Hi all,
 
   I'm using CRUDify on one of my models and I'd like to display
 some
   additional data on the view template. I believe that I need to
   override one of the model definitions with some sort of
 reference
   to
   my own XHTML file. Which one? _viewTemplate? Or perhaps the
   viewTemplate method?
 
  If you look at the source to CRUDify, you'll see
 
  def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
 
  where
 
  def pageWrapper(body: NodeSeq): NodeSeq =
lift:surround with=default at=content
  {
body
  }
/lift:surround
 
  def _viewTemplate =
lift:crud.view
  table id={viewId} class={viewClass}
crud:row
  tr
tdcrud:name//td
tdcrud:value//td
  /tr
/crud:row
  /table
/lift:crud.view
 
  So the simplest thing is to override _viewTemplate with something
   similar
  to the above. This should be done on the companion objects where
   CRUDify
  is mixed in
 
  /Jeppe
 
--
Lift, the simply functional web frameworkhttp://liftweb.net
Beginning Scalahttp://www.apress.com/book/view/1430219890
Follow me:http://twitter.com/dpp
Git some:http://github.com/dpp
 
  --
  Lift, the simply functional web frameworkhttp://liftweb.net
  Beginning Scalahttp://www.apress.com/book/view/1430219890
  Follow me:http://twitter.com/dpp
  Git some:http://github.com/dpp
 



-- 

[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

A Box is a container that holds 0 or 1 elements(s). openOr means if the Box is 
Full return the element; otherwise return the parameter--my default value.
One alternative approach would be to specify a default Loc.

-
Peter Robinettpe...@bubblefoundry.com wrote:


Thanks Naftoli and David, I'm starting to understand what I need to
do. However, the solution has revealed a gap in my beginner's
knowledge of Scala: why was my code printing out the Loc instead of
Couldn't open?

Second, even with foundParam.is within the for comprehension, I still
need to get the the value out of the comprehension – the rest of my
snippet is based upon it. So, I still need to openOr the Box, no? If
so, how? Is there a more functional and Scalarific way to do this?

Thanks for your help,
Peter

On Jul 1, 2:45 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 On Wed, Jul 1, 2009 at 2:02 PM, Peter Robinett pe...@bubblefoundry.comwrote:



  Thanks, David. Unfortunately I'm having a hard time figuring out how
  to get the foundParam.

  Using your code, I have:
  val loc = for {req - S.request; loc - req.location} yield loc
  val l = loc openOr Couldn't open

 When in doubt, specify a type explicitly:

 val l: Loc[_] = loc openOr Couldn't open

 This will fail because you've got a Box[Loc[_]] and you're doing an openOr
 with a String... the only common class between the two is Object.

 As another post suggested, do the foundParam.is inside the yield





  println(loc)
  println(l)

  The first println give me:
  Full(Loc(View List(nodes), function, LinkText(function), List()))

  While the second shows that I am opening the Box:
  Loc(View List(nodes), function, LinkText(function), List())

  If I try to access my Loc object, I get compilation errors. For
  example, val p = l.foundParam leads to the error value foundParam
  is not a member of java.lang.Object. The toString method works, while
  the title parameter gives me the same error. I believe I am using the
  latest Lift code (I ran mvn -U jetty:run) and feel I must be missing
  something very simple here.

  Any advice is much appreciated!

  Peter

  On Jun 29, 10:05 am, David Pollak feeder.of.the.be...@gmail.com
  wrote:
   On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett pe...@bubblefoundry.com
  wrote:

Thanks, Derek and Jeppe, your responses were very helpful. I
implemented Jeppe's solution and added my own snippet tag within
_viewTemplate.  Unfortunately, I spent the whole day trying to figure
out how pass the current CRUDified object to my snippet. Do I retrieve
it in _viewTemplate from S.params and add an attribute to the snippet
tag? Or just retrieve it from S in the snippet?

   I've just made Loc.foundParam public.  If you get the Loc from the Req
  from
   S (for {req - S.request; loc - req.location}) you can access foundParam
   which contains the current crudified object.

   Thanks,

   David

I think I'm missing
something fundamental with the S object and snippets. As you can tell,
I'm very new to Lift! Any advice is much appreciated.

Peter

On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 On 24 Jun 2009, Peter Robinett wrote:

  Hi all,

  I'm using CRUDify on one of my models and I'd like to display some
  additional data on the view template. I believe that I need to
  override one of the model definitions with some sort of reference
  to
  my own XHTML file. Which one? _viewTemplate? Or perhaps the
  viewTemplate method?

 If you look at the source to CRUDify, you'll see

 def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

 where

 def pageWrapper(body: NodeSeq): NodeSeq =
   lift:surround with=default at=content
     {
       body
     }
   /lift:surround

 def _viewTemplate =
   lift:crud.view
     table id={viewId} class={viewClass}
       crud:row
         tr
           tdcrud:name//td
           tdcrud:value//td
         /tr
       /crud:row
     /table
   /lift:crud.view

 So the simplest thing is to override _viewTemplate with something
  similar
 to the above. This should be done on the companion objects where
  CRUDify
 is mixed in

 /Jeppe

   --
   Lift, the simply functional web frameworkhttp://liftweb.net
   Beginning Scalahttp://www.apress.com/book/view/1430219890
   Follow me:http://twitter.com/dpp
   Git some:http://github.com/dpp

 --
 Lift, the simply functional web frameworkhttp://liftweb.net
 Beginning Scalahttp://www.apress.com/book/view/1430219890
 Follow me:http://twitter.com/dpp
 Git some:http://github.com/dpp


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com

[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Peter Robinett

On Jul 1, 3:38 pm, David Pollak feeder.of.the.be...@gmail.com
wrote:
 Are you coming from Java/C# or Ruby/Python?

PHP, Python and Javascript

 I don't think you have to pull the value out of the for comprehension... do
 all the work inside the for comprehension.

 When you're doing your design, think about transformation.  You'll
 transforming input to output.  In this particular instance, what kind of
 transformation are you performing?

To the extent that you can call it transformation, I'm trying to
transform the Node the user selected (via clicking on a link in the
format /nodes/view/some node id) to a Flot graph of the Node's
Packets. So, I'm writing a snippet to display a Flot graph of all the
recent Packets of a Node. This snippet is called in the viewTemplate
of the CRUDified Node model (hence the title of this thread).

So based upon the Flot examples I have been seeking to have my snippet
be something of the format:
def time (xhtml: NodeSeq) = {
def graph () = {
val node = the Node the user requested
val s = new FlotSerie () {
override val data = Packet.findAll(By(Packet.node, 
node.id), OrderBy
(Packet.dt, Descending), MaxRows(1000)).map(p =
(p.dt.getTime.toDouble, p.temp.is))
}

... various Flot code, including adding the s FlotSerie to 
options
FlotOptions ...

Flot.render(ph_graph, s :: Nil, options, Flot.script(xhtml),
overview)
}
bind (flot, xhtml, graph - graph)
}

Am I going about this in the correct way?

Again, thanks for the help,
Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread David Pollak
On Wed, Jul 1, 2009 at 4:00 PM, Peter Robinett pe...@bubblefoundry.comwrote:


 On Jul 1, 3:38 pm, David Pollak feeder.of.the.be...@gmail.com
 wrote:
  Are you coming from Java/C# or Ruby/Python?

 PHP, Python and Javascript


Okay... makes sense.

Yes, the reference contained a Loc, but the compiler could not verify that
it contained a Loc.  At compile time, the compiler knows the common
superclass between Loc[_] and String is Object.  Thus the type of l in your
code was Object and Object doesn't have the foundParam method.




  I don't think you have to pull the value out of the for comprehension...
 do
  all the work inside the for comprehension.
 
  When you're doing your design, think about transformation.  You'll
  transforming input to output.  In this particular instance, what kind of
  transformation are you performing?

 To the extent that you can call it transformation, I'm trying to
 transform the Node the user selected (via clicking on a link in the
 format /nodes/view/some node id) to a Flot graph of the Node's
 Packets. So, I'm writing a snippet to display a Flot graph of all the
 recent Packets of a Node. This snippet is called in the viewTemplate
 of the CRUDified Node model (hence the title of this thread).

 So based upon the Flot examples I have been seeking to have my snippet


I'd put your snippet in your Loc.  That way you have access to the
foundParam.

Loc.Snippet(time, time)

And then in your Loc, you put the time method below.  In that case, you'll
have direct access to foundParam without any goofiness.




 be something of the format:
 def time (xhtml: NodeSeq) = {
def graph () = {
val node = the Node the user requested
val s = new FlotSerie () {
override val data = Packet.findAll(By(Packet.node,
 node.id), OrderBy


You could also write this as:

override val data = Packet.findAll(By(Packet.node, for (req - S.request;
loc - req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
MaxRows(1000)





 (Packet.dt, Descending), MaxRows(1000)).map(p =
 (p.dt.getTime.toDouble, p.temp.is))
}

... various Flot code, including adding the s FlotSerie to
 options
 FlotOptions ...

Flot.render(ph_graph, s :: Nil, options,
 Flot.script(xhtml),
 overview)
}
bind (flot, xhtml, graph - graph)
 }

 Am I going about this in the correct way?

 Again, thanks for the help,
 Peter
 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Peter Robinett

Everyone, I apologize for monopolizing the list but this has been very
helpful for me. I've learned a bunch from similar, old entries in the
list and hope this thread will help future Lift beginners.

On to my reply to David:

On Jul 1, 4:19 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Yes, the reference contained a Loc, but the compiler could not verify that
 it contained a Loc.  At compile time, the compiler knows the common
 superclass between Loc[_] and String is Object.  Thus the type of l in your
 code was Object and Object doesn't have the foundParam method.

O! Ok, that makes a lot of sense.

 I'd put your snippet in your Loc.  That way you have access to the
 foundParam.

 Loc.Snippet(time, time)

 And then in your Loc, you put the time method below.  In that case, you'll
 have direct access to foundParam without any goofiness.

To be honest, this doesn't make a lot of sense to me. I assume you
mean a Loc in the Menus of my SiteMap that I assemble in Boot.scala.
I'm using the Locs created by the CRUDify trait added to my Node model
so I guess I would have to override the Node.menus method. I think
I'll delve into this more later when it's necessary...

 You could also write this as:

 override val data = Packet.findAll(By(Packet.node, for (req - S.request;
 loc - req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
 MaxRows(1000)

Ok, this makes sense but unfortunately the value yielded by the for
comprehension is all boxed up and so I get an error:
error: no implicit argument matching parameter type
(net.liftweb.util.Box[net.liftweb.util.Box
[com.equalnetworks.model.Node]]) = Long was found.
override val data = Packet.findAll(By(Packet.node, for (req -
S.request;

What would be the best way to unbox things to get the actual Node
object so I can have a Long to put in my By() call?

Thanks,
Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Naftoli Gugenhem

If you know the Box is full you can write open_! (you'll get a runtime error if 
it wasn't). Otherwise openOr a default, e.g., an invalid id.
You have first answer the question, what _should_ happen if it's Empty after 
all? :)
-
Peter Robinettpe...@bubblefoundry.com wrote:


Everyone, I apologize for monopolizing the list but this has been very
helpful for me. I've learned a bunch from similar, old entries in the
list and hope this thread will help future Lift beginners.

On to my reply to David:

On Jul 1, 4:19 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 Yes, the reference contained a Loc, but the compiler could not verify that
 it contained a Loc.  At compile time, the compiler knows the common
 superclass between Loc[_] and String is Object.  Thus the type of l in your
 code was Object and Object doesn't have the foundParam method.

O! Ok, that makes a lot of sense.

 I'd put your snippet in your Loc.  That way you have access to the
 foundParam.

 Loc.Snippet(time, time)

 And then in your Loc, you put the time method below.  In that case, you'll
 have direct access to foundParam without any goofiness.

To be honest, this doesn't make a lot of sense to me. I assume you
mean a Loc in the Menus of my SiteMap that I assemble in Boot.scala.
I'm using the Locs created by the CRUDify trait added to my Node model
so I guess I would have to override the Node.menus method. I think
I'll delve into this more later when it's necessary...

 You could also write this as:

 override val data = Packet.findAll(By(Packet.node, for (req - S.request;
 loc - req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
 MaxRows(1000)

Ok, this makes sense but unfortunately the value yielded by the for
comprehension is all boxed up and so I get an error:
error: no implicit argument matching parameter type
(net.liftweb.util.Box[net.liftweb.util.Box
[com.equalnetworks.model.Node]]) = Long was found.
override val data = Packet.findAll(By(Packet.node, for (req -
S.request;

What would be the best way to unbox things to get the actual Node
object so I can have a Long to put in my By() call?

Thanks,
Peter


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread Peter Robinett

Thanks, Naftoli. For now open_! does the trick for me.

Peter

On Jul 1, 5:55 pm, Naftoli Gugenhem naftoli...@gmail.com wrote:
 If you know the Box is full you can write open_! (you'll get a runtime error 
 if it wasn't). Otherwise openOr a default, e.g., an invalid id.
 You have first answer the question, what _should_ happen if it's Empty after 
 all? :)
 -

 Peter Robinettpe...@bubblefoundry.com wrote:

 Everyone, I apologize for monopolizing the list but this has been very
 helpful for me. I've learned a bunch from similar, old entries in the
 list and hope this thread will help future Lift beginners.

 On to my reply to David:

 On Jul 1, 4:19 pm, David Pollak feeder.of.the.be...@gmail.com wrote:

  Yes, the reference contained a Loc, but the compiler could not verify that
  it contained a Loc.  At compile time, the compiler knows the common
  superclass between Loc[_] and String is Object.  Thus the type of l in your
  code was Object and Object doesn't have the foundParam method.

 O! Ok, that makes a lot of sense.

  I'd put your snippet in your Loc.  That way you have access to the
  foundParam.

  Loc.Snippet(time, time)

  And then in your Loc, you put the time method below.  In that case, you'll
  have direct access to foundParam without any goofiness.

 To be honest, this doesn't make a lot of sense to me. I assume you
 mean a Loc in the Menus of my SiteMap that I assemble in Boot.scala.
 I'm using the Locs created by the CRUDify trait added to my Node model
 so I guess I would have to override the Node.menus method. I think
 I'll delve into this more later when it's necessary...

  You could also write this as:

  override val data = Packet.findAll(By(Packet.node, for (req - S.request;
  loc - req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
  MaxRows(1000)

 Ok, this makes sense but unfortunately the value yielded by the for
 comprehension is all boxed up and so I get an error:
 error: no implicit argument matching parameter type
 (net.liftweb.util.Box[net.liftweb.util.Box
 [com.equalnetworks.model.Node]]) = Long was found.
                 override val data = Packet.findAll(By(Packet.node, for (req -
 S.request;

 What would be the best way to unbox things to get the actual Node
 object so I can have a Long to put in my By() call?

 Thanks,
 Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-07-01 Thread David Pollak
On Wed, Jul 1, 2009 at 7:39 PM, Peter Robinett pe...@bubblefoundry.comwrote:


 Thanks, Naftoli. For now open_! does the trick for me.


Please do not use open_!  The ! is there for a reason... it means use this
at your peril.

Either use openOr and have the expression on the right side of the openOr
return the same type as the expression on the left (Loc[Node]) or
alternatively, do pattern matching:

thing match {
  case Full(x) = // do something
  case _ = // some fallback
}

Using open_! is super duper dangerous and generally very, very bad practice.




 Peter

 On Jul 1, 5:55 pm, Naftoli Gugenhem naftoli...@gmail.com wrote:
  If you know the Box is full you can write open_! (you'll get a runtime
 error if it wasn't). Otherwise openOr a default, e.g., an invalid id.
  You have first answer the question, what _should_ happen if it's Empty
 after all? :)
  -
 
  Peter Robinettpe...@bubblefoundry.com wrote:
 
  Everyone, I apologize for monopolizing the list but this has been very
  helpful for me. I've learned a bunch from similar, old entries in the
  list and hope this thread will help future Lift beginners.
 
  On to my reply to David:
 
  On Jul 1, 4:19 pm, David Pollak feeder.of.the.be...@gmail.com wrote:
 
   Yes, the reference contained a Loc, but the compiler could not verify
 that
   it contained a Loc.  At compile time, the compiler knows the common
   superclass between Loc[_] and String is Object.  Thus the type of l in
 your
   code was Object and Object doesn't have the foundParam method.
 
  O! Ok, that makes a lot of sense.
 
   I'd put your snippet in your Loc.  That way you have access to the
   foundParam.
 
   Loc.Snippet(time, time)
 
   And then in your Loc, you put the time method below.  In that case,
 you'll
   have direct access to foundParam without any goofiness.
 
  To be honest, this doesn't make a lot of sense to me. I assume you
  mean a Loc in the Menus of my SiteMap that I assemble in Boot.scala.
  I'm using the Locs created by the CRUDify trait added to my Node model
  so I guess I would have to override the Node.menus method. I think
  I'll delve into this more later when it's necessary...
 
   You could also write this as:
 
   override val data = Packet.findAll(By(Packet.node, for (req -
 S.request;
   loc - req.location) yield loc.asInstanceOf[Loc[Node]].foundParam.is),
   MaxRows(1000)
 
  Ok, this makes sense but unfortunately the value yielded by the for
  comprehension is all boxed up and so I get an error:
  error: no implicit argument matching parameter type
  (net.liftweb.util.Box[net.liftweb.util.Box
  [com.equalnetworks.model.Node]]) = Long was found.
  override val data = Packet.findAll(By(Packet.node, for
 (req -
  S.request;
 
  What would be the best way to unbox things to get the actual Node
  object so I can have a Long to put in my By() call?
 
  Thanks,
  Peter
 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-29 Thread Derek Chen-Becker
If you look at the default _viewTemplate:


   1.def _viewTemplate =
   2.lift:crud.view
   3.   table id={viewId} class={viewClass}
   4. crud:row
   5.   tr
   6. tdcrud:name//td
   7. tdcrud:value//td
   8.   /tr
   9. /crud:row
   10.   /table
   11./lift:crud.view


You'll see that it uses the binding tags of lift:crud.view /, crud:row
/, and crud:name /. Those are used to fill in the values for a given
instance. I would base whatever new template you want off of that.

Derek

On Fri, Jun 26, 2009 at 7:39 PM, Peter Robinett pe...@bubblefoundry.comwrote:


 Thanks, Derek and Jeppe, your responses were very helpful. I
 implemented Jeppe's solution and added my own snippet tag within
 _viewTemplate.  Unfortunately, I spent the whole day trying to figure
 out how pass the current CRUDified object to my snippet. Do I retrieve
 it in _viewTemplate from S.params and add an attribute to the snippet
 tag? Or just retrieve it from S in the snippet? I think I'm missing
 something fundamental with the S object and snippets. As you can tell,
 I'm very new to Lift! Any advice is much appreciated.

 Peter

 On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On 24 Jun 2009, Peter Robinett wrote:
 
   Hi all,
 
   I'm using CRUDify on one of my models and I'd like to display some
   additional data on the view template. I believe that I need to
   override one of the model definitions with some sort of reference to
   my own XHTML file. Which one? _viewTemplate? Or perhaps the
   viewTemplate method?
 
  If you look at the source to CRUDify, you'll see
 
  def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
 
  where
 
  def pageWrapper(body: NodeSeq): NodeSeq =
lift:surround with=default at=content
  {
body
  }
/lift:surround
 
  def _viewTemplate =
lift:crud.view
  table id={viewId} class={viewClass}
crud:row
  tr
tdcrud:name//td
tdcrud:value//td
  /tr
/crud:row
  /table
/lift:crud.view
 
  So the simplest thing is to override _viewTemplate with something similar
  to the above. This should be done on the companion objects where CRUDify
  is mixed in
 
  /Jeppe

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-29 Thread David Pollak
On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett pe...@bubblefoundry.comwrote:


 Thanks, Derek and Jeppe, your responses were very helpful. I
 implemented Jeppe's solution and added my own snippet tag within
 _viewTemplate.  Unfortunately, I spent the whole day trying to figure
 out how pass the current CRUDified object to my snippet. Do I retrieve
 it in _viewTemplate from S.params and add an attribute to the snippet
 tag? Or just retrieve it from S in the snippet?


I've just made Loc.foundParam public.  If you get the Loc from the Req from
S (for {req - S.request; loc - req.location}) you can access foundParam
which contains the current crudified object.

Thanks,

David


 I think I'm missing
 something fundamental with the S object and snippets. As you can tell,
 I'm very new to Lift! Any advice is much appreciated.

 Peter

 On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
  On 24 Jun 2009, Peter Robinett wrote:
 
   Hi all,
 
   I'm using CRUDify on one of my models and I'd like to display some
   additional data on the view template. I believe that I need to
   override one of the model definitions with some sort of reference to
   my own XHTML file. Which one? _viewTemplate? Or perhaps the
   viewTemplate method?
 
  If you look at the source to CRUDify, you'll see
 
  def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
 
  where
 
  def pageWrapper(body: NodeSeq): NodeSeq =
lift:surround with=default at=content
  {
body
  }
/lift:surround
 
  def _viewTemplate =
lift:crud.view
  table id={viewId} class={viewClass}
crud:row
  tr
tdcrud:name//td
tdcrud:value//td
  /tr
/crud:row
  /table
/lift:crud.view
 
  So the simplest thing is to override _viewTemplate with something similar
  to the above. This should be done on the companion objects where CRUDify
  is mixed in
 
  /Jeppe

 



-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-26 Thread Peter Robinett

Thanks, Derek and Jeppe, your responses were very helpful. I
implemented Jeppe's solution and added my own snippet tag within
_viewTemplate.  Unfortunately, I spent the whole day trying to figure
out how pass the current CRUDified object to my snippet. Do I retrieve
it in _viewTemplate from S.params and add an attribute to the snippet
tag? Or just retrieve it from S in the snippet? I think I'm missing
something fundamental with the S object and snippets. As you can tell,
I'm very new to Lift! Any advice is much appreciated.

Peter

On Jun 24, 11:01 am, Jeppe Nejsum Madsen je...@ingolfs.dk wrote:
 On 24 Jun 2009, Peter Robinett wrote:

  Hi all,

  I'm using CRUDify on one of my models and I'd like to display some
  additional data on the view template. I believe that I need to
  override one of the model definitions with some sort of reference to
  my own XHTML file. Which one? _viewTemplate? Or perhaps the
  viewTemplate method?

 If you look at the source to CRUDify, you'll see

 def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

 where

 def pageWrapper(body: NodeSeq): NodeSeq =
   lift:surround with=default at=content
     {
       body
     }
   /lift:surround

 def _viewTemplate =
   lift:crud.view
     table id={viewId} class={viewClass}
       crud:row
         tr
           tdcrud:name//td
           tdcrud:value//td
         /tr
       /crud:row
     /table
   /lift:crud.view

 So the simplest thing is to override _viewTemplate with something similar
 to the above. This should be done on the companion objects where CRUDify
 is mixed in

 /Jeppe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-25 Thread Peter Robinett

Naftoli, you would overload the _editTemplate field or the
editTemplate method, I imagine.

Peter

On Jun 24, 11:49 am, Naftoli Gugenheim naftoli...@gmail.com wrote:
 How would you customize the edit view, say to allow editing all child
 entities on the same screen?

 On Wed, Jun 24, 2009 at 2:01 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:



  On 24 Jun 2009, Peter Robinett wrote:

   Hi all,

   I'm using CRUDify on one of my models and I'd like to display some
   additional data on the view template. I believe that I need to
   override one of the model definitions with some sort of reference to
   my own XHTML file. Which one? _viewTemplate? Or perhaps the
   viewTemplate method?

  If you look at the source to CRUDify, you'll see

  def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

  where

  def pageWrapper(body: NodeSeq): NodeSeq =
   lift:surround with=default at=content
     {
       body
     }
   /lift:surround

  def _viewTemplate =
   lift:crud.view
     table id={viewId} class={viewClass}
       crud:row
         tr
           tdcrud:name//td
           tdcrud:value//td
         /tr
       /crud:row
     /table
   /lift:crud.view

  So the simplest thing is to override _viewTemplate with something similar
  to the above. This should be done on the companion objects where CRUDify
  is mixed in

  /Jeppe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-24 Thread Derek Chen-Becker
Well, it's the viewTemplate method, but it's supposed to return a NodeSeq,
so if you're pulling from a file you'll need to do the file load yourself.
You can do that with LiftRules.loadResourceAsXml:

...
override def viewTemplate = LiftRules.loadResourceAsXml(foo) openOr
pError loading template/p
...

Derek

On Wed, Jun 24, 2009 at 11:10 AM, Peter Robinett pe...@bubblefoundry.comwrote:


 Hi all,

 I'm using CRUDify on one of my models and I'd like to display some
 additional data on the view template. I believe that I need to
 override one of the model definitions with some sort of reference to
 my own XHTML file. Which one? _viewTemplate? Or perhaps the
 viewTemplate method?

 Thanks,
 Peter Robinett

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-24 Thread Jeppe Nejsum Madsen

On 24 Jun 2009, Peter Robinett wrote:


 Hi all,
 
 I'm using CRUDify on one of my models and I'd like to display some
 additional data on the view template. I believe that I need to
 override one of the model definitions with some sort of reference to
 my own XHTML file. Which one? _viewTemplate? Or perhaps the
 viewTemplate method?

If you look at the source to CRUDify, you'll see

def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

where

def pageWrapper(body: NodeSeq): NodeSeq =
  lift:surround with=default at=content
{
  body
}
  /lift:surround

def _viewTemplate =
  lift:crud.view
table id={viewId} class={viewClass}
  crud:row
tr
  tdcrud:name//td
  tdcrud:value//td
/tr
  /crud:row
/table
  /lift:crud.view

So the simplest thing is to override _viewTemplate with something similar
to the above. This should be done on the companion objects where CRUDify
is mixed in

/Jeppe


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Modify CRUDify XHTML

2009-06-24 Thread Naftoli Gugenheim
How would you customize the edit view, say to allow editing all child
entities on the same screen?

On Wed, Jun 24, 2009 at 2:01 PM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote:


 On 24 Jun 2009, Peter Robinett wrote:


  Hi all,
 
  I'm using CRUDify on one of my models and I'd like to display some
  additional data on the view template. I believe that I need to
  override one of the model definitions with some sort of reference to
  my own XHTML file. Which one? _viewTemplate? Or perhaps the
  viewTemplate method?

 If you look at the source to CRUDify, you'll see

 def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)

 where

 def pageWrapper(body: NodeSeq): NodeSeq =
  lift:surround with=default at=content
{
  body
}
  /lift:surround

 def _viewTemplate =
  lift:crud.view
table id={viewId} class={viewClass}
  crud:row
tr
  tdcrud:name//td
  tdcrud:value//td
/tr
  /crud:row
/table
  /lift:crud.view

 So the simplest thing is to override _viewTemplate with something similar
 to the above. This should be done on the companion objects where CRUDify
 is mixed in

 /Jeppe


 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---