Re: jQuery lightbox in Seaside 3.0

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

Re: jQuery lightbox in Seaside 3.0

Mariano Saura
Nick, thanks for sharing.
I succesfully used your JQDialogDecorator on VAST 8.0.2 (Seaside 3.0 rc1).
The only thing I had to do is change the method WAComponent>>jqDialog: to remove the #wait: which is not working on VAST (I simply send #show:onAnswer:delegation:).
That, and changing the behavior of the callbackUrl (when you press the X on the dialog to close it) to do what I needed.

Cheers,
Mariano


On Mon, Jul 12, 2010 at 12:29 PM, Nick Ager <[hidden email]> wrote:
Hi Bob,

Here's my first attempt, which removed the need to define a separate div for the dialog:

  html submitButton
onClick: (html jQuery this append: [:r |
r div
script: (
r jQuery new dialog
autoOpen: true;
modal: true);
with: WACounter new]);
        with: 'Open Lightbox'.

clearly all the code in the onClick could be wrapped in a method. The problem here is that as soon as you click on anchor links on the counter the page refreshes and the dialog vanishes. It's also not a drop-in replacement for #lightbox:

I had a quick look at #lightbox: it achieves it's magic by adding a decorator to the page. I've created a similar decorator for JQuery dialog and it appears to work, including sending answer: nil if the dialog is closed. See attached package.

There are limitations as it doesn't allow setting of potentially useful dialog parameters such as: #height: #width: #title: #resizable: #closeOnEscape: . I'm hoping that if you or others find it useful you can extend the code as necessary and negotiate to have it included in the Seaside repository.

Use it as follows:
renderContentOn: html
html form: [
html submitButton
        callback: [self jqDialog: self counter];
        with: 'Open counter'
]

where the component contains the following methods:
counter
^ counter ifNil: [counter := WACounter new]

children 
^ Array with: self counter

Hope this helps

Nick


On 11 July 2010 15:51, Bob N. <[hidden email]> wrote:
Now that 3.0 RC is available (thanks for all the work; the welcome page is a nice improvement), I'd like to revisit a question I had posted a while ago: is there a jQuery equivalent to the Scriptaculous lightbox in Seaside 3.0?

As I understand it, WADecoration subclass SULightbox as used in WAComponent>>#lightbox: allows for the use of #lightbox: instead of a #call:, whereas the jQuery dialog examples require that the dialog component be defined, and its id known, before the 'dialog open' is sent, so the component itself can't be defined in the callback.  

For jQuery, the example code is...

   | id |
   html div
      id: (id := html nextId);
      script: (html jQuery new dialog
         html: JQCounterFunctionalTest new;
         title: 'Lightbox Dialog';
         resizable: false;
         modal: true).
   html submitButton
      onClick: (html jQuery id: id) dialog open;
      with: 'Open Lightbox'

In Scriptaclous, I can code... 

    html submitButton
        callback: [self lightbox: WACounter new];
        with: 'Open Lightbox'

...how can I do the equivalent in jQuery? 

Coding a jQuery equivalent of the SULightbox decorator does not seem that hard, but I'd rather leave it to the experts ;-)

Thanks,
Bob



_______________________________________________
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




--
Mariano J. Saura
-------------------------------------------------
Desarrollo y Tecnología - Mercap S.R.L.
Tacuarí 202 - 7º Piso - Tel: 54-11-48781116 al 19
Interno: 228
Ciudad Autónoma de Buenos Aires - Argentina
http://www.mercapsoftware.com

-------------------------------------------------

Este mensaje es confidencial. Puede contener información amparada por el secreto profesional. Si usted ha
recibido este e-mail por error, por favor comuníquenoslo inmediatamente via e-mail y tenga la amabilidad
de eliminarlo de su sistema; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
Muchas gracias.

This message is confidential. It may also contain information that is privileged or otherwise legally exempt
from disclosure. If you have received it by mistake please let us know by e-mail immediately and delete it
from your system; also you shouldn't copy the message nor disclose its contents to anyone. Thanks.

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside