Add WebCms

This commit is contained in:
2016-11-07 12:56:17 -05:00
parent dfe92218f4
commit 15911f33c0
2750 changed files with 365672 additions and 133 deletions
@@ -0,0 +1,21 @@
@using WebCms.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 WebCms.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 WebCms.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">&euro;</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,29 @@
@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 WebCms.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>
@@ -0,0 +1,8 @@
@model HttpPostedFileBase
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
}
<span class="btn btn-default btn-file">
Browse <input type="file" name="@ViewData.ModelMetadata.PropertyName" class="btn-default btn-file" />
</span>
@@ -0,0 +1,30 @@
@using WebCms.Utility
@model int?
@{
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 WebCms.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 WebCms.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 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");
}
}
<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,18 @@
@model WebCms.Models.SelectListViewModel
@{
Layout = "~/Views/Shared/EditorTemplates/_FieldLayout.cshtml";
}
@{
var prefix = ViewData.TemplateInfo.HtmlFieldPrefix;
ViewData.TemplateInfo.HtmlFieldPrefix = string.Empty;
foreach (var li in Model.ListItems)
{
<div class="radio">
<label class="radio">
@Html.RadioButton(prefix + ".Selected", li.Value, li.Selected) @li.Text
</label>
</div>
}
ViewData.TemplateInfo.HtmlFieldPrefix = prefix;
}
@@ -0,0 +1,17 @@
@using WebCms.Utility
@model float?
@{
float f;
f = !Model.HasValue ? 0.0f : 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>
@@ -0,0 +1,25 @@
@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, htmlAttributes)
@@ -0,0 +1,13 @@
@using WebCms.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 WebCms.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>
@@ -0,0 +1,51 @@
@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;
}
<div class="form-group @lowerPropertyName @hasErrorClass">
@Html.LabelForModel(new { @class = "control-label" })
@RenderBody()
@Html.ValidationMessage("", new { @class = "help-block"})
</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>*@
+14
View File
@@ -0,0 +1,14 @@
@if (TempData.ContainsKey("StatusMessage"))
{
<p class="center-content alert @Html.Raw(TempData["StatusMessage-Type"])">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@Html.Raw(TempData["StatusMessage"])
</p>
}
else if (ViewBag.StatusMessage != null)
{
<p class="center-content alert">
<button type="button" class="close" data-dismiss="alert">&times;</button>
@ViewBag.StatusMessage
</p>
}
@@ -0,0 +1,13 @@
@model string
@{
var fieldName = Model;
}
@if (ViewData.ModelState[fieldName] != null && ViewData.ModelState[fieldName].Errors.Any())
{
<span class="help-block field-validation-error">
@foreach (var error in ViewData.ModelState[fieldName].Errors)
{
<span id="@fieldName-error" class="text-danger">@error.ErrorMessage</span>
}
</span>
}
@@ -0,0 +1,7 @@
@if (ViewData.ModelState[""] != null && ViewData.ModelState[""].Errors.Any())
{
<div class="alert bg-danger">
<a class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></a>
@Html.ValidationSummary(true)
</div>
}