spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af in validation_sync-0.0.5 vs spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af in validation_sync-0.0.6
- old
+ new
@@ -1,8 +1,8 @@
{I"
class:ETI"BundledAsset; FI"logical_path; TI"application.js; TI"
pathname; TI"0$root/app/assets/javascripts/application.js; FI"content_type; TI"application/javascript; TI"
-mtime; Tl+"×ûRI"length; TiæI"digest; TI"%37bf9d66752e1216eb40bd5f6d0a43fe; FI"source; TI"æ/*!
+mtime; Tl+Ç?qSI"length; TiÎèI"digest; TI"%13d753c9a685bce318edcff6fb6d77a4; FI"source; TI"Îè/*!
* jQuery JavaScript Library v1.11.0
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
@@ -10336,709 +10336,534 @@
return jQuery;
}));
-/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation
-* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */
-(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
+(function() {
+ var CSRFToken, allowLinkExtensions, anchoredLink, browserCompatibleDocumentParser, browserIsntBuggy, browserSupportsCustomEvents, browserSupportsPushState, browserSupportsTurbolinks, bypassOnLoadPopstate, cacheCurrentPage, cacheSize, changePage, constrainPageCacheTo, createDocument, crossOriginLink, currentState, enableTransitionCache, executeScriptTags, extractLink, extractTitleAndBody, fetch, fetchHistory, fetchReplacement, handleClick, historyStateIsDefined, htmlExtensions, ignoreClick, initializeTurbolinks, installClickHandlerLast, installDocumentReadyPageEventTriggers, installHistoryChangeHandler, installJqueryAjaxSuccessPageUpdateTrigger, loadedAssets, noTurbolink, nonHtmlLink, nonStandardClick, pageCache, pageChangePrevented, pagesCached, popCookie, processResponse, recallScrollPosition, referer, reflectNewUrl, reflectRedirectedUrl, rememberCurrentState, rememberCurrentUrl, rememberReferer, removeHash, removeHashForIE10compatiblity, removeNoscriptTags, requestMethodIsSafe, resetScrollPosition, targetLink, transitionCacheEnabled, transitionCacheFor, triggerEvent, visit, xhr, _ref,
+ __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; },
+ __slice = [].slice;
+ pageCache = {};
+ cacheSize = 10;
-var ValidationSync;
+ transitionCacheEnabled = false;
-ValidationSync = {
+ currentState = null;
- init: function() {
-
+ loadedAssets = null;
- // validate only if a relevant form is present
- if ( $(".new_post[data-sync-validations='true'], .edit_post[data-sync-validations='true']").length ){
- ValidationSync.validatePost();
- }
+ htmlExtensions = ['html'];
-
+ referer = null;
- // validate only if a relevant form is present
- if ( $(".new_user[data-sync-validations='true'], .edit_user[data-sync-validations='true']").length ){
- ValidationSync.validateUser();
- }
+ createDocument = null;
-
- },
+ xhr = null;
+ fetch = function(url) {
+ var cachedPage;
+ rememberReferer();
+ cacheCurrentPage();
+ reflectNewUrl(url);
+ if (transitionCacheEnabled && (cachedPage = transitionCacheFor(url))) {
+ fetchHistory(cachedPage);
+ return fetchReplacement(url);
+ } else {
+ return fetchReplacement(url, resetScrollPosition);
+ }
+ };
- // build a validateModel() method for each ActiveRecord model
-
+ transitionCacheFor = function(url) {
+ var cachedPage;
+ cachedPage = pageCache[url];
+ if (cachedPage && !cachedPage.transitionCacheDisabled) {
+ return cachedPage;
+ }
+ };
- validatePost: function() {
- $forms = $(".new_post[data-sync-validations='true'], .edit_post[data-sync-validations='true']");
- $forms.validate({
+ enableTransitionCache = function(enable) {
+ if (enable == null) {
+ enable = true;
+ }
+ return transitionCacheEnabled = enable;
+ };
+ fetchReplacement = function(url, onLoadFunction) {
+ if (onLoadFunction == null) {
+ onLoadFunction = (function(_this) {
+ return function() {};
+ })(this);
+ }
+ triggerEvent('page:fetch', {
+ url: url
+ });
+ if (xhr != null) {
+ xhr.abort();
+ }
+ xhr = new XMLHttpRequest;
+ xhr.open('GET', removeHashForIE10compatiblity(url), true);
+ xhr.setRequestHeader('Accept', 'text/html, application/xhtml+xml, application/xml');
+ xhr.setRequestHeader('X-XHR-Referer', referer);
+ xhr.onload = function() {
+ var doc;
+ triggerEvent('page:receive');
+ if (doc = processResponse()) {
+ changePage.apply(null, extractTitleAndBody(doc));
+ reflectRedirectedUrl();
+ onLoadFunction();
+ return triggerEvent('page:load');
+ } else {
+ return document.location.href = url;
+ }
+ };
+ xhr.onloadend = function() {
+ return xhr = null;
+ };
+ xhr.onerror = function() {
+ return document.location.href = url;
+ };
+ return xhr.send();
+ };
- rules: {
-
+ fetchHistory = function(cachedPage) {
+ if (xhr != null) {
+ xhr.abort();
+ }
+ changePage(cachedPage.title, cachedPage.body);
+ recallScrollPosition(cachedPage);
+ return triggerEvent('page:restore');
+ };
- "post[id]": {
+ cacheCurrentPage = function() {
+ pageCache[currentState.url] = {
+ url: document.location.href,
+ body: document.body,
+ title: document.title,
+ positionY: window.pageYOffset,
+ positionX: window.pageXOffset,
+ cachedAt: new Date().getTime(),
+ transitionCacheDisabled: document.querySelector('[data-no-transition-cache]') != null
+ };
+ return constrainPageCacheTo(cacheSize);
+ };
+ pagesCached = function(size) {
+ if (size == null) {
+ size = cacheSize;
+ }
+ if (/^[\d]+$/.test(size)) {
+ return cacheSize = parseInt(size);
+ }
+ };
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
+ constrainPageCacheTo = function(limit) {
+ var cacheTimesRecentFirst, key, pageCacheKeys, _i, _len, _results;
+ pageCacheKeys = Object.keys(pageCache);
+ cacheTimesRecentFirst = pageCacheKeys.map(function(url) {
+ return pageCache[url].cachedAt;
+ }).sort(function(a, b) {
+ return b - a;
+ });
+ _results = [];
+ for (_i = 0, _len = pageCacheKeys.length; _i < _len; _i++) {
+ key = pageCacheKeys[_i];
+ if (!(pageCache[key].cachedAt <= cacheTimesRecentFirst[limit])) {
+ continue;
+ }
+ triggerEvent('page:expire', pageCache[key]);
+ _results.push(delete pageCache[key]);
+ }
+ return _results;
+ };
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
+ changePage = function(title, body, csrfToken, runScripts) {
+ document.title = title;
+ document.documentElement.replaceChild(body, document.body);
+ if (csrfToken != null) {
+ CSRFToken.update(csrfToken);
+ }
+ if (runScripts) {
+ executeScriptTags();
+ }
+ currentState = window.history.state;
+ triggerEvent('page:change');
+ return triggerEvent('page:update');
+ };
+ executeScriptTags = function() {
+ var attr, copy, nextSibling, parentNode, script, scripts, _i, _j, _len, _len1, _ref, _ref1;
+ scripts = Array.prototype.slice.call(document.body.querySelectorAll('script:not([data-turbolinks-eval="false"])'));
+ for (_i = 0, _len = scripts.length; _i < _len; _i++) {
+ script = scripts[_i];
+ if (!((_ref = script.type) === '' || _ref === 'text/javascript')) {
+ continue;
+ }
+ copy = document.createElement('script');
+ _ref1 = script.attributes;
+ for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+ attr = _ref1[_j];
+ copy.setAttribute(attr.name, attr.value);
+ }
+ copy.appendChild(document.createTextNode(script.innerHTML));
+ parentNode = script.parentNode, nextSibling = script.nextSibling;
+ parentNode.removeChild(script);
+ parentNode.insertBefore(copy, nextSibling);
+ }
+ };
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
+ removeNoscriptTags = function(node) {
+ node.innerHTML = node.innerHTML.replace(/<noscript[\S\s]*?<\/noscript>/ig, '');
+ return node;
+ };
+ reflectNewUrl = function(url) {
+ if (url !== referer) {
+ return window.history.pushState({
+ turbolinks: true,
+ url: url
+ }, '', url);
+ }
+ };
- },
-
+ reflectRedirectedUrl = function() {
+ var location, preservedHash;
+ if (location = xhr.getResponseHeader('X-XHR-Redirected-To')) {
+ preservedHash = removeHash(location) === location ? document.location.hash : '';
+ return window.history.replaceState(currentState, '', location + preservedHash);
+ }
+ };
- "post[title]": {
+ rememberReferer = function() {
+ return referer = document.location.href;
+ };
+ rememberCurrentUrl = function() {
+ return window.history.replaceState({
+ turbolinks: true,
+ url: document.location.href
+ }, '', document.location.href);
+ };
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- required: true,
+ rememberCurrentState = function() {
+ return currentState = window.history.state;
+ };
- // REQUIRED: if we use the number_validator, :allow_nil => false
- // ----------------------------------------------------------------
-
+ recallScrollPosition = function(page) {
+ return window.scrollTo(page.positionX, page.positionY);
+ };
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
+ resetScrollPosition = function() {
+ if (document.location.hash) {
+ return document.location.href = document.location.href;
+ } else {
+ return window.scrollTo(0, 0);
+ }
+ };
+ removeHashForIE10compatiblity = function(url) {
+ return removeHash(url);
+ };
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
+ removeHash = function(url) {
+ var link;
+ link = url;
+ if (url.href == null) {
+ link = document.createElement('A');
+ link.href = url;
+ }
+ return link.href.replace(link.hash, '');
+ };
+ popCookie = function(name) {
+ var value, _ref;
+ value = ((_ref = document.cookie.match(new RegExp(name + "=(\\w+)"))) != null ? _ref[1].toUpperCase() : void 0) || '';
+ document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/';
+ return value;
+ };
- },
-
+ triggerEvent = function(name, data) {
+ var event;
+ event = document.createEvent('Events');
+ if (data) {
+ event.data = data;
+ }
+ event.initEvent(name, true, true);
+ return document.dispatchEvent(event);
+ };
- "post[content]": {
+ pageChangePrevented = function() {
+ return !triggerEvent('page:before-change');
+ };
+ processResponse = function() {
+ var assetsChanged, clientOrServerError, doc, extractTrackAssets, intersection, validContent;
+ clientOrServerError = function() {
+ var _ref;
+ return (400 <= (_ref = xhr.status) && _ref < 600);
+ };
+ validContent = function() {
+ return xhr.getResponseHeader('Content-Type').match(/^(?:text\/html|application\/xhtml\+xml|application\/xml)(?:;|$)/);
+ };
+ extractTrackAssets = function(doc) {
+ var node, _i, _len, _ref, _results;
+ _ref = doc.head.childNodes;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ node = _ref[_i];
+ if ((typeof node.getAttribute === "function" ? node.getAttribute('data-turbolinks-track') : void 0) != null) {
+ _results.push(node.getAttribute('src') || node.getAttribute('href'));
+ }
+ }
+ return _results;
+ };
+ assetsChanged = function(doc) {
+ var fetchedAssets;
+ loadedAssets || (loadedAssets = extractTrackAssets(document));
+ fetchedAssets = extractTrackAssets(doc);
+ return fetchedAssets.length !== loadedAssets.length || intersection(fetchedAssets, loadedAssets).length !== loadedAssets.length;
+ };
+ intersection = function(a, b) {
+ var value, _i, _len, _ref, _results;
+ if (a.length > b.length) {
+ _ref = [b, a], a = _ref[0], b = _ref[1];
+ }
+ _results = [];
+ for (_i = 0, _len = a.length; _i < _len; _i++) {
+ value = a[_i];
+ if (__indexOf.call(b, value) >= 0) {
+ _results.push(value);
+ }
+ }
+ return _results;
+ };
+ if (!clientOrServerError() && validContent()) {
+ doc = createDocument(xhr.responseText);
+ if (doc && !assetsChanged(doc)) {
+ return doc;
+ }
+ }
+ };
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- required: true,
+ extractTitleAndBody = function(doc) {
+ var title;
+ title = doc.querySelector('title');
+ return [title != null ? title.textContent : void 0, removeNoscriptTags(doc.body), CSRFToken.get(doc).token, 'runScripts'];
+ };
- // REQUIRED: if we use the number_validator, :allow_nil => false
- // ----------------------------------------------------------------
-
+ CSRFToken = {
+ get: function(doc) {
+ var tag;
+ if (doc == null) {
+ doc = document;
+ }
+ return {
+ node: tag = doc.querySelector('meta[name="csrf-token"]'),
+ token: tag != null ? typeof tag.getAttribute === "function" ? tag.getAttribute('content') : void 0 : void 0
+ };
+ },
+ update: function(latest) {
+ var current;
+ current = this.get();
+ if ((current.token != null) && (latest != null) && current.token !== latest) {
+ return current.node.setAttribute('content', latest);
+ }
+ }
+ };
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
+ browserCompatibleDocumentParser = function() {
+ var createDocumentUsingDOM, createDocumentUsingParser, createDocumentUsingWrite, e, testDoc, _ref;
+ createDocumentUsingParser = function(html) {
+ return (new DOMParser).parseFromString(html, 'text/html');
+ };
+ createDocumentUsingDOM = function(html) {
+ var doc;
+ doc = document.implementation.createHTMLDocument('');
+ doc.documentElement.innerHTML = html;
+ return doc;
+ };
+ createDocumentUsingWrite = function(html) {
+ var doc;
+ doc = document.implementation.createHTMLDocument('');
+ doc.open('replace');
+ doc.write(html);
+ doc.close();
+ return doc;
+ };
+ try {
+ if (window.DOMParser) {
+ testDoc = createDocumentUsingParser('<html><body><p>test');
+ return createDocumentUsingParser;
+ }
+ } catch (_error) {
+ e = _error;
+ testDoc = createDocumentUsingDOM('<html><body><p>test');
+ return createDocumentUsingDOM;
+ } finally {
+ if ((testDoc != null ? (_ref = testDoc.body) != null ? _ref.childNodes.length : void 0 : void 0) !== 1) {
+ return createDocumentUsingWrite;
+ }
+ }
+ };
+ installClickHandlerLast = function(event) {
+ if (!event.defaultPrevented) {
+ document.removeEventListener('click', handleClick, false);
+ return document.addEventListener('click', handleClick, false);
+ }
+ };
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
+ handleClick = function(event) {
+ var link;
+ if (!event.defaultPrevented) {
+ link = extractLink(event);
+ if (link.nodeName === 'A' && !ignoreClick(event, link)) {
+ if (!pageChangePrevented()) {
+ visit(link.href);
+ }
+ return event.preventDefault();
+ }
+ }
+ };
+ extractLink = function(event) {
+ var link;
+ link = event.target;
+ while (!(!link.parentNode || link.nodeName === 'A')) {
+ link = link.parentNode;
+ }
+ return link;
+ };
- },
-
+ crossOriginLink = function(link) {
+ return location.protocol !== link.protocol || location.host !== link.host;
+ };
- "post[view_count]": {
+ anchoredLink = function(link) {
+ return ((link.hash && removeHash(link)) === removeHash(location)) || (link.href === location.href + '#');
+ };
+ nonHtmlLink = function(link) {
+ var url;
+ url = removeHash(link);
+ return url.match(/\.[a-z]+(\?.*)?$/g) && !url.match(new RegExp("\\.(?:" + (htmlExtensions.join('|')) + ")?(\\?.*)?$", 'g'));
+ };
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- required: true,
+ noTurbolink = function(link) {
+ var ignore;
+ while (!(ignore || link === document)) {
+ ignore = link.getAttribute('data-no-turbolink') != null;
+ link = link.parentNode;
+ }
+ return ignore;
+ };
- // REQUIRED: if we use the number_validator, :allow_nil => false
- // ----------------------------------------------------------------
-
+ targetLink = function(link) {
+ return link.target.length !== 0;
+ };
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
- number: true,
-
+ nonStandardClick = function(event) {
+ return event.which > 1 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
+ };
+ ignoreClick = function(event, link) {
+ return crossOriginLink(link) || anchoredLink(link) || nonHtmlLink(link) || noTurbolink(link) || targetLink(link) || nonStandardClick(event);
+ };
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
+ allowLinkExtensions = function() {
+ var extension, extensions, _i, _len;
+ extensions = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ for (_i = 0, _len = extensions.length; _i < _len; _i++) {
+ extension = extensions[_i];
+ htmlExtensions.push(extension);
+ }
+ return htmlExtensions;
+ };
+ bypassOnLoadPopstate = function(fn) {
+ return setTimeout(fn, 500);
+ };
- },
-
+ installDocumentReadyPageEventTriggers = function() {
+ return document.addEventListener('DOMContentLoaded', (function() {
+ triggerEvent('page:change');
+ return triggerEvent('page:update');
+ }), true);
+ };
- "post[author_email]": {
+ installJqueryAjaxSuccessPageUpdateTrigger = function() {
+ if (typeof jQuery !== 'undefined') {
+ return jQuery(document).on('ajaxSuccess', function(event, xhr, settings) {
+ if (!jQuery.trim(xhr.responseText)) {
+ return;
+ }
+ return triggerEvent('page:update');
+ });
+ }
+ };
+ installHistoryChangeHandler = function(event) {
+ var cachedPage, _ref;
+ if ((_ref = event.state) != null ? _ref.turbolinks : void 0) {
+ if (cachedPage = pageCache[event.state.url]) {
+ cacheCurrentPage();
+ return fetchHistory(cachedPage);
+ } else {
+ return visit(event.target.location.href);
+ }
+ }
+ };
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
+ initializeTurbolinks = function() {
+ rememberCurrentUrl();
+ rememberCurrentState();
+ createDocument = browserCompatibleDocumentParser();
+ document.addEventListener('click', installClickHandlerLast, true);
+ return bypassOnLoadPopstate(function() {
+ return window.addEventListener('popstate', installHistoryChangeHandler, false);
+ });
+ };
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
+ historyStateIsDefined = window.history.state !== void 0 || navigator.userAgent.match(/Firefox\/2[6|7]/);
+ browserSupportsPushState = window.history && window.history.pushState && window.history.replaceState && historyStateIsDefined;
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
+ browserIsntBuggy = !navigator.userAgent.match(/CriOS\//);
+ requestMethodIsSafe = (_ref = popCookie('request_method')) === 'GET' || _ref === '';
- },
-
+ browserSupportsTurbolinks = browserSupportsPushState && browserIsntBuggy && requestMethodIsSafe;
- "post[created_at]": {
+ browserSupportsCustomEvents = document.addEventListener && document.createEvent;
+ if (browserSupportsCustomEvents) {
+ installDocumentReadyPageEventTriggers();
+ installJqueryAjaxSuccessPageUpdateTrigger();
+ }
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
+ if (browserSupportsTurbolinks) {
+ visit = fetch;
+ initializeTurbolinks();
+ } else {
+ visit = function(url) {
+ return document.location.href = url;
+ };
+ }
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
+ this.Turbolinks = {
+ visit: visit,
+ pagesCached: pagesCached,
+ enableTransitionCache: enableTransitionCache,
+ allowLinkExtensions: allowLinkExtensions,
+ supported: browserSupportsTurbolinks
+ };
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[updated_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[order]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- // with allow_nil = false
-
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
- number: true,
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[user_id]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- // with allow_nil = false
-
- required: true,
-
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
- number: true,
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
- },
-
-
- messages: {
-
-
- "post[id]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[title]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- required: "You need a title, bro.",
-
- // REQUIRED: if we use the number_validator, :allow_nil => false
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[content]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- required: "can't be blank",
-
- // REQUIRED: if we use the number_validator, :allow_nil => false
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[view_count]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- required: "can't be blank",
-
- // REQUIRED: if we use the number_validator, :allow_nil => false
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
- number: "is not a number",
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[author_email]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[created_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[updated_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[order]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- // with allow_nil = false
-
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
- number: "Make that shit a number!",
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "post[user_id]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
- // with allow_nil = false
-
- required: "User ID Must be a number.",
-
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
- number: "User ID Must be a number.",
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
- },
-
-
- }); // $forms.validate()
- }, // validateModel
-
-
-
- validateUser: function() {
- $forms = $(".new_user[data-sync-validations='true'], .edit_user[data-sync-validations='true']");
- $forms.validate({
-
-
- rules: {
-
-
- "user[id]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "user[email]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
- equalTo: "#user_email_confirmation",
-
-
-
- },
-
-
- "user[password]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
- equalTo: "#user_password_confirmation",
-
-
-
- },
-
-
- "user[created_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "user[updated_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
- },
-
-
- messages: {
-
-
- "user[id]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "user[email]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
- equalTo: "",
-
-
-
- },
-
-
- "user[password]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
- equalTo: "Confirm your password, bitch!",
-
-
-
- },
-
-
- "user[created_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
-
-
- "user[updated_at]": {
-
-
- // REQUIRED: if we use the presence_validator
- // ----------------------------------------------------------------
-
-
- // NUMBER: if we use the number_validator
- // ----------------------------------------------------------------
-
-
-
- // EQUALTO: if we use the confirmation_validator
- // ----------------------------------------------------------------
-
-
-
- },
- },
-
-
- }); // $forms.validate()
- }, // validateModel
-
- }
-
-
-
-
-// Fire init() on ready (or page:load for turbolinks)
-$(document).on('ready page:load', ValidationSync.init);
+}).call(this);
+/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation
+* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */
+(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
@@ -11048,11 +10873,10 @@
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
-
;
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
@@ -11065,7 +10889,8 @@
// about supported directives.
//
+
;
-; TI"required_assets_digest; TI"%27d8330c9f3380e61f63728d92538fab; FI"
_version; TI"%01dc9d4cb5b0ece13ed47cc1cabfeb41; F
+; TI"required_assets_digest; TI"%588c135d40c628cb8eca9569ff8f35d4; FI"
_version; TI"%a56df69ef97ba4d9f1a23bf9b0add58a; F
\ No newline at end of file