Add registration workflow

Update unobtrusive Validation
This commit is contained in:
2020-01-10 14:52:11 -05:00
parent e0464cb77c
commit 8452a9cce0
34 changed files with 235 additions and 898 deletions
@@ -1,7 +1,8 @@
@using LeafWeb.WebCms.Utility
@model Boolean?
@{
Layout = "_FieldLayout.cshtml";
var htmlAttributes = new RouteValueDictionary();
if (ViewBag.@class != null)
{
@@ -9,13 +10,7 @@
}
}
<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 = "form-text" })
</div>
</div>
@Html.CheckBox(
"",
Model.HasValue && Model.Value,
htmlAttributes)
@@ -1,7 +1,9 @@
@using LeafWeb.WebCms.Utility
@using System.Threading
@model DateTime?
@{
Layout = "_FieldLayout.cshtml";
DateTime dt;
if (Model.HasValue)
{
@@ -13,8 +15,14 @@
}
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " error has-error"))">
@Html.LabelFor(m => m)
@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="form-text" })
</div>
@Html.TextBoxFor(m => m,
new
{
@class="form-control datepicker",
data_provide="datepicker",
data_date_language="globalize",
data_date=dt,
data_date_format=Thread.CurrentThread.CurrentUICulture.DateTimeFormat.ShortDatePattern.Replace("M", "m"),
data_date_today_highlight="true",
data_date_today_btn="false"
})
@@ -1,13 +1,14 @@
@using LeafWeb.WebCms.Utility
@using System.Globalization
@model decimal?
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<div class="input-group">
<span class="input-group-addon">&euro;@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 = "form-text" })
@{
Layout = "_FieldLayout.cshtml";
}
<div class="input-group">
<span class="input-group-append">
&euro;@Html.TextBox(
"",
Model == null
? ""
: string.Format(CultureInfo.CurrentCulture, "{0:F2}", ViewData.ModelMetadata.Model))
</span>
</div>
@@ -1,29 +1,30 @@
@using LeafWeb.WebCms.Utility
@model object
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
Layout = "_FieldLayout.cshtml";
}
@{
var htmlAttributes = new RouteValueDictionary();
htmlAttributes.Add("type", "email");
var controlClass = "form-control";
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");
controlClass = string.Concat(controlClass, " ", ViewBag.@class);
}
if (ViewBag.placeholder != null)
{
htmlAttributes.Add("placeholder", ViewBag.placeholder);
}
if (Html.HasError())
{
controlClass = string.Concat(controlClass, " ", "is-invalid");
}
htmlAttributes.Add("class", controlClass);
}
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, htmlAttributes)
@@ -1,9 +1,6 @@
@using LeafWeb.WebCms.Utility
@model object
@{
Layout = "_FieldLayout.cshtml";
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
@Html.EnumDropDownListFor(m => m, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m, null, new { @class = "form-text" })
</div>
@Html.EnumDropDownListFor(m => m, new { @class = "form-control" })
@@ -1,6 +1,6 @@
@model HttpPostedFileBase
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
Layout = "_FieldLayout.cshtml";
}
<span class="btn btn-outline-secondary btn-file">
@@ -1,7 +1,8 @@
@using LeafWeb.WebCms.Utility
@model int?
@{
Layout = "_FieldLayout.cshtml";
var htmlAttributes = new RouteValueDictionary();
if (ViewBag.@class != null)
{
@@ -18,13 +19,4 @@
}
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<div class="controls">
@Html.TextBox(
"",
ViewData.TemplateInfo.FormattedModelValue,
htmlAttributes)
@Html.ValidationMessageFor(m => m, null, new { @class = "form-text" })
</div>
</div>
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, htmlAttributes)
@@ -6,7 +6,7 @@
}
<link rel="stylesheet" type="text/css" href="/Scripts/mdd_styles.css" />
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
<div class="form-group@(Html.ValidationErrorFor(m => m, " is-invalid"))">
@Html.LabelFor(m => m)
<div class="mdd_toolbar"></div>
@Html.TextAreaFor(
@@ -1,13 +1,8 @@
@using LeafWeb.WebCms.Utility
@model object
@{
Layout = "_FieldLayout.cshtml";
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<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 = "form-text" })
</div>
<div class="">
@Html.TextAreaFor(m => m, new{rows=8, @class="form-control"})
</div>
@@ -1,26 +1,5 @@
@using LeafWeb.WebCms.Utility
@model object
@{
var htmlAttributes = new RouteValueDictionary();
if (ViewBag.@class != null)
{
htmlAttributes.Add("class", "form-control " + ViewBag.@class);
}
else
{
htmlAttributes.Add("class", "form-control");
}
Layout = "_FieldLayout.cshtml";
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<div class="controls">
@Html.Password(
"",
ViewData.TemplateInfo.FormattedModelValue,
htmlAttributes)
@Html.ValidationMessageFor(m => m, null, new { @class = "form-text" })
</div>
</div>
@Html.Password("", ViewData.TemplateInfo.FormattedModelValue, new { @class = "form-control" })
@@ -1,17 +1,20 @@
@model SelectListViewModel
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
Layout = "_FieldLayout.cshtml";
}
@{
var prefix = ViewData.TemplateInfo.HtmlFieldPrefix;
ViewData.TemplateInfo.HtmlFieldPrefix = string.Empty;
var required = new { required = "true" };
foreach (var li in Model.ListItems)
{
<div class="radio">
<label class="radio">
@Html.RadioButton(prefix + ".Selected", li.Value, li.Selected, required) @li.Text
var name = prefix + ".Selected";
<div class="form-check">
<input class="form-check-input" type="radio" name="@name" id="@li.Value" value="@li.Value" @(li.Selected ? " checked" : "")>
<label class="form-check-label" for="@li.Value">
@li.Text
</label>
</div>
required = null;
@@ -1,17 +1,10 @@
@using LeafWeb.WebCms.Utility
@model float?
@{
float f;
f = !Model.HasValue ? 0.0f : Model.Value;
Layout = "_FieldLayout.cshtml";
var f = Model ?? 0.0f;
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<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 = "form-text" })
</div>
@Html.TextBox("", f)
<span class="input-group-append">0,00</span>
@@ -1,25 +1,33 @@
@model object
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
Layout = "_FieldLayout.cshtml";
}
@{
var htmlAttributes = new RouteValueDictionary();
if (ViewData.ContainsKey("type"))
{
htmlAttributes.Add("type", ViewData["type"]);
}
var controlClass = "form-control";
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);
controlClass = string.Concat(controlClass, " ", ViewBag.@class);
}
if (ViewBag.placeholder != null)
{
htmlAttributes.Add("placeholder", ViewBag.placeholder);
}
if (ViewData.ModelState.ContainsKey(ViewData.TemplateInfo.HtmlFieldPrefix) &&
ViewData.ModelState[ViewData.TemplateInfo.HtmlFieldPrefix].Errors.Any())
{
controlClass = string.Concat(controlClass, " ", "is-invalid");
}
htmlAttributes.Add("class", controlClass);
}
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, htmlAttributes)
@@ -6,14 +6,14 @@
//var isChecked = Model.HasValue && Model.Value;
}
<div class="@(Html.ValidationErrorFor(m => m, " has-error"))">
<div class="@(Html.ValidationErrorFor(m => m, " is-invalid"))">
<div class="checkbox">
<label>
@Html.CheckBoxFor(m=> m)
I agree to the
<a href="@UmbracoContext.Current.UrlProvider.GetUrl(1115)" target="_blank">
Terms of Service
<span class="fa fa-new-window" aria-hidden="true"></span>
<span class="fa fa-window-restore" aria-hidden="true"></span>
</a>
</label>
</div>
@@ -1,13 +1,6 @@
@using LeafWeb.WebCms.Utility
@model object
@{
Layout = "_FieldLayout.cshtml";
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<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 = "form-text" })
</div>
</div>
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue)
@@ -1,23 +1,22 @@
@using LeafWeb.WebCms.Utility
@model TimeSpan?
@{
TimeSpan ts;
if (Model == null)
{
ts = TimeSpan.FromMinutes(10);
}
else
{
ts = Model.Value;
}
Layout = "_FieldLayout.cshtml";
var ts = Model ?? TimeSpan.FromMinutes(10);
}
<div class="form-group@(Html.ValidationErrorFor(m => m, " has-error"))">
@Html.LabelFor(m => m)
<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="form-text" })
</div>
</div>
@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"
})
@@ -1,18 +1,11 @@
@model object
@using StringExtensions = LeafWeb.Core.Utility.StringExtensions
@model object
@{
Layout = null;
var propertyName = ViewData.ModelMetadata.PropertyName;
var lowerPropertyName = @LeafWeb.Core.Utility.StringExtensions.LowercaseFirst(propertyName);
var values = ViewData.ModelMetadata.AdditionalValues;
var units = values.ContainsKey("Units") ? (string)values["Units"] : null;
var currency = values.ContainsKey("Currency") ? (string)values["Currency"] : null;
var formatHint = values.ContainsKey("FormatHint") ? (string)values["FormatHint"] : null;
var editLabel = values.ContainsKey("EditLabel") ? (bool)values["EditLabel"] : true;
var hasError = ViewData.ModelState[propertyName] != null && ViewData.ModelState[propertyName].Errors.Any();
var hasErrorClass = hasError ? "has-error" : string.Empty;
var lowerPropertyName = StringExtensions.LowercaseFirst(ViewData.ModelMetadata.PropertyName);
}
<div class="form-group @lowerPropertyName @hasErrorClass">
<div class="form-group @lowerPropertyName">
@Html.LabelForModel()
@RenderBody()
@Html.ValidationMessage("", new { @class = "form-text"})
@Html.ValidationMessage(string.Empty, new { @class = "text-danger"})
</div>