Skip to content

Commit

Permalink
Server Parameters editor UI. Relates to Baud-UCS#29.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berzeger committed Jul 15, 2015
1 parent 58c13ad commit 1424c46
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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; }
Expand Down

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
Expand Up @@ -246,6 +246,9 @@
<data name="Users" xml:space="preserve">
<value>Uživatelé</value>
</data>
<data name="Value" xml:space="preserve">
<value>Hodnota</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Ano</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions src/Server/DeploymentFramework/Resources/StringResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@
<data name="Users" xml:space="preserve">
<value>Users</value>
</data>
<data name="Value" xml:space="preserve">
<value>Value</value>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<div class="col-md-8">
<div class="well">
<h3>@StringResources.Parameters</h3>
@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"))
<dl>
@if (Model.Parameters.Any())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<!-- TODO Finish -->

@model Baud.Deployment.BusinessLogic.Domain.Deployment.Entities.Server
@model Baud.Deployment.BusinessLogic.Domain.Deployment.Entities.Server
@using Baud.Deployment.Resources

@{
ViewBag.Title = StringResources.EditParameters;
}

<h2>@ViewBag.Title</h2>
@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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1424c46

Please sign in to comment.