You could try with css.

1. assign to the component trigger a specific class for example 
"link_with_loader"

A(IMG(_src=image), _href=URL('default', 'getit'), _class="link_with_loader", 
user_signature=True, cid=request.cid)


2. since web2py adds  the "disabled" class to the component trigger when 
it's working,  we can customize it with css

a.link_with_loader.disabled img {visibility: hidden; /* hides the original 
image preserving its dimensions */}
a.link_with_loader.disabled {
    color: transparent; /* makes invisible the "Working..." text */
    cursor: not-allowed;
    pointer-events: none;
    display: inline-block;
    background: url("../static/images/our_loader.gif") no-repeat; /* shows 
the loader image */
}


Maybe you should add more css rules in order to fit your needs.
Please note that the customized css code goes preferibly in a separate file 
and loaded after other we2py/template css files (see <head> section in 
layout.html for reference).


Il giorno mercoledì 8 febbraio 2017 01:17:11 UTC+1, Tim Korb ha scritto:
>
> I'm using the Ajax feature of the A tag to replace a component:  
>
>     A(IMG(_src=image), _href=URL('default', 'getit'), 
> user_signature=True, cid=request.cid)
>
> While the content (default/getit) is being fetched, I would like to 
> replace the current image with a spinner image, rather than the default 
> "Working..." text.  I see a number of related posts in the forum involving 
> w2p_disable_with, but I can't figure out how to make that work (if it is 
> even supposed to).
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to