Permalink
Browse files

Regenerated JavaScript

  • Loading branch information...
1 parent fc5adc1 commit b3366b739d226e69234bb53b2ba922aa629cc941 @danryan danryan committed Oct 9, 2012
Showing with 20 additions and 3 deletions.
  1. +20 −3 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();
}
}
}

0 comments on commit b3366b7

Please sign in to comment.