diff options
Diffstat (limited to 'users/app/assets/javascripts/users.js.coffee')
-rw-r--r-- | users/app/assets/javascripts/users.js.coffee | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/users/app/assets/javascripts/users.js.coffee b/users/app/assets/javascripts/users.js.coffee index b0b624c..c9cc182 100644 --- a/users/app/assets/javascripts/users.js.coffee +++ b/users/app/assets/javascripts/users.js.coffee @@ -19,12 +19,16 @@ srp.error = (message) -> alert(message) display_errors = (errors) -> + clear_errors(); for field, error of errors if field == 'base' display_base_error(error); else display_field_error(field, error); +clear_errors = -> + $('#messages').empty(); + display_field_error = (field, error) -> element = $('form input[name$="['+field+']"]') return unless element @@ -32,8 +36,7 @@ display_field_error = (field, error) -> display_base_error = (message) -> messages = $('#messages') - messages.append "<div class=\"alert alert-error\"><a class=\"close\" \"data-dismiss\"=\"alert\">×</a><div class=\"flash_error\">" + message + "</div></div>" - + messages.append "<div class=\"alert alert-error\">" + message + "</div></div>" pollUsers = (query, process) -> $.get( "/users.json", query: query).done(process) |