mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Removed TODO and fixed indent.
This commit is contained in:
@@ -1,29 +1,28 @@
|
|||||||
$(function(){
|
$(function(){
|
||||||
$.each($('form[validate=true]'), function(i, form){
|
$.each($('form[validate=true]'), function(i, form){
|
||||||
$(form).submit(validate);
|
$(form).submit(validate);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function validate(e){
|
function validate(e){
|
||||||
var form = $(e.target);
|
var form = $(e.target);
|
||||||
|
|
||||||
if(form.data('validated') == true){
|
if(form.data('validated') == true){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use $.post() instead of $.getJSON
|
$.post(form.attr('action') + '/validate', $(e.target).serialize(), function(data){
|
||||||
$.post(form.attr('action') + '/validate', $(e.target).serialize(), function(data){
|
// clear all error messages
|
||||||
// clear all error messages
|
$('.error-message').text('');
|
||||||
$('.error-message').text('');
|
|
||||||
|
if($.isEmptyObject(data)){
|
||||||
if($.isEmptyObject(data)){
|
form.data('validated', true);
|
||||||
form.data('validated', true);
|
form.submit();
|
||||||
form.submit();
|
} else {
|
||||||
} else {
|
$.each(data, function(key, value){
|
||||||
$.each(data, function(key, value){
|
$('#error-' + key).text(value);
|
||||||
$('#error-' + key).text(value);
|
});
|
||||||
});
|
}
|
||||||
}
|
}, 'json');
|
||||||
}, 'json');
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user