Files
Orchard/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Input.Edit.cshtml
2015-12-19 20:49:13 +01:00

18 lines
1.5 KiB
Plaintext

@model Orchard.Fields.Fields.InputField
@using Orchard.Utility.Extensions;
@using Orchard.Fields.Settings;
@{
var settings = Model.PartFieldDefinition.Settings.GetModel<InputFieldSettings>();
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.Value)" @if(settings.Required) { <text>class="required"</text> }>@Model.DisplayName</label>
<input type="@settings.Type.ToString().ToLower()" id="@Html.FieldIdFor(m => m.Value)" name="@Html.FieldNameFor(m => m.Value)"@if(!String.IsNullOrWhiteSpace(settings.Title)) {<text> title="@settings.Title"</text>} value="@Model.Value"@if(settings.Required) {<text> required="required"</text> }@if(settings.AutoFocus) {<text> autofocus="autofocus"</text> }@if(settings.AutoComplete) {<text> autocomplete="on"</text> }@if(!string.IsNullOrWhiteSpace(settings.Placeholder)) {<text> placeholder="@settings.Placeholder"</text>}@if(!string.IsNullOrEmpty(settings.Pattern)) {<text> pattern="@settings.Pattern"</text>}@if(!string.IsNullOrEmpty(settings.EditorCssClass)) {<text> class="@settings.EditorCssClass"</text>} else {<text> class="text medium"</text>} @if(settings.MaxLength > 1) {<text> maxlength="@settings.MaxLength.ToString()"</text>} />
@Html.ValidationMessageFor(m => m.Value)
@if (HasText(settings.Hint)) {
<span class="hint">@settings.Hint</span>
}
@if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
<span class="hint">@T("If the field is left empty then the default value will be used.")</span>
}
</fieldset>