[Seaside] seaside Digest, Vol 231, Issue 7

Jovanni Gerosa gerosajovanni at gmail.com
Mon Oct 31 12:17:35 UTC 2022


>From a reason 2019 special

On Mon, Oct 31, 2022 at 7:11 AM <seaside-request at lists.squeakfoundation.org>
wrote:

> Send seaside mailing list submissions to
>         seaside at lists.squeakfoundation.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> or, via email, send a message with subject or body 'help' to
>         seaside-request at lists.squeakfoundation.org
>
> You can reach the person managing the list at
>         seaside-owner at lists.squeakfoundation.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of seaside digest..."
>
>
> Today's Topics:
>
>    1. Re: script: [...] value parameter (Bob Nemec)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 31 Oct 2022 11:11:10 +0000 (UTC)
> From: Bob Nemec <bobn at rogers.com>
> To: Seaside - general discussion <seaside at lists.squeakfoundation.org>
> Subject: Re: [Seaside] script: [...] value parameter
> Message-ID: <644333690.1668721.1667214670858 at mail.yahoo.com>
> Content-Type: text/plain; charset="utf-8"
>
>  Cool, that is good to know. I always assumed that the block order was
> registered and used that way.
> Bob
>     On Thursday, October 27, 2022 at 01:26:30 p.m. EDT, Johan Brichau <
> johan at inceptive.be> wrote:
>
>  Hi Bob,
> Good to hear it works out.Just a note: the order in which you send the
> `script:` and `callback:value:` (or `callback:passenger:`) blocks to the
> JQAjax instance does not matter. Seaside will always invoke the `script:`
> block last since it is the primary callback that generates a response.The
> following message orders are equivalent:
> | value |html button   passenger: self;   onClick: (html jQuery ajax
>  script: [ :s | ...value is the passenger, which in this case is self… ];
>      callback: [ :v | value := v ] passenger: (html jQuery this)
>
> | value |html button   passenger: self;   onClick: (html jQuery ajax
>  callback: [ :v | value := v ] passenger: (html jQuery this);       script:
> [ :s | ...value is the passenger, which in this case is self… ]
>
>
>
> On 26 Oct 2022, at 13:26, Bob Nemec <bobn at rogers.com> wrote:
>  For those that don't follow Discord, Johan provided a solution with an
> example that works for me.
> What I needed to position the script: block after the callback:value:
> block, and have the callback:value: set state that the script: block could
> use.
> Seems obvious now...
> The "script:value:" you are looking for is really the combination of a
> "callback:value:" with a "script:" on the same ajax request. You can pass
> the 'closest div passenger' to the script block using temporary variables
> that get assigned in the callback:value: or callback:passenger: block and
> then use those in the script: block. If you want to see some example
> combinations with event delegation you are referring to, you can check out
> the Todo example:
> https://github.com/SeasideSt/Seaside/blob/master/repository/Seaside-Examples.package/WATodo.class/instance/renderTodosOn..st
>     On Monday, October 24, 2022 at 08:50:43 a.m. EDT, Bob Nemec <
> bobn at rogers.com> wrote:
>
>   (Also posted on Discord) ... Thanks: we already use the secondary
> callbacks & passenger patters. In this case, we have a large calendar
> component for which we're trying to avoid rendering too much cell specific
> code (html content gets crazy big).  Ideally, I'd have one script for the
> calendar that uses JQueryInstance>>closest: to get the div id / passenger,
> pass that to a script: [...] block, and then have the browser run the
> script block result.
> That works (and we're using it) for static onMouseOver: js script content,
> but having new content on each mouseover provided by a script: [...] block
> is where I'm stuck... using the closest: pattern removes the need for cell
> div specific scripts (with a noticeable render speed  improvement), but I
> can't pass along the closest div to the script: [...] block to build cell
> specific content.
> Feels like it a... script: [:script :value | ...] value: (js
> script)...pattern should work with a closest: div parameter. Great
> opportunity for me to learn more Seaside internal :-)
> Bob    On Monday, October 24, 2022 at 03:08:24 a.m. EDT, Johan Brichau <
> johan at inceptive.be> wrote:
>
>  I copy/paste my response on the Discord channel:
>
>    - An ajax request with Seaside JQuery can combine multiple secondary
> callbacks and a single primary callback. You can find out which are which
> in the method comments on JQAjax. In short: a primary callback is a
> response-generating callback, while secondary callbacks are callbacks that
> pass values from the client to the server. As such, you can construct what
> you want already as follows:   | value |
> html jQuery ajax
>    callback: [ :v | value := v ] value: (html jQuery this propertyAt:
> 'id');
>    script: [ :s | ...use value in the generation of the script... ]
>    - [9:40 AM]Also, take a look at passengers if you want to store objects
> and retrieve them by id. Seaside has this mechanism built-in for you:   |
> value |
> html button
>    passenger: self;
>    onClick: (html jQuery ajax
>        callback: [ :v | value := v ] passenger: (html jQuery this);
>
>
>
> On 21 Oct 2022, at 19:48, Bob Nemec <bobn at rogers.com> wrote:
> Cross posted from Seaside Discord channel...
> I would like to have an 'html ajax script: [...]' method that has a
> callback:value: pattern.
> Something like...     html ajax script: [:script :value | ...] value:
> (html jQuery this propertyAt: 'id')
> Then in the script block 'value' would get the id of 'this', which in an
> ajax callback is undefined. This would allow server code to use browser
> information to build the script.
> Anyone done this?
>
> Bob Nemec
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>   _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>   _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.squeakfoundation.org/pipermail/seaside/attachments/20221031/1efae778/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> ------------------------------
>
> End of seaside Digest, Vol 231, Issue 7
> ***************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20221031/bd09acc0/attachment.html>


More information about the seaside mailing list