Skip to content

Commit

Permalink
Client validation updated to support Bootstrap styling. #27
Browse files Browse the repository at this point in the history
  • Loading branch information
gius committed Jun 8, 2015
1 parent b22d5c5 commit 5e4f1ee
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 2 deletions.
Binary file modified src/Server/DeploymentFramework/Web/Scripts/_references.js
Binary file not shown.
212 changes: 211 additions & 1 deletion src/Server/DeploymentFramework/Web/Scripts/jquery-bundle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// from http://danielwertheim.se/2014/08/29/asp-net-mvc-5-quick-tip-for-unobtrusive-validation-and-bootstrap-styling/comment-page-1/
(function ($) {
var defaultOptions = {
errorClass: 'has-error',
validClass: 'has-success',
highlight: function (element, errorClass, validClass) {
$(element).closest(".form-group")
.addClass(errorClass)
.removeClass(validClass);
},
unhighlight: function (element, errorClass, validClass) {
$(element).closest(".form-group")
.removeClass(errorClass)
.addClass(validClass);
}
};

$.validator.setDefaults(defaultOptions);

$.validator.unobtrusive.options = {
errorClass: defaultOptions.errorClass,
validClass: defaultOptions.validClass,
};
})(jQuery);
1 change: 1 addition & 0 deletions src/Server/DeploymentFramework/Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
<Content Include="package.json" />
<Content Include="Scripts\bootstrap-bundle.min.js" />
<Content Include="Scripts\jquery-bundle.min.js" />
<Content Include="Scripts\jquery.validate.unobtrusive.bootstrap.js" />
<Content Include="Scripts\jquery.validate.unobtrusive.chameleon.js" />
<Content Include="Scripts\modernizer-min.js" />
<Content Include="Scripts\_references.js" />
Expand Down
4 changes: 3 additions & 1 deletion src/Server/DeploymentFramework/Web/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ var config = {
jquerysrc: [
'bower_components/jquery/dist/jquery.min.js',
'bower_components/jquery-validation/dist/jquery.validate.min.js',
'bower_components/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js'
'bower_components/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js',
'Scripts/jquery.validate.unobtrusive.chameleon.js',
'Scripts/jquery.validate.unobtrusive.bootstrap.js'
],
jquerybundle: 'Scripts/jquery-bundle.min.js',

Expand Down

0 comments on commit 5e4f1ee

Please sign in to comment.