User page functionality merger (80%)

This commit is contained in:
Dima Malishev 2011-07-23 17:34:27 +03:00
parent 2b06ef5faa
commit 43dffa3fbe
11 changed files with 826 additions and 208 deletions

View file

@ -15,18 +15,38 @@ App.Validate.Is = {
App.Validate.form = function(values, form_ref){
// TODO: validate it!
return true;
var errors = [];
$.each(values, function(key) {
var value = values[key];
/*if ('undefined' != typeof App.Validate.Is[key] ) {
if(var error = App.Validate.Is[key](value)) {
errors[erros.length++] = error;
App.Validate.form = function(world, elm)
{
var form_valid = true;
App.Env.FormError = [];
$(elm).find('select, input, textarea').each(function(i, field)
{
if ($.inArray($(field).attr('name'), ['target', 'source', 'save']) != -1) {
//return; // pass
}
else {
if ($(field).val().trim() == '') {
App.Env.FormError.push($(field).attr('name') + ' is required');
form_valid = false;
}
}*/
});
}
});
return form_valid;
}
App.Validate.displayFormErrors = function(world, elm)
{
var errors_tpl = '';
$(App.Env.FormError).each(function(i, error)
{
var tpl = App.Templates.get('error_elm', 'general');
tpl.set(':ERROR', error);
errors_tpl += tpl.finalize();
});
var ref = $('.form-error', elm);
ref.removeClass('hidden');
ref.html(errors_tpl);
}