1
1
@*
2
2
* GriddlyButton renderer using Bootstrap html and styles
3
3
* http://griddly.com
4
- * Copyright 2013-2017 Chris Hynes and Data Research Group, Inc.
4
+ * Copyright 2013-2018 Chris Hynes and Data Research Group, Inc.
5
5
* Licensed under MIT (https://github.com/programcsharp/griddly/blob/master/LICENSE)
6
6
*
7
7
* WARNING: Don't edit this file -- it'll be overwitten when you upgrade.
10
10
*@
11
11
12
12
@model GriddlyButton
13
+ @{
14
+ bool isListOnly = ViewBag .IsListOnly == true ;
15
+ }
13
16
@if (Model is GriddlyHtmlButton )
14
17
{
15
18
@( ((GriddlyHtmlButton )Model ).HtmlTemplate (Model ))
@@ -20,6 +23,8 @@ else if (!Model.Buttons.Any())
20
23
}
21
24
else
22
25
{
26
+ if (! isListOnly )
27
+ {
23
28
< div class = " btn-group" >
24
29
@RenderLink (Model , true , false )
25
30
@if (Model .DropdownCaret == GriddlyDropdownCaret .Split )
29
34
< / button >
30
35
}
31
36
< ul class = " dropdown-menu @(Model.AlignRight ? " pull - right " : " " )" >
32
- @foreach ( GriddlyButton button in Model .Buttons )
33
- {
34
- if (button is GriddlyHtmlButton )
35
- {
36
- < li class = " @(!button.Enabled || button.EnableOnSelection == true ? " disabled " : null)" @Html .AttributeIf (" data-enable-on-selection" , button .EnableOnSelection , button .EnableOnSelection .ToString ().ToLower ())> @(((GriddlyHtmlButton )button ).HtmlTemplate (button ))< / li >
37
- }
38
- else if (! button .IsSeparator )
39
- {
40
- <li class =" @(!button.Enabled || button.EnableOnSelection == true ? " disabled " : null)" @Html.AttributeIf( " data-enable-on-selection" , button.EnableOnSelection, button.EnableOnSelection.ToString().ToLower()) >@RenderLink(button , false , true )</li >
41
- }
42
- else
43
- {
44
- <li class =" divider" ></li >
45
- }
46
- }
37
+ @RenderList ()
47
38
< / ul >
48
39
< / div >
40
+ }
41
+ else
42
+ {
43
+ @RenderList()
44
+ }
49
45
}
50
46
51
47
@helper RenderLink(GriddlyButton button, bool isDropdown, bool isMenuItem)
@@ -111,4 +107,23 @@ else
111
107
<span class =" caret" ></span >
112
108
}
113
109
</a >
110
+ }
111
+
112
+ @helper RenderList()
113
+ {
114
+ foreach (GriddlyButton button in Model .Buttons )
115
+ {
116
+ if (button is GriddlyHtmlButton )
117
+ {
118
+ < li class = " @(!button.Enabled || button.EnableOnSelection == true ? " disabled " : null)" @Html .AttributeIf (" data-enable-on-selection" , button .EnableOnSelection , button .EnableOnSelection .ToString ().ToLower ())> @(((GriddlyHtmlButton )button ).HtmlTemplate (button ))< / li >
119
+ }
120
+ else if (! button .IsSeparator )
121
+ {
122
+ <li class =" @(!button.Enabled || button.EnableOnSelection == true ? " disabled " : null)" @Html.AttributeIf( " data-enable-on-selection" , button.EnableOnSelection, button.EnableOnSelection.ToString().ToLower()) >@RenderLink(button , false , true )</li >
123
+ }
124
+ else
125
+ {
126
+ <li class =" divider" ></li >
127
+ }
128
+ }
114
129
}
0 commit comments