diff --git a/NzbDrone.Web/Scripts/jquery.validate.unobtrusive.js b/NzbDrone.Web/Scripts/jquery.validate.unobtrusive.js
index b3450ed95..35880e832 100644
--- a/NzbDrone.Web/Scripts/jquery.validate.unobtrusive.js
+++ b/NzbDrone.Web/Scripts/jquery.validate.unobtrusive.js
@@ -1,7 +1,4 @@
-///
-///
-
-/*!
+/*!
** Unobtrusive validation support library for jQuery and jQuery Validate
** Copyright (C) Microsoft Corporation. All rights reserved.
*/
@@ -57,7 +54,7 @@
}
}
- function onErrors(form, validator) { // 'this' is the form element
+ function onErrors(event, validator) { // 'this' is the form element
var container = $(this).find("[data-valmsg-summary=true]"),
list = container.find("ul");
@@ -85,9 +82,24 @@
}
}
+ function onReset(event) { // 'this' is the form element
+ var $form = $(this);
+ $form.data("validator").resetForm();
+ $form.find(".validation-summary-errors")
+ .addClass("validation-summary-valid")
+ .removeClass("validation-summary-errors");
+ $form.find(".field-validation-error")
+ .addClass("field-validation-valid")
+ .removeClass("field-validation-error")
+ .removeData("unobtrusiveContainer")
+ .find(">*") // If we were using valmsg-replace, get the underlying error
+ .removeData("unobtrusiveContainer");
+ }
+
function validationInfo(form) {
var $form = $(form),
- result = $form.data(data_validation);
+ result = $form.data(data_validation),
+ onResetProxy = $.proxy(onReset, form);
if (!result) {
result = {
@@ -101,7 +113,10 @@
success: $.proxy(onSuccess, form)
},
attachValidation: function () {
- $form.validate(this.options);
+ $form
+ .unbind("reset." + data_validation, onResetProxy)
+ .bind("reset." + data_validation, onResetProxy)
+ .validate(this.options);
},
validate: function () { // a validation function that is called by unobtrusive Ajax
$form.validate();
@@ -161,7 +176,7 @@
}
});
- jQuery.extend(rules, { "__dummy__": true });
+ $.extend(rules, { "__dummy__": true });
if (!skipAttach) {
valInfo.attachValidation();
@@ -175,11 +190,17 @@
/// attribute values.
///
/// Any valid jQuery selector.
+ var $forms = $(selector)
+ .parents("form")
+ .andSelf()
+ .add($(selector).find("form"))
+ .filter("form");
+
$(selector).find(":input[data-val=true]").each(function () {
$jQval.unobtrusive.parseElement(this, true);
});
- $("form").each(function () {
+ $forms.each(function () {
var info = validationInfo(this);
if (info) {
info.attachValidation();
@@ -290,7 +311,7 @@
var prefix = getModelPrefix(options.element.name),
other = options.params.other,
fullOtherName = appendModelPrefix(other, prefix),
- element = $(options.form).find(":input[name=" + escapeAttributeValue(fullOtherName) + "]")[0];
+ element = $(options.form).find(":input[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
setValidationValues(options, "equalTo", element);
});
diff --git a/NzbDrone.Web/packages.config b/NzbDrone.Web/packages.config
index 1c21698a3..6e0b1736e 100644
--- a/NzbDrone.Web/packages.config
+++ b/NzbDrone.Web/packages.config
@@ -9,7 +9,7 @@
-
+
diff --git a/packages/jQuery.Validation.Unobtrusive.1.0/jQuery.Validation.Unobtrusive.1.0.nupkg b/packages/jQuery.Validation.Unobtrusive.1.0/jQuery.Validation.Unobtrusive.1.0.nupkg
deleted file mode 100644
index 0d354859b..000000000
Binary files a/packages/jQuery.Validation.Unobtrusive.1.0/jQuery.Validation.Unobtrusive.1.0.nupkg and /dev/null differ
diff --git a/packages/jQuery.Validation.Unobtrusive.1.0/Content/Scripts/jquery.validate.unobtrusive.js b/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/Content/Scripts/jquery.validate.unobtrusive.js
similarity index 90%
rename from packages/jQuery.Validation.Unobtrusive.1.0/Content/Scripts/jquery.validate.unobtrusive.js
rename to packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/Content/Scripts/jquery.validate.unobtrusive.js
index b3450ed95..35880e832 100644
--- a/packages/jQuery.Validation.Unobtrusive.1.0/Content/Scripts/jquery.validate.unobtrusive.js
+++ b/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/Content/Scripts/jquery.validate.unobtrusive.js
@@ -1,7 +1,4 @@
-///
-///
-
-/*!
+/*!
** Unobtrusive validation support library for jQuery and jQuery Validate
** Copyright (C) Microsoft Corporation. All rights reserved.
*/
@@ -57,7 +54,7 @@
}
}
- function onErrors(form, validator) { // 'this' is the form element
+ function onErrors(event, validator) { // 'this' is the form element
var container = $(this).find("[data-valmsg-summary=true]"),
list = container.find("ul");
@@ -85,9 +82,24 @@
}
}
+ function onReset(event) { // 'this' is the form element
+ var $form = $(this);
+ $form.data("validator").resetForm();
+ $form.find(".validation-summary-errors")
+ .addClass("validation-summary-valid")
+ .removeClass("validation-summary-errors");
+ $form.find(".field-validation-error")
+ .addClass("field-validation-valid")
+ .removeClass("field-validation-error")
+ .removeData("unobtrusiveContainer")
+ .find(">*") // If we were using valmsg-replace, get the underlying error
+ .removeData("unobtrusiveContainer");
+ }
+
function validationInfo(form) {
var $form = $(form),
- result = $form.data(data_validation);
+ result = $form.data(data_validation),
+ onResetProxy = $.proxy(onReset, form);
if (!result) {
result = {
@@ -101,7 +113,10 @@
success: $.proxy(onSuccess, form)
},
attachValidation: function () {
- $form.validate(this.options);
+ $form
+ .unbind("reset." + data_validation, onResetProxy)
+ .bind("reset." + data_validation, onResetProxy)
+ .validate(this.options);
},
validate: function () { // a validation function that is called by unobtrusive Ajax
$form.validate();
@@ -161,7 +176,7 @@
}
});
- jQuery.extend(rules, { "__dummy__": true });
+ $.extend(rules, { "__dummy__": true });
if (!skipAttach) {
valInfo.attachValidation();
@@ -175,11 +190,17 @@
/// attribute values.
///
/// Any valid jQuery selector.
+ var $forms = $(selector)
+ .parents("form")
+ .andSelf()
+ .add($(selector).find("form"))
+ .filter("form");
+
$(selector).find(":input[data-val=true]").each(function () {
$jQval.unobtrusive.parseElement(this, true);
});
- $("form").each(function () {
+ $forms.each(function () {
var info = validationInfo(this);
if (info) {
info.attachValidation();
@@ -290,7 +311,7 @@
var prefix = getModelPrefix(options.element.name),
other = options.params.other,
fullOtherName = appendModelPrefix(other, prefix),
- element = $(options.form).find(":input[name=" + escapeAttributeValue(fullOtherName) + "]")[0];
+ element = $(options.form).find(":input[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
setValidationValues(options, "equalTo", element);
});
diff --git a/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/Content/Scripts/jquery.validate.unobtrusive.min.js b/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/Content/Scripts/jquery.validate.unobtrusive.min.js
new file mode 100644
index 000000000..721e31b0e
--- /dev/null
+++ b/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/Content/Scripts/jquery.validate.unobtrusive.min.js
@@ -0,0 +1,5 @@
+/*
+** Unobtrusive validation support library for jQuery and jQuery Validate
+** Copyright (C) Microsoft Corporation. All rights reserved.
+*/
+(function(a){var d=a.validator,b,e="unobtrusiveValidation";function c(a,b,c){a.rules[b]=c;if(a.message)a.messages[b]=a.message}function j(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function f(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function h(a){return a.substr(0,a.lastIndexOf(".")+1)}function g(a,b){if(a.indexOf("*.")===0)a=a.replace("*.",b);return a}function m(c,d){var b=a(this).find("[data-valmsg-for='"+f(d[0].name)+"']"),e=a.parseJSON(b.attr("data-valmsg-replace"))!==false;b.removeClass("field-validation-valid").addClass("field-validation-error");c.data("unobtrusiveContainer",b);if(e){b.empty();c.removeClass("input-validation-error").appendTo(b)}else c.hide()}function l(e,d){var c=a(this).find("[data-valmsg-summary=true]"),b=c.find("ul");if(b&&b.length&&d.errorList.length){b.empty();c.addClass("validation-summary-errors").removeClass("validation-summary-valid");a.each(d.errorList,function(){a("
").html(this.message).appendTo(b)})}}function k(c){var b=c.data("unobtrusiveContainer"),d=a.parseJSON(b.attr("data-valmsg-replace"));if(b){b.addClass("field-validation-valid").removeClass("field-validation-error");c.removeData("unobtrusiveContainer");d&&b.empty()}}function n(){var b=a(this);b.data("validator").resetForm();b.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors");b.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}function i(c){var b=a(c),d=b.data(e),f=a.proxy(n,c);if(!d){d={options:{errorClass:"input-validation-error",errorElement:"span",errorPlacement:a.proxy(m,c),invalidHandler:a.proxy(l,c),messages:{},rules:{},success:a.proxy(k,c)},attachValidation:function(){b.unbind("reset."+e,f).bind("reset."+e,f).validate(this.options)},validate:function(){b.validate();return b.valid()}};b.data(e,d)}return d}d.unobtrusive={adapters:[],parseElement:function(b,h){var d=a(b),f=d.parents("form")[0],c,e,g;if(!f)return;c=i(f);c.options.rules[b.name]=e={};c.options.messages[b.name]=g={};a.each(this.adapters,function(){var c="data-val-"+this.name,i=d.attr(c),h={};if(i!==undefined){c+="-";a.each(this.params,function(){h[this]=d.attr(c+this)});this.adapt({element:b,form:f,message:i,params:h,rules:e,messages:g})}});a.extend(e,{__dummy__:true});!h&&c.attachValidation()},parse:function(b){var c=a(b).parents("form").andSelf().add(a(b).find("form")).filter("form");a(b).find(":input[data-val=true]").each(function(){d.unobtrusive.parseElement(this,true)});c.each(function(){var a=i(this);a&&a.attachValidation()})}};b=d.unobtrusive.adapters;b.add=function(c,a,b){if(!b){b=a;a=[]}this.push({name:c,params:a,adapt:b});return this};b.addBool=function(a,b){return this.add(a,function(d){c(d,b||a,true)})};b.addMinMax=function(e,g,f,a,d,b){return this.add(e,[d||"min",b||"max"],function(b){var e=b.params.min,d=b.params.max;if(e&&d)c(b,a,[e,d]);else if(e)c(b,g,e);else d&&c(b,f,d)})};b.addSingleVal=function(a,b,d){return this.add(a,[b||"val"],function(e){c(e,d||a,e.params[b])})};d.addMethod("__dummy__",function(){return true});d.addMethod("regex",function(b,c,d){var a;if(this.optional(c))return true;a=(new RegExp(d)).exec(b);return a&&a.index===0&&a[0].length===b.length});b.addSingleVal("accept","exts").addSingleVal("regex","pattern");b.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");b.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range");b.add("equalto",["other"],function(b){var i=h(b.element.name),j=b.params.other,d=g(j,i),e=a(b.form).find(":input[name='"+f(d)+"']")[0];c(b,"equalTo",e)});b.add("required",function(a){(a.element.tagName.toUpperCase()!=="INPUT"||a.element.type.toUpperCase()!=="CHECKBOX")&&c(a,"required",true)});b.add("remote",["url","type","additionalfields"],function(b){var d={url:b.params.url,type:b.params.type||"GET",data:{}},e=h(b.element.name);a.each(j(b.params.additionalfields||b.element.name),function(i,h){var c=g(h,e);d.data[c]=function(){return a(b.form).find(":input[name='"+f(c)+"']").val()}});c(b,"remote",d)});a(function(){d.unobtrusive.parse(document)})})(jQuery);
\ No newline at end of file
diff --git a/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/jQuery.Validation.Unobtrusive.2.0.20126.16343.nupkg b/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/jQuery.Validation.Unobtrusive.2.0.20126.16343.nupkg
new file mode 100644
index 000000000..33f7c9852
Binary files /dev/null and b/packages/jQuery.Validation.Unobtrusive.2.0.20126.16343/jQuery.Validation.Unobtrusive.2.0.20126.16343.nupkg differ