From 4f197c9c4e4210aab1d042ab35b286235d7b07ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Vondr=C3=A1=C5=A1ek?= Date: Sat, 4 Jul 2015 23:51:07 +0200 Subject: [PATCH] Fixed build error (re-run T4 templates), improved Edit screens. Relates to #27 --- .../Controllers/PositionsController.cs | 2 +- .../Security/Controllers/RolesController.cs | 2 +- .../Security/Views/Positions/Edit.cshtml | 2 +- .../Areas/Security/Views/Roles/Edit.cshtml | 2 +- .../Security.PositionsController.generated.cs | 185 ++++++++++++++++++ .../Web/Security.RolesController.generated.cs | 185 ++++++++++++++++++ src/Server/DeploymentFramework/Web/T4MVC.cs | 3 + src/Server/DeploymentFramework/Web/Web.csproj | 6 + 8 files changed, 383 insertions(+), 4 deletions(-) create mode 100644 src/Server/DeploymentFramework/Web/Security.PositionsController.generated.cs create mode 100644 src/Server/DeploymentFramework/Web/Security.RolesController.generated.cs diff --git a/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/PositionsController.cs b/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/PositionsController.cs index df1f233..16e9254 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/PositionsController.cs +++ b/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/PositionsController.cs @@ -18,7 +18,7 @@ public PositionsController(Func securityUow) _securityUow = securityUow; } - public ActionResult Index(IndexFilter filter, PagingData paging) + public virtual ActionResult Index(IndexFilter filter, PagingData paging) { paging.PageSize = 2; // only for testing diff --git a/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/RolesController.cs b/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/RolesController.cs index 96cf2fb..253e81d 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/RolesController.cs +++ b/src/Server/DeploymentFramework/Web/Areas/Security/Controllers/RolesController.cs @@ -19,7 +19,7 @@ public RolesController(Func securityUow) _securityUow = securityUow; } - public ActionResult Index(IndexFilter filter, PagingData paging) + public virtual ActionResult Index(IndexFilter filter, PagingData paging) { paging.PageSize = 2; // only for testing diff --git a/src/Server/DeploymentFramework/Web/Areas/Security/Views/Positions/Edit.cshtml b/src/Server/DeploymentFramework/Web/Areas/Security/Views/Positions/Edit.cshtml index 7e3bb28..e974509 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Security/Views/Positions/Edit.cshtml +++ b/src/Server/DeploymentFramework/Web/Areas/Security/Views/Positions/Edit.cshtml @@ -10,7 +10,7 @@ using (var s = f.BeginSection()) { @s.FieldFor(m => m.Name) - @s.FieldFor(m => m.IsActive) + @s.FieldFor(m => m.IsActive).AsDropDown() } using (var n = f.BeginNavigation()) diff --git a/src/Server/DeploymentFramework/Web/Areas/Security/Views/Roles/Edit.cshtml b/src/Server/DeploymentFramework/Web/Areas/Security/Views/Roles/Edit.cshtml index 60ffa33..4d8fc8e 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Security/Views/Roles/Edit.cshtml +++ b/src/Server/DeploymentFramework/Web/Areas/Security/Views/Roles/Edit.cshtml @@ -10,7 +10,7 @@ using (var s = f.BeginSection()) { @s.FieldFor(m => m.Name) - @s.FieldFor(m => m.IsActive) + @s.FieldFor(m => m.IsActive).AsDropDown() } using (var n = f.BeginNavigation()) diff --git a/src/Server/DeploymentFramework/Web/Security.PositionsController.generated.cs b/src/Server/DeploymentFramework/Web/Security.PositionsController.generated.cs new file mode 100644 index 0000000..1cf7e0c --- /dev/null +++ b/src/Server/DeploymentFramework/Web/Security.PositionsController.generated.cs @@ -0,0 +1,185 @@ +// +// This file was generated by a T4 template. +// Don't change it directly as your change would get overwritten. Instead, make changes +// to the .tt file (i.e. the T4 template) and save it to regenerate this file. + +// Make sure the compiler doesn't complain about missing Xml comments +#pragma warning disable 1591 +#region T4MVC + +using System; +using System.Diagnostics; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Web; +using System.Web.Hosting; +using System.Web.Mvc; +using System.Web.Mvc.Ajax; +using System.Web.Mvc.Html; +using System.Web.Routing; +using T4MVC; +using Baud.Deployment.Web.Framework.Security; +namespace Baud.Deployment.Web.Areas.Security.Controllers +{ + public partial class PositionsController + { + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected PositionsController(Dummy d) { } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToAction(ActionResult result) + { + var callInfo = result.GetT4MVCResult(); + return RedirectToRoute(callInfo.RouteValueDictionary); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToAction(Task taskResult) + { + return RedirectToAction(taskResult.Result); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result) + { + var callInfo = result.GetT4MVCResult(); + return RedirectToRoutePermanent(callInfo.RouteValueDictionary); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToActionPermanent(Task taskResult) + { + return RedirectToActionPermanent(taskResult.Result); + } + + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult Index() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index); + } + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult Detail() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Detail); + } + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult Edit() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public PositionsController Actions { get { return MVC.Security.Positions; } } + [GeneratedCode("T4MVC", "2.0")] + public readonly string Area = "Security"; + [GeneratedCode("T4MVC", "2.0")] + public readonly string Name = "Positions"; + [GeneratedCode("T4MVC", "2.0")] + public const string NameConst = "Positions"; + + static readonly ActionNamesClass s_actions = new ActionNamesClass(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ActionNamesClass ActionNames { get { return s_actions; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionNamesClass + { + public readonly string Index = "Index"; + public readonly string Detail = "Detail"; + public readonly string Edit = "Edit"; + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionNameConstants + { + public const string Index = "Index"; + public const string Detail = "Detail"; + public const string Edit = "Edit"; + } + + + static readonly ViewsClass s_views = new ViewsClass(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ViewsClass Views { get { return s_views; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ViewsClass + { + static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass(); + public _ViewNamesClass ViewNames { get { return s_ViewNames; } } + public class _ViewNamesClass + { + public readonly string Detail = "Detail"; + public readonly string Edit = "Edit"; + public readonly string Index = "Index"; + } + public readonly string Detail = "~/Areas/Security/Views/Positions/Detail.cshtml"; + public readonly string Edit = "~/Areas/Security/Views/Positions/Edit.cshtml"; + public readonly string Index = "~/Areas/Security/Views/Positions/Index.cshtml"; + } + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public partial class T4MVC_PositionsController : Baud.Deployment.Web.Areas.Security.Controllers.PositionsController + { + public T4MVC_PositionsController() : base(Dummy.Instance) { } + + [NonAction] + partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Baud.Deployment.Web.Areas.Security.Models.Positions.IndexFilter filter, Baud.Deployment.Web.Framework.Web.PagingData paging); + + [NonAction] + public override System.Web.Mvc.ActionResult Index(Baud.Deployment.Web.Areas.Security.Models.Positions.IndexFilter filter, Baud.Deployment.Web.Framework.Web.PagingData paging) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "filter", filter); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "paging", paging); + IndexOverride(callInfo, filter, paging); + return callInfo; + } + + [NonAction] + partial void DetailOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, short id); + + [NonAction] + public override System.Web.Mvc.ActionResult Detail(short id) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Detail); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + DetailOverride(callInfo, id); + return callInfo; + } + + [NonAction] + partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, short id); + + [NonAction] + public override System.Web.Mvc.ActionResult Edit(short id) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + EditOverride(callInfo, id); + return callInfo; + } + + [NonAction] + partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, short id, System.Web.Mvc.FormCollection form); + + [NonAction] + public override System.Web.Mvc.ActionResult Edit(short id, System.Web.Mvc.FormCollection form) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "form", form); + EditOverride(callInfo, id, form); + return callInfo; + } + + } +} + +#endregion T4MVC +#pragma warning restore 1591 diff --git a/src/Server/DeploymentFramework/Web/Security.RolesController.generated.cs b/src/Server/DeploymentFramework/Web/Security.RolesController.generated.cs new file mode 100644 index 0000000..5691360 --- /dev/null +++ b/src/Server/DeploymentFramework/Web/Security.RolesController.generated.cs @@ -0,0 +1,185 @@ +// +// This file was generated by a T4 template. +// Don't change it directly as your change would get overwritten. Instead, make changes +// to the .tt file (i.e. the T4 template) and save it to regenerate this file. + +// Make sure the compiler doesn't complain about missing Xml comments +#pragma warning disable 1591 +#region T4MVC + +using System; +using System.Diagnostics; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Web; +using System.Web.Hosting; +using System.Web.Mvc; +using System.Web.Mvc.Ajax; +using System.Web.Mvc.Html; +using System.Web.Routing; +using T4MVC; +using Baud.Deployment.Web.Framework.Security; +namespace Baud.Deployment.Web.Areas.Security.Controllers +{ + public partial class RolesController + { + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RolesController(Dummy d) { } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToAction(ActionResult result) + { + var callInfo = result.GetT4MVCResult(); + return RedirectToRoute(callInfo.RouteValueDictionary); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToAction(Task taskResult) + { + return RedirectToAction(taskResult.Result); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result) + { + var callInfo = result.GetT4MVCResult(); + return RedirectToRoutePermanent(callInfo.RouteValueDictionary); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + protected RedirectToRouteResult RedirectToActionPermanent(Task taskResult) + { + return RedirectToActionPermanent(taskResult.Result); + } + + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult Index() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index); + } + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult Detail() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Detail); + } + [NonAction] + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public virtual System.Web.Mvc.ActionResult Edit() + { + return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public RolesController Actions { get { return MVC.Security.Roles; } } + [GeneratedCode("T4MVC", "2.0")] + public readonly string Area = "Security"; + [GeneratedCode("T4MVC", "2.0")] + public readonly string Name = "Roles"; + [GeneratedCode("T4MVC", "2.0")] + public const string NameConst = "Roles"; + + static readonly ActionNamesClass s_actions = new ActionNamesClass(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ActionNamesClass ActionNames { get { return s_actions; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionNamesClass + { + public readonly string Index = "Index"; + public readonly string Detail = "Detail"; + public readonly string Edit = "Edit"; + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ActionNameConstants + { + public const string Index = "Index"; + public const string Detail = "Detail"; + public const string Edit = "Edit"; + } + + + static readonly ViewsClass s_views = new ViewsClass(); + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public ViewsClass Views { get { return s_views; } } + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public class ViewsClass + { + static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass(); + public _ViewNamesClass ViewNames { get { return s_ViewNames; } } + public class _ViewNamesClass + { + public readonly string Detail = "Detail"; + public readonly string Edit = "Edit"; + public readonly string Index = "Index"; + } + public readonly string Detail = "~/Areas/Security/Views/Roles/Detail.cshtml"; + public readonly string Edit = "~/Areas/Security/Views/Roles/Edit.cshtml"; + public readonly string Index = "~/Areas/Security/Views/Roles/Index.cshtml"; + } + } + + [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode] + public partial class T4MVC_RolesController : Baud.Deployment.Web.Areas.Security.Controllers.RolesController + { + public T4MVC_RolesController() : base(Dummy.Instance) { } + + [NonAction] + partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Baud.Deployment.Web.Areas.Security.Models.Roles.IndexFilter filter, Baud.Deployment.Web.Framework.Web.PagingData paging); + + [NonAction] + public override System.Web.Mvc.ActionResult Index(Baud.Deployment.Web.Areas.Security.Models.Roles.IndexFilter filter, Baud.Deployment.Web.Framework.Web.PagingData paging) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "filter", filter); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "paging", paging); + IndexOverride(callInfo, filter, paging); + return callInfo; + } + + [NonAction] + partial void DetailOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, short id); + + [NonAction] + public override System.Web.Mvc.ActionResult Detail(short id) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Detail); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + DetailOverride(callInfo, id); + return callInfo; + } + + [NonAction] + partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, short id); + + [NonAction] + public override System.Web.Mvc.ActionResult Edit(short id) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + EditOverride(callInfo, id); + return callInfo; + } + + [NonAction] + partial void EditOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, short id, System.Web.Mvc.FormCollection form); + + [NonAction] + public override System.Web.Mvc.ActionResult Edit(short id, System.Web.Mvc.FormCollection form) + { + var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Edit); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "form", form); + EditOverride(callInfo, id, form); + return callInfo; + } + + } +} + +#endregion T4MVC +#pragma warning restore 1591 diff --git a/src/Server/DeploymentFramework/Web/T4MVC.cs b/src/Server/DeploymentFramework/Web/T4MVC.cs index 25e68dd..c53444d 100644 --- a/src/Server/DeploymentFramework/Web/T4MVC.cs +++ b/src/Server/DeploymentFramework/Web/T4MVC.cs @@ -43,6 +43,8 @@ namespace T4MVC public class SecurityClass { public readonly string Name = "Security"; + public Baud.Deployment.Web.Areas.Security.Controllers.PositionsController Positions = new Baud.Deployment.Web.Areas.Security.Controllers.T4MVC_PositionsController(); + public Baud.Deployment.Web.Areas.Security.Controllers.RolesController Roles = new Baud.Deployment.Web.Areas.Security.Controllers.T4MVC_RolesController(); public Baud.Deployment.Web.Areas.Security.Controllers.UsersController Users = new Baud.Deployment.Web.Areas.Security.Controllers.T4MVC_UsersController(); public T4MVC.Security.SharedController Shared = new T4MVC.Security.SharedController(); } @@ -86,6 +88,7 @@ public static class Scripts { public static readonly string _references_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/_references.min.js") ? Url("_references.min.js") : Url("_references.js"); public static readonly string bootstrap_bundle_min_js = Url("bootstrap-bundle.min.js"); public static readonly string jquery_bundle_min_js = Url("jquery-bundle.min.js"); + public static readonly string jquery_validate_unobtrusive_bootstrap_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery.validate.unobtrusive.bootstrap.min.js") ? Url("jquery.validate.unobtrusive.bootstrap.min.js") : Url("jquery.validate.unobtrusive.bootstrap.js"); public static readonly string jquery_validate_unobtrusive_chameleon_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/jquery.validate.unobtrusive.chameleon.min.js") ? Url("jquery.validate.unobtrusive.chameleon.min.js") : Url("jquery.validate.unobtrusive.chameleon.js"); public static readonly string modernizer_min_js = T4MVCHelpers.IsProduction() && T4Extensions.FileExists(URLPATH + "/modernizer-min.min.js") ? Url("modernizer-min.min.js") : Url("modernizer-min.js"); } diff --git a/src/Server/DeploymentFramework/Web/Web.csproj b/src/Server/DeploymentFramework/Web/Web.csproj index 1de59c7..95a8a64 100644 --- a/src/Server/DeploymentFramework/Web/Web.csproj +++ b/src/Server/DeploymentFramework/Web/Web.csproj @@ -365,6 +365,12 @@ + + T4MVC.tt + + + T4MVC.tt + T4MVC.tt