-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreplacing.txt
More file actions
64 lines (57 loc) · 2.24 KB
/
replacing.txt
File metadata and controls
64 lines (57 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@model Boolean?
@{
bool isRequired = ViewData.ModelMetadata.IsRequired;
string isRequiredStar = isRequired ? "*" : "",
prop = ViewData.ModelMetadata.PropertyName.ToString(),
propLower = prop.ToLower(),
styleProperty = propLower,
displayName = ViewData.ModelMetadata.DisplayName ?? ViewData.ModelMetadata.PropertyName,
description = ViewData.ModelMetadata.Description;
var htmlAttributes = new RouteValueDictionary();
if (ViewBag.@class != null) {
htmlAttributes.Add("class", ViewBag.@class);
}
if (ViewBag.type != null) {
htmlAttributes.Add("type", ViewBag.type);
}
if (ViewBag.Value != null) {
htmlAttributes.Add("Value", ViewBag.Value);
}
if (ViewBag.label == null) {
ViewBag.label = displayName;
}
if (ViewBag.labelColumn == null) {
ViewBag.labelColumn = "col-md-2";
}
if (ViewBag.textColumn == null) {
ViewBag.textColumn = "col-md-10";
}
if (ViewBag.placeholder != null) {
htmlAttributes.Add("placeholder", ViewBag.placeholder);
} else {
if (isRequired) {
htmlAttributes.Add("placeholder", ViewBag.label + isRequiredStar);
} else {
htmlAttributes.Add("placeholder", "[" + ViewBag.label + "]");
}
}
htmlAttributes.Add("title", htmlAttributes["placeholder"]);
}
<div class="form-row @styleProperty" data-prop="@styleProperty">
<div class="dev-plugin plugin-container checkbox-type">
<div class="@ViewBag.labelColumn @ViewBag.textColumn">
<div class="checkbox">
<label class="form-input" for="@styleProperty">
@Html.CheckBox("", Model.HasValue && Model.Value, htmlAttributes)
ViewBag.label
</label>
@if (description != null) {
<a data-toggle="tooltip" data-original-title="@description" title="@description" class="tooltip-show">
<span class="description-icon"></span>
</a>
}
@Html.ValidationMessageFor(m => m, null, new { @class = "rounded-3 label label-danger fixed-width-294 validation-box" })
</div>
</div>
</div>
</div>