Re: seaside Digest, Vol 231, Issue 7
Jovanni Gerosa <[email protected]> Mon, 31 Oct 2022 08:17:35 -0400
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <CAB9nVMf=8r9Y3E9SbkHnV+Th3LK05XzwuT=cmWb=VaEMsqeUMA@mail.gmail.com> |
--===============5369465634357557588== Content-Type: multipart/alternative; boundary="00000000000063669105ec53982f" --00000000000063669105ec53982f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From a reason 2019 special On Mon, Oct 31, 2022 at 7:11 AM <[email protected]= > wrote: > Send seaside mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasid= e > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > 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 <[email protected]> > To: Seaside - general discussion <[email protected]> > Subject: Re: [Seaside] script: [...] value parameter > Message-ID: <[email protected]> > Content-Type: text/plain; charset=3D"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 < > [email protected]> 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=E2= =80=A6 ]; > callback: [ :v | value :=3D v ] passenger: (html jQuery this) > > | value |html button passenger: self; onClick: (html jQuery ajax > callback: [ :v | value :=3D v ] passenger: (html jQuery this); scr= ipt: > [ :s | ...value is the passenger, which in this case is self=E2=80=A6 ] > > > > On 26 Oct 2022, at 13:26, Bob Nemec <[email protected]> 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 coul= d > 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 ou= t > the Todo example: > https://github.com/SeasideSt/Seaside/blob/master/repository/Seaside-Examp= les.package/WATodo.class/instance/renderTodosOn..st > On Monday, October 24, 2022 at 08:50:43 a.m. EDT, Bob Nemec < > [email protected]> 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 specifi= c > 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: [...] bloc= k > is where I'm stuck... using the closest: pattern removes the need for cel= l > 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 < > [email protected]> 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 tha= t > pass values from the client to the server. As such, you can construct wha= t > you want already as follows: | value | > html jQuery ajax > callback: [ :v | value :=3D 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 object= s > 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 :=3D v ] passenger: (html jQuery this); > > > > On 21 Oct 2022, at 19:48, Bob Nemec <[email protected]> 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 > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > _______________________________________________ > seaside mailing list > [email protected] > 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 > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside > > > ------------------------------ > > End of seaside Digest, Vol 231, Issue 7 > *************************************** > --00000000000063669105ec53982f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">From a reason 2019 special</div><div><br><div class=3D"gm= ail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 31, 2022 at 7:= 11 AM <<a href=3D"mailto:[email protected]">sea= [email protected]</a>> wrote:<br></div><blockquote= class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli= d;padding-left:1ex">Send seaside mailing list submissions to<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"mailto:[email protected]= n.org" target=3D"_blank">[email protected]</a><br> <br> To subscribe or unsubscribe via the World Wide Web, visit<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://lists.squeakfoundation.org/cg= i-bin/mailman/listinfo/seaside" rel=3D"noreferrer" target=3D"_blank">http:/= /lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br> or, via email, send a message with subject or body 'help' to<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"mailto:[email protected]= oundation.org" target=3D"_blank">[email protected]= </a><br> <br> You can reach the person managing the list at<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"mailto:[email protected]= ndation.org" target=3D"_blank">[email protected]</a>= <br> <br> When replying, please edit your Subject line so it is more specific<br> than "Re: Contents of seaside digest..."<br> <br> <br> Today's Topics:<br> <br> =C2=A0 =C2=A01. Re: script: [...] value parameter (Bob Nemec)<br> <br> <br> ----------------------------------------------------------------------<br> <br> Message: 1<br> Date: Mon, 31 Oct 2022 11:11:10 +0000 (UTC)<br> From: Bob Nemec <<a href=3D"mailto:[email protected]" target=3D"_blank">bo= [email protected]</a>><br> To: Seaside - general discussion <<a href=3D"mailto:[email protected]= foundation.org" target=3D"_blank">[email protected]</a>>= ;<br> Subject: Re: [Seaside] script: [...] value parameter<br> Message-ID: <<a href=3D"mailto:[email protected]= o.com" target=3D"_blank">[email protected]</a>= ><br> Content-Type: text/plain; charset=3D"utf-8"<br> <br> =C2=A0Cool, that is good to know. I always assumed that the block order was= registered and used that way.=C2=A0<br> Bob<br> =C2=A0 =C2=A0 On Thursday, October 27, 2022 at 01:26:30 p.m. EDT, Johan Bri= chau <<a href=3D"mailto:[email protected]" target=3D"_blank">johan@ince= ptive.be</a>> wrote:=C2=A0 <br> <br> =C2=A0Hi Bob,<br> Good to hear it works out.Just a note: the order in which you send the `scr= ipt:` and `callback:value:` (or `callback:passenger:`) blocks to the JQAjax= instance does not matter. Seaside will always invoke the `script:` block l= ast since it is the primary callback that generates a response.The followin= g message orders are equivalent:<br> | value |html button=C2=A0 =C2=A0passenger: self;=C2=A0 =C2=A0onClick: (htm= l jQuery ajax=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0script: [ :s | ...value is th= e passenger, which in this case is self=E2=80=A6 ];=C2=A0 =C2=A0 =C2=A0 =C2= =A0callback: [ :v | value :=3D v ] passenger: (html jQuery this)<br> <br> | value |html button=C2=A0 =C2=A0passenger: self;=C2=A0 =C2=A0onClick: (htm= l jQuery ajax=C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0callback: [ :v | value :=3D v= ] passenger: (html jQuery this);=C2=A0 =C2=A0 =C2=A0 =C2=A0script: [ :s | = ...value is the passenger, which in this case is self=E2=80=A6 ]<br> <br> <br> <br> On 26 Oct 2022, at 13:26, Bob Nemec <<a href=3D"mailto:[email protected]" = target=3D"_blank">[email protected]</a>> wrote:<br> =C2=A0For those that don't follow Discord, Johan provided a solution wi= th an example that works for me.<br> 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. = <br> Seems obvious now...=C2=A0<br> The "script:value:" you are looking for is really the combination= of a "callback:value:" with a "script:" on the same aj= ax 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 referri= ng to, you can check out the Todo example:=C2=A0<a href=3D"https://github.c= om/SeasideSt/Seaside/blob/master/repository/Seaside-Examples.package/WATodo= .class/instance/renderTodosOn..st" rel=3D"noreferrer" target=3D"_blank">htt= ps://github.com/SeasideSt/Seaside/blob/master/repository/Seaside-Examples.p= ackage/WATodo.class/instance/renderTodosOn..st</a><br> =C2=A0 =C2=A0 On Monday, October 24, 2022 at 08:50:43 a.m. EDT, Bob Nemec &= lt;<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>= > wrote:=C2=A0 <br> <br> =C2=A0 (Also posted on Discord) ... Thanks: we already use the secondary ca= llbacks & passenger patters. In this case, we have a large calendar com= ponent for which we're trying to avoid rendering too much cell specific= code (html content gets crazy big).=C2=A0=C2=A0Ideally, I'd have one s= cript for the calendar that uses JQueryInstance>>closest: to get the = div id / passenger, pass that to a script: [...] block, and then have the b= rowser run the script block result.=C2=A0<br> That works (and we're using it) for static onMouseOver: js script conte= nt, but having new content on each mouseover provided by a script: [...] bl= ock is where I'm stuck... using the closest: pattern removes the need f= or cell div specific scripts (with a noticeable render speed=C2=A0 improvem= ent), but I can't pass along the closest div to the script: [...] block= to build cell specific content.=C2=A0=C2=A0<br> Feels like it a...=C2=A0script: [:script :value | ...] value: (js script)..= .pattern should work with a closest: div parameter. Great opportunity for m= e to learn more Seaside internal :-)=C2=A0=C2=A0<br> Bob=C2=A0 =C2=A0 On Monday, October 24, 2022 at 03:08:24 a.m. EDT, Johan Br= ichau <<a href=3D"mailto:[email protected]" target=3D"_blank">johan@inc= eptive.be</a>> wrote:=C2=A0 <br> <br> =C2=A0I copy/paste my response on the Discord channel:<br> <br> =C2=A0 =C2=A0- An ajax request with Seaside JQuery can combine multiple sec= ondary 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 r= esponse-generating callback, while secondary callbacks are callbacks that p= ass values from the client to the server. As such, you can construct what y= ou want already as follows:=C2=A0 =C2=A0| value |<br> html jQuery ajax <br> =C2=A0 =C2=A0callback: [ :v | value :=3D v ] value: (html jQuery this prope= rtyAt: 'id');<br> =C2=A0 =C2=A0script: [ :s | ...use value in the generation of the script...= ]<br> =C2=A0 =C2=A0- [9:40 AM]Also, take a look at passengers if you want to stor= e objects and retrieve them by id. Seaside has this mechanism built-in for = you:=C2=A0 =C2=A0| value |<br> html button<br> =C2=A0 =C2=A0passenger: self;<br> =C2=A0 =C2=A0onClick: (html jQuery ajax <br> =C2=A0 =C2=A0 =C2=A0 =C2=A0callback: [ :v | value :=3D v ] passenger: (html= jQuery this);<br> <br> <br> <br> On 21 Oct 2022, at 19:48, Bob Nemec <<a href=3D"mailto:[email protected]" = target=3D"_blank">[email protected]</a>> wrote:<br> Cross posted from Seaside Discord channel...<br> I would like to have an 'html ajax script: [...]' method that has a= callback:value: pattern.=C2=A0<br> Something like...=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0html ajax script: [:script := value | ...] value: (html jQuery this propertyAt: 'id')=C2=A0<br> Then in the script block 'value' would get the id of 'this'= , which in an ajax callback is undefined.=C2=A0This would allow server code= to use browser information to build the script.=C2=A0<br> Anyone done this?<br> <br> Bob Nemec<br> _______________________________________________<br> seaside mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br> <a href=3D"http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasi= de" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakfoundation.org/= cgi-bin/mailman/listinfo/seaside</a><br> <br> <br> _______________________________________________<br> seaside mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br> <a href=3D"http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasi= de" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakfoundation.org/= cgi-bin/mailman/listinfo/seaside</a><br> =C2=A0 _______________________________________________<br> seaside mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br> <a href=3D"http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasi= de" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakfoundation.org/= cgi-bin/mailman/listinfo/seaside</a><br> =C2=A0 _______________________________________________<br> seaside mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br> <a href=3D"http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasi= de" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakfoundation.org/= cgi-bin/mailman/listinfo/seaside</a><br> <br> <br> _______________________________________________<br> seaside mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br> <a href=3D"http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasi= de" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakfoundation.org/= cgi-bin/mailman/listinfo/seaside</a><br> <br> -------------- next part --------------<br> An HTML attachment was scrubbed...<br> URL: <<a href=3D"http://lists.squeakfoundation.org/pipermail/seaside/att= achments/20221031/1efae778/attachment.html" rel=3D"noreferrer" target=3D"_b= lank">http://lists.squeakfoundation.org/pipermail/seaside/attachments/20221= 031/1efae778/attachment.html</a>><br> <br> ------------------------------<br> <br> Subject: Digest Footer<br> <br> _______________________________________________<br> seaside mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">sea= [email protected]</a><br> <a href=3D"http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seasi= de" rel=3D"noreferrer" target=3D"_blank">http://lists.squeakfoundation.org/= cgi-bin/mailman/listinfo/seaside</a><br> <br> <br> ------------------------------<br> <br> End of seaside Digest, Vol 231, Issue 7<br> ***************************************<br> </blockquote></div></div> --00000000000063669105ec53982f-- --===============5369465634357557588== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18Kc2Vhc2lkZSBt YWlsaW5nIGxpc3QKc2Vhc2lkZUBsaXN0cy5zcXVlYWtmb3VuZGF0aW9uLm9yZwpodHRwOi8vbGlz dHMuc3F1ZWFrZm91bmRhdGlvbi5vcmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3NlYXNpZGUK --===============5369465634357557588==--