Skip to content

Commit a2bb581

Browse files
authored
Bootstrap4 (#95)
Support for Bootstrap 4
1 parent 3a6e45c commit a2bb581

19 files changed

+345
-202
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("2.9.3")]
19-
[assembly: AssemblyFileVersion("2.9.3")]
18+
[assembly: AssemblyVersion("3.0.0")]
19+
[assembly: AssemblyFileVersion("3.0.0")]
2020
//[assembly: AssemblyInformationalVersion("2.5-filters")]

Griddly.Mvc/Griddly.Mvc.csproj

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,23 @@
5858
<Reference Include="System.Core" />
5959
<Reference Include="System.Data.Entity.Design" />
6060
<Reference Include="System.Web" />
61-
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62-
<Private>True</Private>
63-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
61+
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.Helpers.dll</HintPath>
6463
</Reference>
65-
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
66-
<Private>True</Private>
67-
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
64+
<Reference Include="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65+
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.4\lib\net45\System.Web.Mvc.dll</HintPath>
6866
</Reference>
69-
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
70-
<Private>True</Private>
71-
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.20710.0\lib\net40\System.Web.Razor.dll</HintPath>
67+
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68+
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.4\lib\net45\System.Web.Razor.dll</HintPath>
7269
</Reference>
73-
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
74-
<Private>True</Private>
75-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll</HintPath>
70+
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.dll</HintPath>
7672
</Reference>
77-
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
78-
<Private>True</Private>
79-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
73+
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
74+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
8075
</Reference>
81-
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
82-
<Private>True</Private>
83-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
76+
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
77+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
8478
</Reference>
8579
<Reference Include="System.Xml.Linq" />
8680
<Reference Include="System.Data.DataSetExtensions" />

Griddly.Mvc/GriddlyExport.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,6 @@ public GriddlyExport<TRow> Column<TProperty>(Expression<Func<TRow, TProperty>> e
4343
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
4444
type = Nullable.GetUnderlyingType(type);
4545

46-
if (className == null)
47-
{
48-
if (type == typeof(byte) || type == typeof(sbyte) ||
49-
type == typeof(short) || type == typeof(ushort) ||
50-
type == typeof(int) || type == typeof(uint) ||
51-
type == typeof(long) || type == typeof(ulong) ||
52-
type == typeof(float) ||
53-
type == typeof(double) ||
54-
type == typeof(decimal))
55-
className = "align-right";
56-
else if (type == typeof(bool) ||
57-
type == typeof(DateTime) || type.HasCastOperator<DateTime>())
58-
className = "align-center";
59-
}
60-
6146
if (caption == null)
6247
caption = metadata.DisplayName ?? metadata.PropertyName ?? htmlFieldName.Split('.').Last();
6348

Griddly.Mvc/GriddlySelectColumn.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class GriddlySelectColumn : GriddlyColumn
1414

1515
public GriddlySelectColumn()
1616
{
17-
ClassName = "griddly-select align-center";
17+
ClassName = $"griddly-select {GriddlySettings.Css.TextCenter}";
1818
}
1919

2020
public virtual IDictionary<string, object> GenerateInputHtmlAttributes(object row)

Griddly.Mvc/GriddlySettings.cs

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,35 @@ namespace Griddly.Mvc
1212
{
1313
public abstract class GriddlySettings: IGriddlyFilterSettings
1414
{
15-
public static string DefaultClassName = null;
16-
public static string DefaultTableClassName = "table table-bordered table-hover";
17-
public static string DefaultButtonClassName = null;
15+
public static class Css
16+
{
17+
public static string TextCenter = "text-center";
18+
public static string TextRight = "text-right";
19+
public static string FloatRight = "pull-right";
20+
public static string GriddlyDefault = null;
21+
public static string TableDefault = "table table-bordered table-hover";
22+
public static string ButtonDefault = "btn btn-default";
23+
24+
public static class Icons
25+
{
26+
public static string Calendar = "glyphicon glyphicon-calendar";
27+
public static string Remove = "glyphicon glyphicon-remove";
28+
public static string ListMultipleSelected = "glyphicon glyphicon-ok";
29+
public static string ListSingleSelected = "glyphicon glyphicon-record";
30+
public static string Check = "glyphicon glyphicon-check";
31+
public static string Filter = "glyphicon glyphicon-filter";
32+
public static string Clear = "glyphicon glyphicon-ban-circle";
33+
public static string CaretDown = "caret";
34+
}
35+
}
36+
37+
[Obsolete("Use GriddlySettings.Css.GriddlyDefault")]
38+
public static string DefaultClassName { get => Css.GriddlyDefault; set => Css.GriddlyDefault = value; }
39+
[Obsolete("Use GriddlySettings.Css.TableDefault")]
40+
public static string DefaultTableClassName { get => Css.TableDefault; set => Css.TableDefault = value; }
41+
[Obsolete("Use GriddlySettings.Css.ButtonDefault")]
42+
public static string DefaultButtonClassName { get => Css.ButtonDefault; set => Css.ButtonDefault = value; }
43+
1844
public static string ButtonTemplate = "~/Views/Shared/Griddly/BootstrapButton.cshtml";
1945
public static string ButtonListTemplate = "~/Views/Shared/Griddly/ButtonStrip.cshtml";
2046
public static HtmlString BoolTrueHtml = null;
@@ -25,6 +51,7 @@ public abstract class GriddlySettings: IGriddlyFilterSettings
2551
public static bool DefaultShowRowSelectCount = true;
2652
public static bool ExportCurrencySymbol = true;
2753
public static bool DisableHistoryParameters = false;
54+
public static bool IsBootstrap4 = false;
2855

2956
public static Func<GriddlyButton, object> IconTemplate = null;
3057
public static Func<GriddlyResultPage, object> DefaultFooterTemplate = null;
@@ -62,6 +89,24 @@ public GriddlySettings()
6289
ShowRowSelectCount = DefaultShowRowSelectCount;
6390
}
6491

92+
public static void ConfigureBoostrap4Defaults()
93+
{
94+
IsBootstrap4 = true;
95+
Css.TextCenter = "text-center";
96+
Css.TextRight = "text-right";
97+
Css.FloatRight = "float-right";
98+
Css.ButtonDefault = "btn btn-outline-secondary";
99+
100+
Css.Icons.Calendar = "fa fa-calendar-alt";
101+
Css.Icons.Remove = "fa fa-times";
102+
Css.Icons.ListMultipleSelected = "fa fa-check";
103+
Css.Icons.ListSingleSelected = "fas fa-check-circle";
104+
Css.Icons.Check = "fa fa-check-square";
105+
Css.Icons.Filter = "fa fa-filter";
106+
Css.Icons.Clear = "fa fa-ban";
107+
Css.Icons.CaretDown = "fa fa-caret-down";
108+
}
109+
65110
public string[] DefaultRowIds { get; set; }
66111
public string IdProperty { get; set; }
67112
public string Title { get; set; }
@@ -434,7 +479,7 @@ public GriddlySettings<TRow> Column<TProperty>(Expression<Func<TRow, TProperty>>
434479

435480
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
436481
type = Nullable.GetUnderlyingType(type);
437-
482+
438483
if (className == null)
439484
{
440485
if (type == typeof(byte) || type == typeof(sbyte) ||
@@ -444,10 +489,10 @@ public GriddlySettings<TRow> Column<TProperty>(Expression<Func<TRow, TProperty>>
444489
type == typeof(float) ||
445490
type == typeof(double) ||
446491
type == typeof(decimal))
447-
className = "align-right";
492+
className = Css.TextRight;
448493
else if (type == typeof(bool) ||
449494
type == typeof(DateTime) || type.HasCastOperator<DateTime>())
450-
className = "align-center";
495+
className = Css.TextCenter;
451496
}
452497

453498
if (caption == null)

Griddly.Mvc/packages.config

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<package id="CsvHelper" version="2.4.1" targetFramework="net45" />
44
<package id="Dapper" version="1.50.2" targetFramework="net45" />
55
<package id="EPPlus" version="3.1.3.3" targetFramework="net45" />
6-
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
7-
<package id="Microsoft.AspNet.Razor" version="2.0.20710.0" targetFramework="net45" />
8-
<package id="Microsoft.AspNet.WebPages" version="2.0.20710.0" targetFramework="net45" />
6+
<package id="Microsoft.AspNet.Mvc" version="5.2.4" targetFramework="net45" />
7+
<package id="Microsoft.AspNet.Razor" version="3.2.4" targetFramework="net45" />
8+
<package id="Microsoft.AspNet.WebPages" version="3.2.4" targetFramework="net45" />
99
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
1010
<package id="MSBuildTasks" version="1.4.0.65" targetFramework="net45" />
1111
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net45" />

Griddly/Content/griddly.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,24 +179,24 @@
179179
top:auto;
180180
}
181181

182-
.filter-content .dropdown-menu li a
182+
.filter-content .dropdown-menu a
183183
{
184184
padding: 3px 6px;
185185
white-space: normal;
186186
cursor: pointer
187187
}
188188

189-
.filter-content .dropdown-menu li.griddly-list-group-header
189+
.filter-content .dropdown-menu .griddly-list-group-header
190190
{
191191

192192
}
193193

194-
.filter-content .dropdown-menu li.griddly-list-group a
194+
.filter-content .dropdown-menu .griddly-list-group a
195195
{
196196
padding-left:16px;
197197
}
198198

199-
.filter-content .dropdown-menu li a input
199+
.filter-content .dropdown-menu a input
200200
{
201201
display:none
202202
}

Griddly/Griddly.csproj

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,33 +71,27 @@
7171
<Reference Include="System.ComponentModel.DataAnnotations" />
7272
<Reference Include="System.Core" />
7373
<Reference Include="System.Data.DataSetExtensions" />
74-
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75-
<Private>True</Private>
76-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll</HintPath>
74+
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
75+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.Helpers.dll</HintPath>
7776
</Reference>
78-
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
79-
<Private>True</Private>
80-
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
77+
<Reference Include="System.Web.Mvc, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
78+
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.4\lib\net45\System.Web.Mvc.dll</HintPath>
8179
</Reference>
8280
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8381
<SpecificVersion>False</SpecificVersion>
8482
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.2\lib\net40\System.Web.Optimization.dll</HintPath>
8583
</Reference>
86-
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
87-
<Private>True</Private>
88-
<HintPath>..\packages\Microsoft.AspNet.Razor.2.0.20710.0\lib\net40\System.Web.Razor.dll</HintPath>
84+
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
85+
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.4\lib\net45\System.Web.Razor.dll</HintPath>
8986
</Reference>
90-
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
91-
<Private>True</Private>
92-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll</HintPath>
87+
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
88+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.dll</HintPath>
9389
</Reference>
94-
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
95-
<Private>True</Private>
96-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll</HintPath>
90+
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
91+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
9792
</Reference>
98-
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
99-
<Private>True</Private>
100-
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll</HintPath>
93+
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
94+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.4\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
10195
</Reference>
10296
<Reference Include="System.Xml.Linq" />
10397
<Reference Include="System.Web" />

0 commit comments

Comments
 (0)