Composability of JsMember with optional parts?

11 views
Skip to first unread message

Jeppe Nejsum Madsen

unread,
May 12, 2011, 5:05:35 AM5/12/11
to lif...@googlegroups.com
Hi,

Is there currently a better way to handle optional JsMembers than this:

def onLoad(id: String, plugins: Seq[Plugin], additionalJs:
Box[JsMember] = Empty): NodeSeq = {

if (additionalJs.isEmpty)
Jq(selector) ~> JsFunc("jstree", treeJson)
else
Jq(selector) ~> additionalJs.open_! ~> JsFunc("jstree", treeJson)

If not, perhaps have ~> handle Option[JsMember] as well. Dunno what
the implications are though.

Thoughts?

/Jeppe

David Pollak

unread,
May 12, 2011, 6:54:53 AM5/12/11
to lif...@googlegroups.com

Oooohhhh... I like handling Option[JsMember] and Box[JsMember].  Can you open a ticket and write the code?
 

Thoughts?

/Jeppe

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




--
Lift, the simply functional web framework http://liftweb.net

Jeppe Nejsum Madsen

unread,
May 12, 2011, 10:54:53 AM5/12/11
to lif...@googlegroups.com
On Thu, May 12, 2011 at 12:54 PM, David Pollak
<feeder.of...@gmail.com> wrote:
>
>
> On Thu, May 12, 2011 at 2:05 AM, Jeppe Nejsum Madsen <je...@ingolfs.dk>
> wrote:
>>
>> Hi,
>>
>> Is there currently a better way to handle optional JsMembers than this:
>>
>> def onLoad(id: String, plugins: Seq[Plugin], additionalJs:
>> Box[JsMember] = Empty): NodeSeq = {
>>
>>    if (additionalJs.isEmpty)
>>      Jq(selector) ~> JsFunc("jstree", treeJson)
>>    else
>>      Jq(selector) ~> additionalJs.open_! ~> JsFunc("jstree", treeJson)
>>
>>
>>
>> If not, perhaps have ~> handle Option[JsMember] as well. Dunno what
>> the implications are though.
>
> Oooohhhh... I like handling Option[JsMember] and Box[JsMember].  Can you
> open a ticket and write the code?

Sure, both seem within my capabilities :-)

/Jeppe

Reply all
Reply to author
Forward
0 new messages