InputSize simplification
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data.SqlTypes;
|
||||
using System.Linq;
|
||||
@@ -8,9 +7,7 @@ using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using MileageTraker.Web.Models;
|
||||
using MiscUtil.Collections;
|
||||
|
||||
namespace MileageTraker.Web.Utility
|
||||
{
|
||||
@@ -53,6 +50,15 @@ namespace MileageTraker.Web.Utility
|
||||
: enumeration.ToString();
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> GetInputSizeClass(this HtmlHelper helper)
|
||||
{
|
||||
var inputSize = (string)helper.ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
//var cls = !string.IsNullOrEmpty(inputSize) ? new { @class = inputSize } : null;
|
||||
|
||||
var dictionary = new Dictionary<string, object> {{"class", inputSize}};
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public static IEnumerable<SelectListItem> GetSelectListItems(this Enum enumeration)
|
||||
{
|
||||
var type = enumeration.GetType();
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
@model DateTime
|
||||
@using MileageTraker.Web.Utility
|
||||
@model DateTime
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ), new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ))
|
||||
}
|
||||
|
||||
@Html.TextBox("", (Model != DateTime.MinValue ? Model.ToShortDateString() : string.Empty ), Html.GetInputSizeClass())
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
@model DateTime?
|
||||
@using MileageTraker.Web.Utility
|
||||
@model DateTime?
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
var val =
|
||||
Model.HasValue
|
||||
? Model.Value.ToShortDateString()
|
||||
: string.Empty;
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", (Model != DateTime.MinValue ? val : string.Empty ), new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", (Model != DateTime.MinValue ? val : string.Empty ))
|
||||
}
|
||||
|
||||
@Html.TextBox("", (Model != DateTime.MinValue ? val : string.Empty ), Html.GetInputSizeClass())
|
||||
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
@{
|
||||
@using MileageTraker.Web.Utility
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, Html.GetInputSizeClass())
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
@{
|
||||
@using MileageTraker.Web.Utility
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, Html.GetInputSizeClass())
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
@{
|
||||
@using MileageTraker.Web.Utility
|
||||
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, Html.GetInputSizeClass())
|
||||
@@ -1,12 +1,6 @@
|
||||
@{
|
||||
@using MileageTraker.Web.Utility
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.Password("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.Password("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
|
||||
@Html.Password("", ViewData.TemplateInfo.FormattedModelValue, Html.GetInputSizeClass())
|
||||
@@ -1,17 +1,10 @@
|
||||
@{
|
||||
@using MileageTraker.Web.Utility
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
var inputSize = (string)ViewData.ModelMetadata.AdditionalValues["InputSize"];
|
||||
}
|
||||
@if (!(Model is Enum))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(inputSize))
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = inputSize})
|
||||
}
|
||||
else
|
||||
{
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
}
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, Html.GetInputSizeClass())
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user