fixed the collapse function, refactored LOAD() to use new web2py.js

This commit is contained in:
niphlod
2013-06-27 22:31:11 +02:00
parent 81fa9b1984
commit 917d2087c5
4 changed files with 55 additions and 16 deletions
+15 -2
View File
@@ -20,7 +20,7 @@
if(window.focus) newwindow.focus();
return false;
},
collapse: function () {
collapse: function (id) {
$('#' + id).slideToggle();
},
fade: function (id, value) {
@@ -144,6 +144,7 @@
web2py.manage_errors(target);
web2py.ajax_fields(target);
web2py.show_if_handler(target);
web2py.component_handler(target);
},
//manage errors in forms
manage_errors: function(target) {
@@ -275,7 +276,7 @@
var jelement = $("#" + target);
var element = jelement.get(0);
var statement = "jQuery('#" + target + "').get(0).reload();";
jelement.reload = function () {
element.reload = function () {
// Continue if times is Infinity or
// the times limit is not reached
if(element.reload_check()) {
@@ -484,6 +485,18 @@
show_if.call($('#' + name, target));
};
},
component_handler : function (target) {
$('div[data-w2p_remote]', target).each(function () {
var remote, times, timeout, target;
var el = $(this);
remote = el.data('w2p_remote');
times = el.data('w2p_times');
timeout = el.data('w2p_timeout');
target = el.attr('id');
web2py.component(remote, target, timeout, times, $(this));
}
)
},
a_handler: function (el, e) {
e.preventDefault();
var method = el.data('w2p_method');