You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by bhorvat <ho...@gmail.com> on 2013/02/18 21:54:25 UTC

Spinner - Prototype to JQuery (ie tapestry5-jquery)

Probably not the best place to ask (and probably not the best question as
well) but I am not that good at jquery so I have no real idea where to
start.

But does anyone have an idea how to covert 

// A script that detects when any Form is being submitted or any component
issues a request involving a zone. It reacts by overlaying the 
// zone with a div of class "zone-loading-overlay". The idea is that you
should define that class, in css, to display an animated GIF.
//
// Based on a solution by Howard Lewis Ship at
http://tapestryjava.blogspot.co.uk/2011/12/adding-ajax-throbbers-to-zone-updates.html
.
// Written in Protoype style because Tapestry includes the Protoype library
(http://www.prototypejs.org/).

Tapestry.onDOMLoaded(function() {

	function addZoneOverlay(event, element) {
        var mgr = Tapestry.findZoneManager(element);
        var zone = mgr && mgr.element;

        if (!zone) {
            return;
        }

        zone.insert({top:"<div class='zone-loading-overlay'/>"});
        var zoneDims = zone.getDimensions()
        var overlay = zone.down("div");

        overlay.setStyle({
            width: zoneDims.width + "px",
            height: zoneDims.height + "px" 
        });
    }

	// Tell document body to call addAjaxOverlay whenever a Form is submitted
or a zone-related form or link is clicked.
	
    $(document.body).on(Tapestry.FORM_PROCESS_SUBMIT_EVENT, addZoneOverlay);
    $(document.body).on(Tapestry.TRIGGER_ZONE_UPDATE_EVENT, addZoneOverlay);
}); 

to jquery???

I really appreciate any input you can share



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Spinner-Prototype-to-JQuery-ie-tapestry5-jquery-tp5720077.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Spinner - Prototype to JQuery (ie tapestry5-jquery)

Posted by bhorvat <ho...@gmail.com>.
So the jquery code conversion is something I can figure out on my own but I
am having hard time with this part

 $(document.body).on(Tapestry.TRIGGER_ZONE_UPDATE_EVENT, addAjaxOverlay);

so in prototype this would return 

function addAjaxOverlay(event, element) { var mgr =
Tapestry.findZoneManager(element);... }

so an event and an element of something that is (I guess) a zone element
object that is used to find a zone.

Does anyone have any idea how can I find a same information? I have tried to
debug the event object - this is the only thing that is passed to the method
but it does not contain anything like zone id.

Should I maybe use some other event or some other way to trigger an event in
tapestry-jquery?

cheer



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Spinner-Prototype-to-JQuery-ie-tapestry5-jquery-tp5720077p5720134.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Spinner - Prototype to JQuery (ie tapestry5-jquery)

Posted by bhorvat <ho...@gmail.com>.
Problem is that I cant switch alias on prototype but I have do it on jquery
and that is not the best solution :)



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Spinner-Prototype-to-JQuery-ie-tapestry5-jquery-tp5720077p5720087.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Spinner - Prototype to JQuery (ie tapestry5-jquery)

Posted by bhorvat <ho...@gmail.com>.
Yea I guess I could try to run Prototype as well. Thought I would be more
happy to have only one framework if possible. 

Thanks for the suggestion will keep it in mind :D



--
View this message in context: http://tapestry.1045711.n5.nabble.com/Spinner-Prototype-to-JQuery-ie-tapestry5-jquery-tp5720077p5720086.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Spinner - Prototype to JQuery (ie tapestry5-jquery)

Posted by George Ludwig <ge...@gmail.com>.
Why bother converting it? You can run Prototype along with jQuery.


On Mon, Feb 18, 2013 at 1:04 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Mon, 18 Feb 2013 17:54:25 -0300, bhorvat <ho...@gmail.com>
> wrote:
>
>  Probably not the best place to ask (and probably not the best question as
>> well)
>>
>
> Yep, this is really the wrong place to ask. This is completely unrelated
> to Tapestry. You'll probably should post this on the jQuery mailing lists
> or some site like Stack Overflow. Or maybe just reading the jQuery API
> documentation will be enough.
>
> --
> Thiago H. de Paula Figueiredo
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Spinner - Prototype to JQuery (ie tapestry5-jquery)

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Mon, 18 Feb 2013 17:54:25 -0300, bhorvat <ho...@gmail.com>  
wrote:

> Probably not the best place to ask (and probably not the best question as
> well)

Yep, this is really the wrong place to ask. This is completely unrelated  
to Tapestry. You'll probably should post this on the jQuery mailing lists  
or some site like Stack Overflow. Or maybe just reading the jQuery API  
documentation will be enough.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org