synced web2py.js, thanks Vinicius

This commit is contained in:
mdipierro
2013-11-06 16:57:33 -06:00
parent ee1de04544
commit 58c22b8ed0
3 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.7.4-stable+timestamp.2013.11.06.11.14.11 Version 2.7.4-stable+timestamp.2013.11.06.16.56.35
+8 -8
View File
@@ -250,22 +250,20 @@
}); });
}, },
trap_form: function (action, target) { trap_form: function (action, target) {
/* traps any LOADed form */ /* traps any LOADed form */
$('#' + target + ' form').each(function (i) { $('#' + target + ' form').each(function (i) {
var form = $(this); var form = $(this);
if(form.hasClass('no_trap')) { if (form.hasClass('no_trap')) {
return; return;
} }
form.attr('data-w2p_target', target); form.attr('data-w2p_target', target);
var url; var url = form.attr('action');
if(form.hasClass('trap_use_form_action')) { if ((url === "") || (url === "#")) {
/* submit using form own action, instead of component url */ /* form has no action. Use component url. */
url = form.attr('action');
} else {
/* should be there by default */
url = action; url = action;
} }
@@ -275,8 +273,10 @@
web2py.ajax_page('post', url, form.serialize(), target, form); web2py.ajax_page('post', url, form.serialize(), target, form);
e.preventDefault(); e.preventDefault();
}); });
}); });
}, },
ajax_page: function (method, action, data, target, element) { ajax_page: function (method, action, data, target, element) {
/* element is a new parameter, but should be put be put in front */ /* element is a new parameter, but should be put be put in front */
if(element == undefined) element = $(document); if(element == undefined) element = $(document);
+8 -8
View File
@@ -250,22 +250,20 @@
}); });
}, },
trap_form: function (action, target) { trap_form: function (action, target) {
/* traps any LOADed form */ /* traps any LOADed form */
$('#' + target + ' form').each(function (i) { $('#' + target + ' form').each(function (i) {
var form = $(this); var form = $(this);
if(form.hasClass('no_trap')) { if (form.hasClass('no_trap')) {
return; return;
} }
form.attr('data-w2p_target', target); form.attr('data-w2p_target', target);
var url; var url = form.attr('action');
if(form.hasClass('trap_use_form_action')) { if ((url === "") || (url === "#")) {
/* submit using form own action, instead of component url */ /* form has no action. Use component url. */
url = form.attr('action');
} else {
/* should be there by default */
url = action; url = action;
} }
@@ -275,8 +273,10 @@
web2py.ajax_page('post', url, form.serialize(), target, form); web2py.ajax_page('post', url, form.serialize(), target, form);
e.preventDefault(); e.preventDefault();
}); });
}); });
}, },
ajax_page: function (method, action, data, target, element) { ajax_page: function (method, action, data, target, element) {
/* element is a new parameter, but should be put be put in front */ /* element is a new parameter, but should be put be put in front */
if(element == undefined) element = $(document); if(element == undefined) element = $(document);