[Seaside] How to built a JQDialog with a width that comes from a variable?

Otto Behrens otto at finworks.biz
Thu Jul 17 15:59:17 UTC 2014


Hi,

With lots of work, we got to this approach, which also uses a decoration:

WAComponent >> jLightbox: aComponent
"Display aComponent within a lightbox of the receiver. Note, that this does
a full refresh displaying the lightbox."

| dialog answer |
dialog := JQueryLightBoxDecoration new.
self addDecoration: dialog.
answer := dialog holder call: aComponent.
self removeDecoration: dialog.
^ answer


WADecoration subclass: #JQueryLightBoxDecoration
instanceVariableNames: 'holder'

JQueryLightBoxDecoration >> renderContentOn: html
self renderNextOn: html.
html div
id: 'lightbox';
script:
(html jQuery this dialog
resizable: false;
autoOpen: true;
modal: true;
width: 'auto';
yourself);
with: [ html render: holder ]

JQueryLightBoxDecoration >> initialize
super initialize.
holder := WAComponent new


HTH
Otto


On Thu, Jul 17, 2014 at 4:04 PM, Gastón Dall' Oglio <
gaston.dalloglio at gmail.com> wrote:

> Hi Mariano.
>
> I guess that this info can help you:
> http://forum.world.st/Incorrect-position-en-JQDialog-td4399806.html
>
> I have a webapp in that I made an WADecoration subclass to render a
> JQDialog around the decorated WAComponent, and I hold in this all JQDialog
> information, like position and size. I share in as soon I have time to find
> this image :)
>
> Best.
>
>
>
>
> 2014-07-15 19:08 GMT-03:00 Mariano Martinez Peck <marianopeck at gmail.com>:
>
>> Hi guys,
>>
>> I am currently creating a JQDialog. Such an object allows one to define a
>> 'width'. But it can only be passed a number (pixels). In my case I want a
>> special default..say $(window).width() * 0.9
>>
>> I tried many ways of dealing with that and I failed completly. The way I
>> create the script is this:
>>
>> scriptToOpenDialogOn: html value: value
>>
>> ((html jQuery: '#popupContainer') dialog close),
>>  ((html jQuery: '#popupContainer') dialog
>> title: value second;
>> html: value first;
>>  modal: false;
>> autoOpen: true;
>> draggable: true;
>>  resizable: false;
>> position: 'top';
>> closeOnEscape: true;
>>  width: 900;
>> addButton: 'Close' do: (html jQuery: '#popupContainer') dialog close)
>>
>> And that is appended to #script: of an ajax callback:
>>
>> scriptForPopupClickHandlerOn: html | val | val := ValueHolder new. ^ html
>> jQuery this on: 'click' selector: '.clickablePopup' do: ((html jQuery ajax
>> callback: [:pass | val contents: pass first ] passengers: (html jQuery
>> this); script: [ :s | s << (self scriptToOpenDialogOn: s value: val
>> contents) ]) asFunction: #(event))
>>
>> Any ideas how could i make those 900 pixels to be a % of say..the width
>> of the root document?
>>
>> Thanks in advance,
>>
>>
>> --
>> Mariano
>> http://marianopeck.wordpress.com
>>
>> _______________________________________________
>> 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/20140717/bcb96496/attachment.htm


More information about the seaside mailing list