Updates and LeafInput
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model Boolean?
|
||||
|
||||
@{
|
||||
var htmlAttributes = new RouteValueDictionary();
|
||||
if (ViewBag.@class != null)
|
||||
{
|
||||
htmlAttributes.Add("class", ViewBag.@class);
|
||||
}
|
||||
}
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "" })
|
||||
<div class="controls">
|
||||
@Html.CheckBox(
|
||||
"",
|
||||
Model.HasValue && Model.Value,
|
||||
htmlAttributes)
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model DateTime?
|
||||
|
||||
@{
|
||||
DateTime dt;
|
||||
if (Model.HasValue)
|
||||
{
|
||||
dt = (DateTime)Model;
|
||||
}
|
||||
else
|
||||
{
|
||||
dt = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " error has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
@Html.TextBoxFor(m => m, new { @class="form-control datepicker", data_provide="datepicker", data_date_language="globalize", data_date=dt, data_date_format=System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern.Replace("M", "m"), data_date_today_highlight="true", data_date_today_btn="false" })
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class="help-block" })
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model decimal?
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon">€</span>@Html.TextBox(
|
||||
"",
|
||||
Model == null ? "" : String.Format(System.Globalization.CultureInfo.CurrentCulture, "{0:F2}", ViewData.ModelMetadata.Model),
|
||||
ViewBag.ClearTextField == true ? new { @class = "form-control clear-text-field input-block-level" } : new { @class = "form-control input-block-level" })</span>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@{
|
||||
var htmlAttributes = new RouteValueDictionary();
|
||||
if (ViewBag.@class != null)
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control " + ViewBag.@class);
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control");
|
||||
}
|
||||
if (ViewBag.@type != null)
|
||||
{
|
||||
htmlAttributes.Add("type", ViewBag.@type);
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlAttributes.Add("type", "email");
|
||||
}
|
||||
if (ViewBag.placeholder != null)
|
||||
{
|
||||
htmlAttributes.Add("placeholder", ViewBag.placeholder);
|
||||
}
|
||||
}
|
||||
|
||||
@Html.TextBox(
|
||||
"",
|
||||
ViewData.TemplateInfo.FormattedModelValue,
|
||||
htmlAttributes)
|
||||
@@ -0,0 +1,9 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
@Html.EnumDropDownListFor(m => m, new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
@@ -2,4 +2,7 @@
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
<input type="file" name="@ViewData.ModelMetadata.PropertyName" />
|
||||
|
||||
<span class="btn btn-default btn-file">
|
||||
Browse <input type="file" name="@ViewData.ModelMetadata.PropertyName" class="btn-default btn-file" />
|
||||
</span>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model int?
|
||||
|
||||
@{
|
||||
int i;
|
||||
if (!Model.HasValue)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = Model.Value;
|
||||
}
|
||||
|
||||
var htmlAttributes = new RouteValueDictionary();
|
||||
if (ViewBag.@class != null)
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control " + ViewBag.@class);
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control");
|
||||
}
|
||||
|
||||
if (ViewBag.placeholder != null)
|
||||
{
|
||||
htmlAttributes.Add("placeholder", ViewBag.placeholder);
|
||||
}
|
||||
}
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="controls">
|
||||
@Html.TextBox(
|
||||
"",
|
||||
ViewData.TemplateInfo.FormattedModelValue,
|
||||
htmlAttributes)
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,22 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
|
||||
@{
|
||||
string guidID = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/Scripts/mdd_styles.css" />
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="mdd_toolbar"></div>
|
||||
@Html.TextAreaFor(
|
||||
m => m,
|
||||
8, 15,
|
||||
ViewBag.ClearTextField == true ? new { @class = "form-control mdd_editor clear-text-field", data_mdd_preview = "#" + guidID } : new { @class = "form-control mdd_editor", data_mdd_preview = "#" + guidID })
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
<br />
|
||||
<label>Preview</label>
|
||||
<hr />
|
||||
<div class="mdd_preview" id="@guidID"></div>
|
||||
<hr />
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="controls">
|
||||
@Html.TextAreaFor(
|
||||
m => m,
|
||||
8, 8,
|
||||
ViewBag.ClearTextField == true ? new { @class = "form-control input-block-level clear-text-field" } : new { @class = "form-control input-block-level" } )
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
|
||||
@{
|
||||
var htmlAttributes = new RouteValueDictionary();
|
||||
if (ViewBag.@class != null)
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control " + ViewBag.@class);
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="controls">
|
||||
@Html.Password(
|
||||
"",
|
||||
ViewData.TemplateInfo.FormattedModelValue,
|
||||
htmlAttributes)
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model float?
|
||||
|
||||
@{
|
||||
float f;
|
||||
if (!Model.HasValue)
|
||||
{
|
||||
f = 0.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = Model.Value;
|
||||
}
|
||||
}
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="input-group">
|
||||
@Html.TextBox(
|
||||
"", f,
|
||||
ViewBag.ClearTextField == true ? new { @class = "form-control clear-text-field input-block-level" } : new { @class = "form-control input-block-level" })<span class="input-group-addon">0,00</span>
|
||||
</div>
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
@@ -1,5 +1,26 @@
|
||||
@{
|
||||
@model object
|
||||
@{
|
||||
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
|
||||
}
|
||||
@{
|
||||
var htmlAttributes = new RouteValueDictionary();
|
||||
if (ViewBag.@class != null)
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control " + ViewBag.@class);
|
||||
}
|
||||
else
|
||||
{
|
||||
htmlAttributes.Add("class", "form-control");
|
||||
}
|
||||
if (ViewBag.@type != null)
|
||||
{
|
||||
htmlAttributes.Add("type", ViewBag.@type);
|
||||
}
|
||||
if (ViewBag.placeholder != null)
|
||||
{
|
||||
htmlAttributes.Add("placeholder", ViewBag.placeholder);
|
||||
}
|
||||
}
|
||||
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
|
||||
|
||||
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, htmlAttributes)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="controls">
|
||||
@Html.TextBox(
|
||||
"",
|
||||
ViewData.TemplateInfo.FormattedModelValue,
|
||||
ViewBag.ClearTextField == true ? new { @class = "form-control clear-text-field input-block-level" } : new { @class = "form-control input-block-level" } )
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class = "help-block" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
@using LeafWeb.Web.Utility
|
||||
@model TimeSpan?
|
||||
|
||||
@{
|
||||
TimeSpan ts;
|
||||
|
||||
if (Model == null)
|
||||
{
|
||||
ts = TimeSpan.FromMinutes(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
ts = Model.Value;
|
||||
}
|
||||
|
||||
}
|
||||
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
|
||||
@Html.LabelFor(m => m, new { @class = "control-label" })
|
||||
<div class="controls">
|
||||
@Html.TextBoxFor(m => m, "hh\\:mm", new { @Value = ts.ToString("hh\\:mm"), @class="form-control timepicker", data_provide="timepicker", data_minute_step="5", data_show_meridian="false", data_disable_focus="true", data_template = "dropdown", data_default_time="value" })
|
||||
@Html.ValidationMessageFor(m => m, null, new { @class="help-block" })
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,6 @@
|
||||
@{
|
||||
@using LeafWeb.Web.Utility
|
||||
@model object
|
||||
@{
|
||||
Layout = null;
|
||||
var lowerPropertyName = @LeafWeb.Core.Utility.StringExtensions.LowercaseFirst(ViewData.ModelMetadata.PropertyName);
|
||||
var values = ViewData.ModelMetadata.AdditionalValues;
|
||||
@@ -7,35 +9,43 @@
|
||||
var formatHint = values.ContainsKey("FormatHint") ? (string)values["FormatHint"] : null;
|
||||
var editLabel = values.ContainsKey("EditLabel") ? (bool)values["EditLabel"] : true;
|
||||
}
|
||||
@RenderBody()
|
||||
@*<div class="form-group @lowerPropertyName">
|
||||
@if (editLabel)
|
||||
{
|
||||
@Html.LabelForModel()
|
||||
}
|
||||
<div class="input-group">
|
||||
@if (!string.IsNullOrEmpty(units))
|
||||
{
|
||||
<div class="input-append">
|
||||
@RenderBody()
|
||||
<span class="add-on">@units</span>
|
||||
</div>
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(currency))
|
||||
{
|
||||
<div class="input-prepend">
|
||||
<span class="add-on">@currency</span>
|
||||
@RenderBody()
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@RenderBody()
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(formatHint))
|
||||
{
|
||||
<div><small><em>@formatHint</em></small></div>
|
||||
}
|
||||
<span class="help-block">@Html.ValidationMessage("")</span>
|
||||
<div class="form-group @lowerPropertyName">
|
||||
@Html.LabelForModel(new { @class = "control-label" })
|
||||
<div class="controls">
|
||||
@RenderBody()
|
||||
@Html.ValidationMessage("", new { @class = "help-block"})
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
|
||||
@*<div class="form-group @lowerPropertyName">
|
||||
@if (editLabel)
|
||||
{
|
||||
@Html.LabelForModel()
|
||||
}
|
||||
<div class="input-group">
|
||||
@if (!string.IsNullOrEmpty(units))
|
||||
{
|
||||
<div class="input-append">
|
||||
@RenderBody()
|
||||
<span class="add-on">@units</span>
|
||||
</div>
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(currency))
|
||||
{
|
||||
<div class="input-prepend">
|
||||
<span class="add-on">@currency</span>
|
||||
@RenderBody()
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@RenderBody()
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(formatHint))
|
||||
{
|
||||
<div><small><em>@formatHint</em></small></div>
|
||||
}
|
||||
<span class="help-block">@Html.ValidationMessage("")</span>
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
|
||||
@Scripts.Render("~/bundles/jquery")
|
||||
@Scripts.Render("~/bundles/bootstrap")
|
||||
@Scripts.Render("~/bundles/forms")
|
||||
@RenderSection("Scripts", false)
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user