@using LeafWeb.Web.Utility
@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>*@
