server/src/main/webapp/static/js/admin_form.js
author ymh <ymh.work@gmail.com>
Mon, 21 Oct 2013 13:58:20 +0200
branchuser_management
changeset 222 6ac00231ee34
permissions -rw-r--r--
Manage users. (not passwords)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
222
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
function showformErrors(errors) {
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
    $(".form-error").remove();
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
    
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
    $.each(errors,function(k,v){
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
        $("#"+k).after('<div class="form-error">'+v+'</div>');
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
    });
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
    $(".form-error").effect("highlight", {}, 1500);
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
}
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
function formatJson(jsonText, tabSize) {
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    var obj = JSON.parse(jsonText);
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    return JSON.stringify(obj, undefined, tabSize);
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
}
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
function compactJson(jsonText) {
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    var obj = JSON.parse(jsonText);
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    return JSON.stringify(obj);
6ac00231ee34 Manage users. (not passwords)
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
}