Skip to content

Commit ca14d36

Browse files
committed
griddly-filter-display-empty class
1 parent a186d8e commit ca14d36

File tree

6 files changed

+23
-8
lines changed

6 files changed

+23
-8
lines changed

Build/CommonAssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
//
1616
// You can specify all the values or you can default the Revision and Build Numbers
1717
// by using the '*' as shown below:
18-
[assembly: AssemblyVersion("3.6.28")]
19-
[assembly: AssemblyFileVersion("3.6.28")]
18+
[assembly: AssemblyVersion("3.6.29")]
19+
[assembly: AssemblyFileVersion("3.6.29")]
2020
//[assembly: AssemblyInformationalVersion("2.5-filters")]

Griddly.Mvc/GriddlyCss.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public struct GriddlyCss
2222
public string ButtonDefault { get; set; }
2323
public GriddlyCssIcons Icons { get; set; }
2424
public bool IsBootstrap4 { get; set; }
25+
public bool InlineFilterUseFilterClass { get; set; }
2526

2627
public static GriddlyCss Bootstrap3Defaults = new GriddlyCss()
2728
{

Griddly.NetCore.Razor/Pages/Shared/Griddly/GriddlyFilterInline.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Func<(Func<dynamic, IHtmlContent> content, bool prepend), IHtmlContent> InputGro
111111
else
112112
{
113113
<a class="btn btn-xs btn-link @(filterList == null || filterList.Items.Count > 0 ? "filter-trigger" : "disabled")" href="javascript:;">
114-
<span class="griddly-filter-display">
114+
<span class="griddly-filter-display @(defaultValue == null ? "griddly-filter-display-empty" : null)">
115115
@if (filterBox != null)
116116
{
117117
if (defaultValue != null)
@@ -174,7 +174,7 @@ Func<(Func<dynamic, IHtmlContent> content, bool prepend), IHtmlContent> InputGro
174174
</span>
175175
@if (filterList == null || filterList.Items.Count > 0)
176176
{
177-
<span class="@css.Icons.CaretDown"></span>
177+
<span class="@(css.InlineFilterUseFilterClass ? css.Icons.Filter : css.Icons.CaretDown)"></span>
178178
}
179179
</a>
180180
<div class="filter-content">

Griddly.NetCore.Razor/wwwroot/js/griddly.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@
11251125

11261126
var dataType = filter.data("filter-datatype");
11271127
var display = null;
1128+
var isEmpty = false;
11281129

11291130

11301131
// TODO: shove formatted values back into boxes to ensure post is correct?
@@ -1146,6 +1147,7 @@
11461147

11471148
if (display == null)
11481149
{
1150+
isEmpty = true;
11491151
display = "Any " + filter.data("filter-name");
11501152

11511153
content.find("input").first().val("");
@@ -1168,6 +1170,7 @@
11681170

11691171
if (display == null || (dataType != "String" && display.indexOf("null") != -1))
11701172
{
1173+
isEmpty = true;
11711174
display = "All " + filter.data("filter-name-plural");
11721175

11731176
content.find("input").first().val("");
@@ -1186,8 +1189,10 @@
11861189
allItems.removeClass("griddly-filter-selected");
11871190
selectedItems.addClass("griddly-filter-selected");
11881191

1189-
if (selectedItems.length == allItems.length || (selectedItems.length == 0 && filter.data("griddly-filter-isnoneall")))
1192+
if (selectedItems.length == allItems.length || (selectedItems.length == 0 && filter.data("griddly-filter-isnoneall"))) {
1193+
isEmpty = true;
11901194
display = (allItems.length == 2 && !filter.data("griddly-filter-isnullable") ? "Both " : "All ") + filter.data("filter-name-plural");
1195+
}
11911196
else if (selectedItems.length > displayItemCount)
11921197
display = selectedItems.length + " " + filter.data("filter-name-plural");
11931198
else if (selectedItems.length > 0 && selectedItems.length <= displayItemCount)
@@ -1204,6 +1209,8 @@
12041209

12051210
if (display)
12061211
displayEl.text(display);
1212+
displayEl.toggleClass("griddly-filter-display-empty", isEmpty);
1213+
12071214
}, this));
12081215

12091216
$(".griddly-filters-inline input, .griddly-filters-inline select", this.$element).on("change", $.proxy(function (event)

Griddly/Scripts/griddly.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@
11251125

11261126
var dataType = filter.data("filter-datatype");
11271127
var display = null;
1128+
var isEmpty = false;
11281129

11291130

11301131
// TODO: shove formatted values back into boxes to ensure post is correct?
@@ -1146,6 +1147,7 @@
11461147

11471148
if (display == null)
11481149
{
1150+
isEmpty = true;
11491151
display = "Any " + filter.data("filter-name");
11501152

11511153
content.find("input").first().val("");
@@ -1168,6 +1170,7 @@
11681170

11691171
if (display == null || (dataType != "String" && display.indexOf("null") != -1))
11701172
{
1173+
isEmpty = true;
11711174
display = "All " + filter.data("filter-name-plural");
11721175

11731176
content.find("input").first().val("");
@@ -1186,8 +1189,10 @@
11861189
allItems.removeClass("griddly-filter-selected");
11871190
selectedItems.addClass("griddly-filter-selected");
11881191

1189-
if (selectedItems.length == allItems.length || (selectedItems.length == 0 && filter.data("griddly-filter-isnoneall")))
1192+
if (selectedItems.length == allItems.length || (selectedItems.length == 0 && filter.data("griddly-filter-isnoneall"))) {
1193+
isEmpty = true;
11901194
display = (allItems.length == 2 && !filter.data("griddly-filter-isnullable") ? "Both " : "All ") + filter.data("filter-name-plural");
1195+
}
11911196
else if (selectedItems.length > displayItemCount)
11921197
display = selectedItems.length + " " + filter.data("filter-name-plural");
11931198
else if (selectedItems.length > 0 && selectedItems.length <= displayItemCount)
@@ -1204,6 +1209,8 @@
12041209

12051210
if (display)
12061211
displayEl.text(display);
1212+
displayEl.toggleClass("griddly-filter-display-empty", isEmpty);
1213+
12071214
}, this));
12081215

12091216
$(".griddly-filters-inline input, .griddly-filters-inline select", this.$element).on("change", $.proxy(function (event)

Griddly/Views/Shared/Griddly/GriddlyFilterInline.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
else
4545
{
4646
<a class="btn btn-xs btn-link @(filterList == null || filterList.Items.Count > 0 ? "filter-trigger" : "disabled")" href="javascript:;">
47-
<span class="griddly-filter-display">
47+
<span class="griddly-filter-display @(defaultValue == null ? "griddly-filter-display-empty" : null)">
4848
@if (filterBox != null)
4949
{
5050
if (defaultValue != null)
@@ -107,7 +107,7 @@
107107
</span>
108108
@if (filterList == null || filterList.Items.Count > 0)
109109
{
110-
<span class="@css.Icons.CaretDown"></span>
110+
<span class="@(css.InlineFilterUseFilterClass ? css.Icons.Filter : css.Icons.CaretDown)"></span>
111111
}
112112
</a>
113113
<div class="filter-content">

0 commit comments

Comments
 (0)