diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.sln b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.sln index 51e6cca4..cfad7374 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.sln +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.sln @@ -1,21 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Mvc4QuickStart", "Spring.Mvc4QuickStart\Spring.Mvc4QuickStart.csproj", "{A283911F-826C-4722-BD37-D1B3D9350932}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Mvc4QuickStart", "Spring.Mvc4QuickStart\Spring.Mvc4QuickStart.csproj", "{823803A7-8043-48EF-B38D-9F32B063F977}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - CodeCoverage|Any CPU = CodeCoverage|Any CPU Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A283911F-826C-4722-BD37-D1B3D9350932}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU - {A283911F-826C-4722-BD37-D1B3D9350932}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU - {A283911F-826C-4722-BD37-D1B3D9350932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A283911F-826C-4722-BD37-D1B3D9350932}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A283911F-826C-4722-BD37-D1B3D9350932}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A283911F-826C-4722-BD37-D1B3D9350932}.Release|Any CPU.Build.0 = Release|Any CPU + {823803A7-8043-48EF-B38D-9F32B063F977}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {823803A7-8043-48EF-B38D-9F32B063F977}.Debug|Any CPU.Build.0 = Debug|Any CPU + {823803A7-8043-48EF-B38D-9F32B063F977}.Release|Any CPU.ActiveCfg = Release|Any CPU + {823803A7-8043-48EF-B38D-9F32B063F977}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/BundleConfig.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/BundleConfig.cs deleted file mode 100644 index ac2492d3..00000000 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/BundleConfig.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Web; -using System.Web.Optimization; - -namespace Spring.Mvc4QuickStart -{ - public class BundleConfig - { - public static void RegisterBundles(BundleCollection bundles) - { - bundles.Add(new ScriptBundle("~/bundles/jquery").Include( - "~/Scripts/jquery-1.*")); - - bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( - "~/Scripts/jquery-ui*")); - - bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( - "~/Scripts/jquery.unobtrusive*", - "~/Scripts/jquery.validate*")); - - bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( - "~/Scripts/modernizr-*")); - - bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css")); - - bundles.Add(new StyleBundle("~/Content/themes/base/css").Include( - "~/Content/themes/base/jquery.ui.core.css", - "~/Content/themes/base/jquery.ui.resizable.css", - "~/Content/themes/base/jquery.ui.selectable.css", - "~/Content/themes/base/jquery.ui.accordion.css", - "~/Content/themes/base/jquery.ui.autocomplete.css", - "~/Content/themes/base/jquery.ui.button.css", - "~/Content/themes/base/jquery.ui.dialog.css", - "~/Content/themes/base/jquery.ui.slider.css", - "~/Content/themes/base/jquery.ui.tabs.css", - "~/Content/themes/base/jquery.ui.datepicker.css", - "~/Content/themes/base/jquery.ui.progressbar.css", - "~/Content/themes/base/jquery.ui.theme.css")); - } - } -} \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/FilterConfig.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/FilterConfig.cs deleted file mode 100644 index c1da1ea1..00000000 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/FilterConfig.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Web; -using System.Web.Mvc; - -namespace Spring.Mvc4QuickStart -{ - public class FilterConfig - { - public static void RegisterGlobalFilters(GlobalFilterCollection filters) - { - filters.Add(new HandleErrorAttribute()); - } - } -} \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/RouteConfig.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/RouteConfig.cs deleted file mode 100644 index 7ee3f5f3..00000000 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/App_Start/RouteConfig.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Http; -using System.Web.Mvc; -using System.Web.Routing; - -namespace Spring.Mvc4QuickStart -{ - public class RouteConfig - { - public static void RegisterRoutes(RouteCollection routes) - { - routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); - - routes.MapHttpRoute( - name: "DefaultApi", - routeTemplate: "api/{controller}/{id}", - defaults: new { id = RouteParameter.Optional } - ); - - routes.MapRoute( - name: "Default", - url: "{controller}/{action}/{id}", - defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } - ); - } - } -} \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Config/controllers.xml b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Config/controllers.xml index 4eb79ea3..bc3cbfbd 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Config/controllers.xml +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Config/controllers.xml @@ -5,7 +5,7 @@ - + diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Content/Site.css b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Content/Site.css index 28a2b1ba..f865fab7 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Content/Site.css +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Content/Site.css @@ -14,7 +14,8 @@ body { padding: 0; } -a { +a:link, a:visited, +a:active, a:hover { color: #333; outline: none; padding-left: 3px; @@ -22,26 +23,15 @@ a { text-decoration: underline; } - a:link, a:visited, - a:active, a:hover { - color: #333; - } - - a:hover { - background-color: #c7d1d6; - } +a:hover { + background-color: #c7d1d6; +} header, footer, hgroup, nav, section { display: block; } -mark { - background-color: #a6dbed; - padding-left: 5px; - padding-right: 5px; -} - .float-left { float: left; } @@ -50,6 +40,12 @@ mark { float: right; } +.highlight { + background-color: #a6dbed; + padding-left: 5px; + padding-right: 5px; +} + .clear-fix:after { content: "."; clear: both; @@ -252,44 +248,16 @@ ol.round { padding-left: 45px; } - ol.round li.zero { - background: url("../Images/orderedList0.png") no-repeat; - } - ol.round li.one { - background: url("../Images/orderedList1.png") no-repeat; + background: url("../Images/orderedListOne.png") no-repeat; } ol.round li.two { - background: url("../Images/orderedList2.png") no-repeat; + background: url("../Images/orderedListTwo.png") no-repeat; } ol.round li.three { - background: url("../Images/orderedList3.png") no-repeat; - } - - ol.round li.four { - background: url("../Images/orderedList4.png") no-repeat; - } - - ol.round li.five { - background: url("../Images/orderedList5.png") no-repeat; - } - - ol.round li.six { - background: url("../Images/orderedList6.png") no-repeat; - } - - ol.round li.seven { - background: url("../Images/orderedList7.png") no-repeat; - } - - ol.round li.eight { - background: url("../Images/orderedList8.png") no-repeat; - } - - ol.round li.nine { - background: url("../Images/orderedList9.png") no-repeat; + background: url("../Images/orderedListThree.png") no-repeat; } /* content */ @@ -404,41 +372,8 @@ fieldset { } /* ajax login/registration dialog */ -.ui-dialog { - font-family: inherit; - font-size: 1.0em; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - border: 0 none; -} - - .ui-dialog input { - font-family: inherit; - font-size: 1.25em; - } - -.ui-dialog-titlebar { - color: inherit; - font-weight: inherit; - border: 0 none; - background: none; - float: right; -} - -.ui-dialog-titlebar-close { - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} - -.ui-widget-header { - border: 0 none; - background: none; -} - .modal-popup { - + font-size: 0.7em; } .modal-popup input[type="text"], @@ -524,68 +459,6 @@ ul#social li { background: url("../Images/twitter.png") no-repeat; } -/* tables -----------------------------------------------------------*/ -table { - border-collapse: collapse; - border-spacing: 0; - margin-top: 0.75em; - border: 0 none; -} - -th { - font-size: 1.2em; - text-align: left; - border: none 0px; - padding-left: 0; -} - - th a { - display: block; - position: relative; - - } - - th a:link, th a:visited, th a:active, th a:hover { - color: #333; - font-weight: 600; - text-decoration: none; - padding: 0; - } - - th a:hover { - color: #000; - } - - th.asc a, th.desc a { - margin-right: .75em; - } - - th.asc a:after, th.desc a:after { - display: block; - position: absolute; - right: 0em; - top: 0; - font-size: 0.75em; - } - - th.asc a:after { - content: '▲'; - } - - th.desc a:after { - content: '▼'; - } - -td { - padding: 0.25em 2em 0.25em 0em; - border: 0 none; -} - -tr.pager td { - padding: 0 0.25em 0 0; -} - /******************** * Mobile Styles * @@ -686,16 +559,9 @@ tr.pager td { margin: 25px 0; } - ol.round li.zero, ol.round li.one, ol.round li.two, - ol.round li.three, - ol.round li.four, - ol.round li.five, - ol.round li.six, - ol.round li.seven, - ol.round li.eight, - ol.round li.nine { + ol.round li.three { background: none; } @@ -763,7 +629,9 @@ tr.pager td { background: none; display: inline; float: none; + height: auto; padding-left: 0; text-indent: 0; + width: auto; } } diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/AccountController.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/AccountController.cs index 739d407c..44f7149a 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/AccountController.cs +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/AccountController.cs @@ -17,10 +17,33 @@ namespace Spring.Mvc4QuickStart.Controllers // GET: /Account/Login [AllowAnonymous] - public ActionResult Login(string returnUrl) + public ActionResult Login() { - ViewBag.ReturnUrl = returnUrl; - return View(); + return ContextDependentView(); + } + + // + // POST: /Account/JsonLogin + + [AllowAnonymous] + [HttpPost] + public JsonResult JsonLogin(LoginModel model, string returnUrl) + { + if (ModelState.IsValid) + { + if (Membership.ValidateUser(model.UserName, model.Password)) + { + FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); + return Json(new { success = true, redirect = returnUrl }); + } + else + { + ModelState.AddModelError("", "The user name or password provided is incorrect."); + } + } + + // If we got this far, something failed + return Json(new { errors = GetErrorsFromModelState() }); } // @@ -70,7 +93,35 @@ namespace Spring.Mvc4QuickStart.Controllers [AllowAnonymous] public ActionResult Register() { - return View(); + return ContextDependentView(); + } + + // + // POST: /Account/JsonRegister + + [AllowAnonymous] + [HttpPost] + public ActionResult JsonRegister(RegisterModel model) + { + if (ModelState.IsValid) + { + // Attempt to register the user + MembershipCreateStatus createStatus; + Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus); + + if (createStatus == MembershipCreateStatus.Success) + { + FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false); + return Json(new { success = true }); + } + else + { + ModelState.AddModelError("", ErrorCodeToString(createStatus)); + } + } + + // If we got this far, something failed + return Json(new { errors = GetErrorsFromModelState() }); } // @@ -153,6 +204,21 @@ namespace Spring.Mvc4QuickStart.Controllers return View(); } + private ActionResult ContextDependentView() + { + string actionName = ControllerContext.RouteData.GetRequiredString("action"); + if (Request.QueryString["content"] != null) + { + ViewBag.FormAction = "Json" + actionName; + return PartialView(); + } + else + { + ViewBag.FormAction = actionName; + return View(); + } + } + private IEnumerable GetErrorsFromModelState() { return ModelState.SelectMany(x => x.Value.Errors.Select(error => error.ErrorMessage)); diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/HomeController.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/HomeController.cs index c7a2714d..704821e8 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/HomeController.cs +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/HomeController.cs @@ -16,17 +16,17 @@ namespace Spring.Mvc4QuickStart.Controllers return View(); } - + public ActionResult About() { - ViewBag.Message = "Your app description page."; + ViewBag.Message = "Your quintessential app description page."; return View(); } public ActionResult Contact() { - ViewBag.Message = "Your contact page."; + ViewBag.Message = "Your quintessential contact page."; return View(); } diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/SuffixController.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/ValuesSuffixController.cs similarity index 93% rename from examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/SuffixController.cs rename to examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/ValuesSuffixController.cs index eb27e16b..f5d89746 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/SuffixController.cs +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Controllers/ValuesSuffixController.cs @@ -3,7 +3,7 @@ using System.Web.Http; namespace Spring.Mvc4QuickStart.Controllers { - public class SuffixController : ApiController + public class ValuesSuffixController : ApiController { public string Suffix { get; set; } diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Global.asax.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Global.asax.cs index 8d26bf38..5c5530c3 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Global.asax.cs +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Global.asax.cs @@ -15,13 +15,36 @@ namespace Spring.Mvc4QuickStart public class MvcApplication : SpringMvcApplication { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new HandleErrorAttribute()); + } + + public static void RegisterRoutes(RouteCollection routes) + { + routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); + + routes.MapHttpRoute( + name: "DefaultApi", + routeTemplate: "api/{controller}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + + routes.MapRoute( + name: "Default", + url: "{controller}/{action}/{id}", + defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } + ); + } + protected void Application_Start() { AreaRegistration.RegisterAllAreas(); - FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); - RouteConfig.RegisterRoutes(RouteTable.Routes); - BundleConfig.RegisterBundles(BundleTable.Bundles); + RegisterGlobalFilters(GlobalFilters.Filters); + RegisterRoutes(RouteTable.Routes); + + BundleTable.Bundles.RegisterTemplateBundles(); } } } \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList0.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList0.png deleted file mode 100644 index 7a4ea253..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList0.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList4.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList4.png deleted file mode 100644 index ce91e8f6..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList4.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList5.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList5.png deleted file mode 100644 index c0734857..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList5.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList6.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList6.png deleted file mode 100644 index 3b9aa05a..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList6.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList7.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList7.png deleted file mode 100644 index f99c609f..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList7.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList8.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList8.png deleted file mode 100644 index 127596d1..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList8.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList9.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList9.png deleted file mode 100644 index 39cfdcf5..00000000 Binary files a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList9.png and /dev/null differ diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList1.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedListOne.png similarity index 100% rename from examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList1.png rename to examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedListOne.png diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList3.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedListThree.png similarity index 100% rename from examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList3.png rename to examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedListThree.png diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList2.png b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedListTwo.png similarity index 100% rename from examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedList2.png rename to examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Images/orderedListTwo.png diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Properties/AssemblyInfo.cs b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Properties/AssemblyInfo.cs index d6b27b08..9b58107e 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Properties/AssemblyInfo.cs +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6b26b8b8-f1e7-4c83-8ffe-354feac65948")] +[assembly: Guid("e74844c7-6c21-42b3-b416-fbbd7c8bd2a0")] // Version information for an assembly consists of the following four values: // diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/AjaxLogin.js b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/AjaxLogin.js new file mode 100644 index 00000000..d1dec5a4 --- /dev/null +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/AjaxLogin.js @@ -0,0 +1,110 @@ +$(function () { + // Cache for dialogs + var dialogs = {}; + + var getValidationSummaryErrors = function ($form) { + // We verify if we created it beforehand + var errorSummary = $form.find('.validation-summary-errors, .validation-summary-valid'); + if (!errorSummary.length) { + errorSummary = $('
Please correct the errors and try again.
    ') + .prependTo($form); + } + + return errorSummary; + }; + + var displayErrors = function (form, errors) { + var errorSummary = getValidationSummaryErrors(form) + .removeClass('validation-summary-valid') + .addClass('validation-summary-errors'); + + var items = $.map(errors, function (error) { + return '
  • ' + error + '
  • '; + }).join(''); + + var ul = errorSummary + .find('ul') + .empty() + .append(items); + }; + + var resetForm = function ($form) { + // We reset the form so we make sure unobtrusive errors get cleared out. + $form[0].reset(); + + getValidationSummaryErrors($form) + .removeClass('validation-summary-errors') + .addClass('validation-summary-valid') + }; + + var formSubmitHandler = function (e) { + var $form = $(this); + + // We check if jQuery.validator exists on the form + if (!$form.valid || $form.valid()) { + $.post($form.attr('action'), $form.serializeArray()) + .done(function (json) { + json = json || {}; + + // In case of success, we redirect to the provided URL or the same page. + if (json.success) { + location = json.redirect || location.href; + } else if (json.errors) { + displayErrors($form, json.errors); + } + }) + .error(function () { + displayErrors($form, ['An unknown error happened.']); + }); + } + + // Prevent the normal behavior since we opened the dialog + e.preventDefault(); + }; + + var loadAndShowDialog = function (id, link, url) { + var separator = url.indexOf('?') >= 0 ? '&' : '?'; + + // Save an empty jQuery in our cache for now. + dialogs[id] = $(); + + // Load the dialog with the content=1 QueryString in order to get a PartialView + $.get(url + separator + 'content=1') + .done(function (content) { + dialogs[id] = $('') + .hide() // Hide the dialog for now so we prevent flicker + .appendTo(document.body) + .filter('div') // Filter for the div tag only, script tags could surface + .dialog({ // Create the jQuery UI dialog + title: link.data('dialog-title'), + modal: true, + resizable: true, + draggable: true, + width: link.data('dialog-width') || 600, + beforeClose: function () { resetForm($(this).find('form')); } + }) + .find('form') // Attach logic on forms + .submit(formSubmitHandler) + .end(); + }); + }; + + // List of link ids to have an ajax dialog + var links = ['#loginLink', '#registerLink']; + + $.each(links, function (i, id) { + $(id).click(function (e) { + var link = $(this), + url = link.attr('href'); + + if (!dialogs[id]) { + loadAndShowDialog(id, link, url); + } else { + dialogs[id].dialog('open'); + } + + // Prevent the normal behavior since we use a dialog + e.preventDefault(); + }); + }); +}); \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/_references.js b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/_references.js index 90747dff..d91a82ab 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/_references.js +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Scripts/_references.js @@ -1,6 +1,5 @@ /// /// /// -/// /// /// \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.csproj b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.csproj index c6b02132..e609a4ce 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.csproj +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart.csproj @@ -1,13 +1,12 @@  - Debug AnyCPU 2.0 - {A283911F-826C-4722-BD37-D1B3D9350932} + {823803A7-8043-48EF-B38D-9F32B063F977} {E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties @@ -35,38 +34,94 @@ 4 + + ..\..\..\..\build\VS.Net.2010\Spring.Web.Mvc4\Debug\Common.Logging.dll + + + ..\packages\EntityFramework.4.1.10331.0\lib\net40\EntityFramework.dll + - - ..\packages\Newtonsoft.Json.4.5.6\lib\net40\Newtonsoft.Json.dll + + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - ..\..\..\..\build\VS.Net.2010\Spring.Core\Debug\Spring.Core.dll + + ..\..\..\..\build\VS.Net.2010\Spring.Web.Mvc4\Debug\Spring.Core.dll - - ..\..\..\..\build\VS.Net.2010\Spring.Web\Debug\Spring.Web.dll + + ..\..\..\..\build\VS.Net.2010\Spring.Web.Mvc4\Debug\Spring.Web.dll - + ..\..\..\..\build\VS.Net.2010\Spring.Web.Mvc4\Debug\Spring.Web.Mvc4.dll - + + True + ..\packages\System.Json.4.0.20126.16343\lib\net40\System.Json.dll + + + True + ..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll + + + True + ..\packages\System.Net.Http.Formatting.4.0.20126.16343\lib\net40\System.Net.Http.Formatting.dll + + + True + ..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.WebRequest.dll + - - - - - - - - + + True + ..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.Helpers.dll + + + True + ..\packages\AspNetWebApi.Core.4.0.20126.16343\lib\net40\System.Web.Http.dll + + + True + ..\packages\System.Web.Http.Common.4.0.20126.16343\lib\net40\System.Web.Http.Common.dll + + + True + ..\packages\AspNetWebApi.4.0.20126.16343\lib\net40\System.Web.Http.WebHost.dll + + + True + ..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll + + + ..\packages\Microsoft.Web.Optimization.1.0.0-beta\lib\net40\System.Web.Optimization.dll + + + ..\packages\System.Web.Providers.Core.1.0\lib\net40\System.Web.Providers.dll + + + True + ..\packages\AspNetRazor.Core.2.0.20126.16343\lib\net40\System.Web.Razor.dll + + + True + ..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.dll + + + True + ..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.Deployment.dll + + + True + ..\packages\AspNetWebPages.Core.2.0.20126.16343\lib\net40\System.Web.WebPages.Razor.dll + @@ -76,44 +131,12 @@ - - ..\packages\EntityFramework.5.0.0-rc\lib\net40\EntityFramework.dll - - - True - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - - True - ..\packages\Microsoft.Net.Http.2.0.20505.0\lib\net40\System.Net.Http.dll - - - True - ..\packages\Microsoft.Net.Http.2.0.20505.0\lib\net40\System.Net.Http.WebRequest.dll - - - ..\packages\Microsoft.AspNet.Web.Optimization.1.0.0-beta2\lib\net40\System.Web.Optimization.dll - - - ..\packages\Microsoft.AspNet.Providers.Core.1.0\lib\net40\System.Web.Providers.dll - - - True - ..\packages\WebGrease.1.0.0\lib\WebGrease.dll - - - True - ..\packages\WebGrease.1.0.0\lib\Antlr3.Runtime.dll - - - - + - Global.asax @@ -121,9 +144,7 @@ - - Always - + @@ -177,6 +198,7 @@ + @@ -184,16 +206,9 @@ - - - - - - - - - - + + + @@ -215,13 +230,14 @@ - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - + + @@ -231,7 +247,7 @@ False True - 41293 + 57953 / @@ -244,10 +260,4 @@ - \ No newline at end of file diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePassword.cshtml b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePassword.cshtml index ac3bd714..5c21da6d 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePassword.cshtml +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePassword.cshtml @@ -1,4 +1,4 @@ -@model Spring.Mvc4QuickStart.Models.ChangePasswordModel +@model Spring.Mvc4QuickStart.Models.ChangePasswordModel @{ ViewBag.Title = "Change Password"; @@ -6,36 +6,38 @@

    @ViewBag.Title.

    -

    Use this form to change your password.

    +

    Use the form below to change your password.

    - Passwords must be at least @Membership.MinRequiredPasswordLength characters long. + New passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length.

    + + + @using (Html.BeginForm()) { - @Html.ValidationSummary() + @Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.")
    Change Password Form
    1. @Html.LabelFor(m => m.OldPassword) - @Html.PasswordFor(m => m.OldPassword) + @Html.PasswordFor(m => m.OldPassword) + @Html.ValidationMessageFor(m => m.OldPassword)
    2. @Html.LabelFor(m => m.NewPassword) - @Html.PasswordFor(m => m.NewPassword) + @Html.PasswordFor(m => m.NewPassword) + @Html.ValidationMessageFor(m => m.NewPassword)
    3. @Html.LabelFor(m => m.ConfirmPassword) - @Html.PasswordFor(m => m.ConfirmPassword) + @Html.PasswordFor(m => m.ConfirmPassword) + @Html.ValidationMessageFor(m => m.ConfirmPassword)
    } - -@section Scripts { - @Scripts.Render("~/bundles/jqueryval") -} diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePasswordSuccess.cshtml b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePasswordSuccess.cshtml index 07a7ccff..32cf73d6 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePasswordSuccess.cshtml +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/ChangePasswordSuccess.cshtml @@ -4,5 +4,5 @@

    @ViewBag.Title.

    -

    Your password has been changed.

    +

    Your password has been changed successfully.

    diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Login.cshtml b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Login.cshtml index 55bad79e..576fb857 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Login.cshtml +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Login.cshtml @@ -1,4 +1,4 @@ -@model Spring.Mvc4QuickStart.Models.LoginModel +@model Spring.Mvc4QuickStart.Models.LoginModel @{ ViewBag.Title = "Log in"; @@ -6,10 +6,13 @@

    @ViewBag.Title.

    -

    Use this form to enter your user name and password.

    +

    Enter your user name and password below.

    -@using (Html.BeginForm(new { ReturnUrl = ViewBag.ReturnUrl })) { + + + +@using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { @Html.ValidationSummary(true, "Log in was unsuccessful. Please correct the errors and try again.")
    @@ -18,10 +21,12 @@
  • @Html.LabelFor(m => m.UserName) @Html.TextBoxFor(m => m.UserName) + @Html.ValidationMessageFor(m => m.UserName)
  • @Html.LabelFor(m => m.Password) @Html.PasswordFor(m => m.Password) + @Html.ValidationMessageFor(m => m.Password)
  • @Html.CheckBoxFor(m => m.RememberMe) @@ -34,7 +39,3 @@ @Html.ActionLink("Register", "Register") if you don't have an account.

    } - -@section Scripts { - @Scripts.Render("~/bundles/jqueryval") -} diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Register.cshtml b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Register.cshtml index d6c334b6..9d4c9179 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Register.cshtml +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Account/Register.cshtml @@ -1,4 +1,4 @@ -@model Spring.Mvc4QuickStart.Models.RegisterModel +@model Spring.Mvc4QuickStart.Models.RegisterModel @{ ViewBag.Title = "Register"; @@ -6,15 +6,18 @@

    @ViewBag.Title.

    -

    Create a new account.

    +

    Use the form below to create a new account.

    - Passwords must be at least @Membership.MinRequiredPasswordLength characters long. + Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length.

    -@using (Html.BeginForm()) { - @Html.ValidationSummary() + + + +@using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { + @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.")
    Registration Form @@ -22,24 +25,24 @@
  • @Html.LabelFor(m => m.UserName) @Html.TextBoxFor(m => m.UserName) + @Html.ValidationMessageFor(m => m.UserName)
  • @Html.LabelFor(m => m.Email) @Html.TextBoxFor(m => m.Email) + @Html.ValidationMessageFor(m => m.Email)
  • @Html.LabelFor(m => m.Password) @Html.PasswordFor(m => m.Password) + @Html.ValidationMessageFor(m => m.Password)
  • @Html.LabelFor(m => m.ConfirmPassword) @Html.PasswordFor(m => m.ConfirmPassword) + @Html.ValidationMessageFor(m => m.ConfirmPassword)
  • } - -@section Scripts { - @Scripts.Render("~/bundles/jqueryval") -} diff --git a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Home/About.cshtml b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Home/About.cshtml index 273ba3ea..37e5d716 100644 --- a/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Home/About.cshtml +++ b/examples/Spring/Spring.Mvc4QuickStart/Spring.Mvc4QuickStart/Views/Home/About.cshtml @@ -9,22 +9,47 @@

    - Use this area to provide additional information. + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tincidunt justo nec tempor. + Aliquam erat volutpat. Fusce facilisis ullamcorper consequat. Vestibulum non sapien lectus. Nam + mi augue, posuere at tempus vel, dignissim vitae nulla. Nullam at quam eu sapien mattis ultrices. + Quisque quis leo mi, at lobortis dolor. Nullam scelerisque facilisis placerat. Fusce a augue + erat, malesuada euismod dui. Duis iaculis risus id felis volutpat elementum. Fusce blandit iaculis + quam a cursus. Cras varius tincidunt cursus. Morbi justo eros, adipiscing ac placerat sed, posuere + et mi. Suspendisse vulputate viverra aliquet. Duis non enim a nibh consequat mollis ac tempor + lorem. Phasellus elit leo, semper eu luctus et, suscipit at lacus. In hac habitasse platea + dictumst. Duis dignissim justo sit amet nulla pulvinar sodales.

    - Use this area to provide additional information. + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tincidunt justo nec tempor. + Aliquam erat volutpat. Fusce facilisis ullamcorper consequat. Vestibulum non sapien lectus. Nam + mi augue, posuere at tempus vel, dignissim vitae nulla. Nullam at quam eu sapien mattis ultrices. + Quisque quis leo mi, at lobortis dolor. Nullam scelerisque facilisis placerat. Fusce a augue + erat, malesuada euismod dui. Duis iaculis risus id felis volutpat elementum. Fusce blandit iaculis + quam a cursus. Cras varius tincidunt cursus. Morbi justo eros, adipiscing ac placerat sed, posuere + et mi. Suspendisse vulputate viverra aliquet. Duis non enim a nibh consequat mollis ac tempor + lorem. Phasellus elit leo, semper eu luctus et, suscipit at lacus. In hac habitasse platea + dictumst. Duis dignissim justo sit amet nulla pulvinar sodales.

    - Use this area to provide additional information. + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tincidunt justo nec tempor. + Aliquam erat volutpat. Fusce facilisis ullamcorper consequat. Vestibulum non sapien lectus. Nam + mi augue, posuere at tempus vel, dignissim vitae nulla. Nullam at quam eu sapien mattis ultrices. + Quisque quis leo mi, at lobortis dolor. Nullam scelerisque facilisis placerat. Fusce a augue + erat, malesuada euismod dui. Duis iaculis risus id felis volutpat elementum. Fusce blandit iaculis + quam a cursus. Cras varius tincidunt cursus. Morbi justo eros, adipiscing ac placerat sed, posuere + et mi. Suspendisse vulputate viverra aliquet. Duis non enim a nibh consequat mollis ac tempor + lorem. Phasellus elit leo, semper eu luctus et, suscipit at lacus. In hac habitasse platea + dictumst. Duis dignissim justo sit amet nulla pulvinar sodales.