Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala committed Nov 11, 2017
1 parent 3cb9919 commit e9d6e21
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
20 changes: 0 additions & 20 deletions coffeescript/rails.validations.coffee
Expand Up @@ -33,20 +33,6 @@ $.fn.isValid = (validators) ->
else
validateElement(obj, validatorsFor(@[0].name, validators))

# Determine the proper event to listen to
#
# Turbolinks and Turbolinks Classic don't use the same event, so we will try to
# detect Turbolinks Classic by the EVENT hash, which is not defined
# in the new 5.0 version.
initializeOnEvent =
if window.Turbolinks? and window.Turbolinks.supported
if window.Turbolinks.EVENTS?
'page:change'
else
'turbolinks:load'
else
'ready'

validatorsFor = (name, validators) ->
return validators[name] if validators.hasOwnProperty(name)

Expand Down Expand Up @@ -458,10 +444,4 @@ ClientSideValidations =

ClientSideValidations.enablers.form(form)

# Main hook
# If new forms are dynamically introduced into the DOM, the .validate() method
# must be invoked on that form
$(document).on initializeOnEvent, ->
$(ClientSideValidations.selectors.forms).validate()

window.ClientSideValidations = ClientSideValidations
8 changes: 1 addition & 7 deletions vendor/assets/javascripts/rails.validations.js
Expand Up @@ -6,7 +6,7 @@
*/

(function() {
var $, ClientSideValidations, initializeOnEvent, validateElement, validateForm, validatorsFor,
var $, ClientSideValidations, validateElement, validateForm, validatorsFor,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

$ = jQuery;
Expand Down Expand Up @@ -50,8 +50,6 @@
}
};

initializeOnEvent = (window.Turbolinks != null) && window.Turbolinks.supported ? window.Turbolinks.EVENTS != null ? 'page:change' : 'turbolinks:load' : 'ready';

validatorsFor = function(name, validators) {
var captures, validator, validator_name;
if (validators.hasOwnProperty(name)) {
Expand Down Expand Up @@ -570,10 +568,6 @@
}
};

$(document).on(initializeOnEvent, function() {
return $(ClientSideValidations.selectors.forms).validate();
});

window.ClientSideValidations = ClientSideValidations;

}).call(this);

0 comments on commit e9d6e21

Please sign in to comment.