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

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

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

Mariano Martinez Peck
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to built a JQDialog with a width that comes from a variable?

Gastón Dall' Oglio
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 <[hidden email]>:
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
[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: How to built a JQDialog with a width that comes from a variable?

otto
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 <[hidden email]> 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 <[hidden email]>:
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
[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
Reply | Threaded
Open this post in threaded view
|

Re: How to built a JQDialog with a width that comes from a variable?

Esteban A. Maringolo
But isn't the JQueryLightBoxDecoration just a "visual" decoration?

It is... it is not asynchronous.
Esteban A. Maringolo


2014-07-17 12:59 GMT-03:00 Otto Behrens <[hidden email]>:

> 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
> <[hidden email]> 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 <[hidden email]>:
>>>
>>> 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
>>> [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
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside