JSScript objects have a canvas. Can I somehow use this canvas to put escaped html in my js?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

JSScript objects have a canvas. Can I somehow use this canvas to put escaped html in my js?

Steven Noble
What I'm attempting to do is something like

        html button
                text: 'add put option';
                onClick: (html jQuery ajax
                        script: [:s |
                                s << (s jQuery id: 'options') append: (self someRenderFunction on:
(s canvas)).
                                "some dynamically generated js"]).

Of course this doesn't work because 'append:' expects something that
behaves like a string.  But is there a way I can put some escaped html
generated by a canvas in my dynamically generated js?

Many thanks,
Steven H. Noble
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSScript objects have a canvas. Can I somehow use this canvas to put escaped html in my js?

Julian Fitzell-2
On Fri, Mar 27, 2009 at 1:53 AM, Steven Noble <[hidden email]> wrote:
What I'm attempting to do is something like

       html button
               text: 'add put option';
               onClick: (html jQuery ajax
                       script: [:s |
                               s << (s jQuery id: 'options') append: (self someRenderFunction on:
(s canvas)).
                               "some dynamically generated js"]).

Of course this doesn't work because 'append:' expects something that
behaves like a string.  But is there a way I can put some escaped html
generated by a canvas in my dynamically generated js?

I think this won't work anyway because the canvas is for an old render context. In fact, we've been talking about refactoring so that the JSObjects only hold a render context or something instead of the canvas but it's unclear if that will happen in this release cycle (I suspect not).

I think you ought to be able to use a Builder to get a canvas to use here. It can then give you back a string. I think it's mostly geared around passing whole components into it but you can probably get at the canvas and pass it somewhere... look for sender of #builder and see if you can work it out.

If not, I'm sure Lukas will have a much better solution for you tomorrow anyway. ;)

Julian


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSScript objects have a canvas. Can I somehow use this canvas to put escaped html in my js?

Lukas Renggli
> If not, I'm sure Lukas will have a much better solution for you tomorrow
> anyway. ;)

Yes, I hope so ;-)

In fact all methods that expect some HTML (#html:, #after:, #append:,
#before:, #prepend:, #replaceWith:, #wrap:, #wrapAll:, #wrapInner:,
...) take any renderable object as argument. In the simplest case this
is a string, but it could also be a presenter/component, or in your
case a block:

    aQuery append: [ :r | self renderItemOn: r ]

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSScript objects have a canvas. Can I somehow use this canvas to put escaped html in my js?

Julian Fitzell-2
Yup... that is better. :)

On Fri, Mar 27, 2009 at 8:23 AM, Lukas Renggli <[hidden email]> wrote:
> If not, I'm sure Lukas will have a much better solution for you tomorrow
> anyway. ;)

Yes, I hope so ;-)

In fact all methods that expect some HTML (#html:, #after:, #append:,
#before:, #prepend:, #replaceWith:, #wrap:, #wrapAll:, #wrapInner:,
...) take any renderable object as argument. In the simplest case this
is a string, but it could also be a presenter/component, or in your
case a block:

   aQuery append: [ :r | self renderItemOn: r ]

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: JSScript objects have a canvas. Can I somehow use this canvas to put escaped html in my js?

Steven Noble
Thanks guys, that works perfectly

On Fri, Mar 27, 2009 at 6:08 AM, Julian Fitzell <[hidden email]> wrote:

> Yup... that is better. :)
>
> On Fri, Mar 27, 2009 at 8:23 AM, Lukas Renggli <[hidden email]> wrote:
>>
>> > If not, I'm sure Lukas will have a much better solution for you tomorrow
>> > anyway. ;)
>>
>> Yes, I hope so ;-)
>>
>> In fact all methods that expect some HTML (#html:, #after:, #append:,
>> #before:, #prepend:, #replaceWith:, #wrap:, #wrapAll:, #wrapInner:,
>> ...) take any renderable object as argument. In the simplest case this
>> is a string, but it could also be a presenter/component, or in your
>> case a block:
>>
>>    aQuery append: [ :r | self renderItemOn: r ]
>>
>> Cheers,
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside