Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Regenerated JavaScript

  • Loading branch information...
commit b3366b739d226e69234bb53b2ba922aa629cc941 1 parent fc5adc1
@danryan danryan authored
Showing with 20 additions and 3 deletions.
  1. +20 −3 vendor/assets/javascripts/rails.validations.simple_form.js
View
23 vendor/assets/javascripts/rails.validations.simple_form.js
@@ -1,6 +1,6 @@
/*
- Client Side Validations - SimpleForm - v2.0.0.rc.1
+ Client Side Validations - SimpleForm - v2.0.0.rc.2
https://github.com/dockyard/client_side_validations-simple_form
Copyright (c) 2012 DockYard, LLC
@@ -44,10 +44,27 @@
},
bootstrap: {
add: function(element, settings, message) {
- return this.wrappers['default'].add.call(this, element, settings, message);
+ var errorElement, wrapper_class_element, wrapper_tag_element;
+ if (element.data('valid') !== false) {
+ wrapper_class_element = element.closest("." + settings.wrapper_class);
+ wrapper_tag_element = element.closest(settings.wrapper_tag);
+ wrapper_class_element.addClass(settings.wrapper_error_class);
+ errorElement = $("<" + settings.error_tag + "/>", {
+ "class": settings.error_class,
+ text: message
+ });
+ return wrapper_tag_element.append(errorElement);
+ } else {
+ return element.parent().find("" + settings.error_tag + "." + settings.error_class).text(message);
+ }
},
remove: function(element, settings) {
- return this.wrappers['default'].remove.call(this, element, settings);
+ var errorElement, wrapper_class_element, wrapper_tag_element;
+ wrapper_class_element = element.closest("." + settings.wrapper_class + "." + settings.wrapper_error_class);
+ wrapper_tag_element = element.closest(settings.wrapper_tag);
+ wrapper_class_element.removeClass(settings.wrapper_error_class);
+ errorElement = wrapper_tag_element.find("" + settings.error_tag + "." + settings.error_class);
+ return errorElement.remove();
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.