From 1424c46de0ee11f29b0eac833e7ff4f5007bcad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Vondr=C3=A1=C5=A1ek?= Date: Wed, 15 Jul 2015 17:25:25 +0200 Subject: [PATCH] Server Parameters editor UI. Relates to #29. --- .../Domain/Deployment/Entities/ServerParameter.cs | 4 ++++ .../Resources/StringResources.Designer.cs | 9 +++++++++ .../Resources/StringResources.cs-CZ.resx | 3 +++ .../Resources/StringResources.resx | 3 +++ .../Deployment/Controllers/ServersController.cs | 4 ++-- .../Areas/Deployment/Views/Servers/Detail.cshtml | 2 +- .../Deployment/Views/Servers/EditParameters.cshtml | 14 ++++++-------- .../Web/Deployment.ServersController.generated.cs | 14 +++++++------- 8 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Entities/ServerParameter.cs b/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Entities/ServerParameter.cs index dedfb2e..a0d09de 100644 --- a/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Entities/ServerParameter.cs +++ b/src/Server/DeploymentFramework/BusinessLogic/Domain/Deployment/Entities/ServerParameter.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using Baud.Deployment.Resources; namespace Baud.Deployment.BusinessLogic.Domain.Deployment.Entities { @@ -15,7 +16,10 @@ public class ServerParameter : EntityBase [Required] [MaxLength(40)] + [Display(Name = "Name", ResourceType = typeof(StringResources))] public string Name { get; set; } + + [Display(Name = "Value", ResourceType = typeof(StringResources))] public string Value { get; set; } public Server Server { get; set; } diff --git a/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs b/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs index ceb8e84..566ad29 100644 --- a/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs +++ b/src/Server/DeploymentFramework/Resources/StringResources.Designer.cs @@ -447,6 +447,15 @@ public static string Users { } } + /// + /// Looks up a localized string similar to Value. + /// + public static string Value { + get { + return ResourceManager.GetString("Value", resourceCulture); + } + } + /// /// Looks up a localized string similar to Yes. /// diff --git a/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx b/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx index c8e802c..07831bb 100644 --- a/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx +++ b/src/Server/DeploymentFramework/Resources/StringResources.cs-CZ.resx @@ -246,6 +246,9 @@ Uživatelé + + Hodnota + Ano diff --git a/src/Server/DeploymentFramework/Resources/StringResources.resx b/src/Server/DeploymentFramework/Resources/StringResources.resx index 4b4a6c1..5bbcb25 100644 --- a/src/Server/DeploymentFramework/Resources/StringResources.resx +++ b/src/Server/DeploymentFramework/Resources/StringResources.resx @@ -246,6 +246,9 @@ Users + + Value + Yes diff --git a/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs b/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs index 9ba8a99..43d7211 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs +++ b/src/Server/DeploymentFramework/Web/Areas/Deployment/Controllers/ServersController.cs @@ -123,7 +123,7 @@ public virtual ActionResult Add(FormCollection form) // TODO Add a repository method, make this work [HttpPost] [ValidateAntiForgeryToken] - public virtual ActionResult EditParameters(int serverID) + public virtual ActionResult EditParameters(int serverID, FormCollection form) { using (var uow = _deploymentUow()) { @@ -143,7 +143,7 @@ public virtual ActionResult EditParameters(int serverID) } } - public virtual ActionResult EditParameters(int serverID, FormCollection form) + public virtual ActionResult EditParameters(int serverID) { using (var uow = _deploymentUow()) { diff --git a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Detail.cshtml b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Detail.cshtml index 0139d29..300f10e 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Detail.cshtml +++ b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/Detail.cshtml @@ -45,7 +45,7 @@

@StringResources.Parameters

- @Html.GuardedActionLink(StringResources.EditParameters, MVC.Deployment.Servers.EditParameters(Model.ID), new SimpleHtmlAttributes("class", "btn btn-default disabled")) + @Html.GuardedActionLink(StringResources.EditParameters, MVC.Deployment.Servers.EditParameters(Model.ID), new SimpleHtmlAttributes("class", "btn btn-default"))
@if (Model.Parameters.Any()) { diff --git a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/EditParameters.cshtml b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/EditParameters.cshtml index cb1c9f0..aa9df40 100644 --- a/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/EditParameters.cshtml +++ b/src/Server/DeploymentFramework/Web/Areas/Deployment/Views/Servers/EditParameters.cshtml @@ -1,6 +1,4 @@ - - -@model Baud.Deployment.BusinessLogic.Domain.Deployment.Entities.Server +@model Baud.Deployment.BusinessLogic.Domain.Deployment.Entities.Server @using Baud.Deployment.Resources @{ @@ -8,14 +6,14 @@ }

@ViewBag.Title

-@foreach (var parameter in Model.Parameters) +@using (var f = Html.BeginCustomForm()) { - using (var f = Html.BeginCustomForm()) + using (var s = f.BeginSection()) { - using (var s = f.BeginSection()) + for (int i = 0; i < Model.Parameters.Count(); i++) { - @*@s.FieldFor(parameter.Name) - @s.FieldFor(parameter.Value)*@ + @s.FieldFor(m => Model.Parameters[i].Name).Readonly() + @s.FieldFor(m => Model.Parameters[i].Value) } using (var n = f.BeginNavigation()) diff --git a/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs b/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs index 948ef57..885d6de 100644 --- a/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs +++ b/src/Server/DeploymentFramework/Web/Deployment.ServersController.generated.cs @@ -216,27 +216,27 @@ public override System.Web.Mvc.ActionResult Add(System.Web.Mvc.FormCollection fo } [NonAction] - partial void EditParametersOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int serverID); + partial void EditParametersOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int serverID, System.Web.Mvc.FormCollection form); [NonAction] - public override System.Web.Mvc.ActionResult EditParameters(int serverID) + public override System.Web.Mvc.ActionResult EditParameters(int serverID, System.Web.Mvc.FormCollection form) { var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.EditParameters); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "serverID", serverID); - EditParametersOverride(callInfo, serverID); + ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "form", form); + EditParametersOverride(callInfo, serverID, form); return callInfo; } [NonAction] - partial void EditParametersOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int serverID, System.Web.Mvc.FormCollection form); + partial void EditParametersOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int serverID); [NonAction] - public override System.Web.Mvc.ActionResult EditParameters(int serverID, System.Web.Mvc.FormCollection form) + public override System.Web.Mvc.ActionResult EditParameters(int serverID) { var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.EditParameters); ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "serverID", serverID); - ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "form", form); - EditParametersOverride(callInfo, serverID, form); + EditParametersOverride(callInfo, serverID); return callInfo; }