How about BindPlus? BindUtil(s)? Better name anyone?I could put bindSwitch*
there too, as well as other specialized binds. bindSwitch isn't too useful
without chaining.
*bindSwitch lets you have two or more parts of the view which act as a
switch -- only one is visible at a time -- even if they each have different
bind logic. It lets you write:
// with implicit: xhtml.bindSwitch("prefix", ...
// without implicit:
bindSwitch("prefix", xhtml,
Seq("noResults", "hasResults")) {
results.size match {
case 0 => 0 -> bind("prefix2", xhtml, "link" -> SHtml.link(...)
case 1 => 1 -> bind("prefix2", xhtml, ...)
}
}
Also, maybe I should put keepAttrs (wraps an Elem in a NodeSeq=>NodeSeq that
preserves the attributes) in BindHelpers,
Then I could put an implicit in the new object that lets you write more
concisely:
bind("prefix", xhtml,
"edit" %> SHtml.text(...)
)
This will let you put attributes in the view. For example,
<prefix:edit size="10" style="margin: 70" />
On Mon, Aug 17, 2009 at 3:49 PM, David Pollak <[email protected]
> wrote:
>
>
> On Mon, Aug 17, 2009 at 12:48 PM, Naftoli Gugenheim
> <[email protected]>wrote:
>
>> Should I leave it in view.Util? Or is there a better place? Because I
>> really meant it (actually the whole view package) to support Mapper-based
>> views, and this isn't related to Mapper.
>
>
> Yeah... put them in a separate object (Not Helpers or a trait that gets
> rolled into Helpers) in net.liftweb.util
>
>
>>
>>
>>
>> On Mon, Aug 17, 2009 at 3:46 PM, David Pollak <
>> [email protected]> wrote:
>>
>>>
>>>
>>> On Mon, Aug 17, 2009 at 12:44 PM, Naftoli Gugenheim <
>>> [email protected]> wrote:
>>>
>>>> What do people think of the following? I wrote some implicits that allow
>>>> you to call bind as a method on a NodeSeq, allowing you to chain several
>>>> bind statements.For example:
>>>> def edit(xhtml: NodeSeq) =
>>>> xhtml.bind("prefix1",
>>>> "label1" -> value1,
>>>> "label2" -> value2
>>>> ).bind("prefix2",
>>>> "label1" -> value3,
>>>> "label2" -> value4
>>>> )
>>>>
>>>> This already exists in net.liftweb.mapper.view.Util.
>>>> My question is whether I should put it into BindHelpers so it would
>>>> always be available.
>>>>
>>>
>>> I would prefer that it's not automatically imported when you import
>>> Helpers._
>>>
>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> 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 [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
-~----------~----~----~----~------~----~------~--~---