Thanks Anthony, that's very useful to know. 

I'll have a look and try the simplest option :-). I'll have to update 
web2py first so I'm not tinkering with old code to start with. I'll post my 
code in one of those places if it works as expected.

On Saturday, March 2, 2013 12:59:45 AM UTC, Anthony wrote:
>
> I have had a little look through the web2py source on github and it seems 
>> to me it would be more consistent for components if a function was called 
>> here: 
>> https://github.com/web2py/web2py/blob/master/applications/welcome/static/js/web2py.js#L120that
>>  re-ran the same code found in web2py_bootstrap.js. Possibly this 
>> function could act just on the loaded/reloaded content.
>
>
> web2py_bootstrap.js is specific to the scaffolding app, whereas web2py.js 
> is more general, so I don't think we should include 
> Bootstrap/scaffold-specific code in web2py.js. However, something like this 
> in web2py_bootstrap.js might do the trick:
>
> jQuery(document).ajaxSuccess(function() {
>   jQuery('button, form input[type="submit"], form input[type="button"]').
> addClass('btn');
> });
>
> That will add the 'btn' class every time an Ajax request completes (so it 
> will work even work for Ajax requests that are not for components).
>
> If for some reason we want to be more targeted and only run this for 
> components, we could have web2py_ajax_page() use .trigger() to trigger a 
> custom event, and web2py_bootstrap.js could define a handler for that event 
> using .on(). I suppose it could be useful more generally to have a custom 
> event fire every time a component loads/re-loads.
>  
>
>> Incidentally how would I go about submitting or requesting a change like 
>> this if I did give it a go?
>
>
> You can always post on the developers list. Another option is to submit 
> an issue <https://code.google.com/p/web2py/issues/list> along with your 
> proposed change.
>
> Anthony
>

-- 

--- 
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/groups/opt_out.


Reply via email to