Skip to content

Commit 5cb6634

Browse files
committed
Nuget package to support netcoreapp3.1
1 parent 3087fc0 commit 5cb6634

27 files changed

+1111
-1043
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.5.1")]
19-
[assembly: AssemblyFileVersion("3.5.1")]
18+
[assembly: AssemblyVersion("3.6.0")]
19+
[assembly: AssemblyFileVersion("3.6.0")]
2020
//[assembly: AssemblyInformationalVersion("2.5-filters")]

Build/Griddly.nuspec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<license type="expression">MIT</license>
1212
<description>Pagable, sortable, MVC enabled grid</description>
1313
<language>en-US</language>
14-
<dependencies>
14+
<dependencies>
1515
<group>
1616
<dependency id="Griddly.Core" version="" />
1717
</group>
1818
</dependencies>
19+
<frameworkAssemblies>
20+
<frameworkAssembly assemblyName="Griddly.NetCore.Razor" targetFramework=".NETCoreApp3.1" />
21+
<frameworkAssembly assemblyName="Griddly.NetCore.Razor.Views" targetFramework=".NETCoreApp3.1" />
22+
</frameworkAssemblies>
1923
</metadata>
20-
</package>
24+
</package>

Build/build.proj

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@
2323
<RemoveDir Directories="$(BaseDir)\Griddly\obj" />
2424

2525
<ItemGroup>
26-
<Libs Include="$(BaseDir)\Griddly.Mvc\bin\$(Configuration)\net45\Griddly.Mvc.dll" />
27-
<Content Include="$(BaseDir)\Griddly\**\griddly.js" />
26+
<!--net45 items-->
27+
<Content Include="$(BaseDir)\Griddly\**\griddly.js" />
2828
<Content Include="$(BaseDir)\Griddly\**\griddly.css" />
2929
<Content Include="$(BaseDir)\Griddly\**\Views\Shared\Griddly\*.*" />
30-
</ItemGroup>
30+
<Libs Include="$(BaseDir)\Griddly.Mvc\bin\$(Configuration)\net45\Griddly.Mvc.dll" />
31+
32+
<!--coreapp items-->
33+
<LibsCoreApp Include="$(BaseDir)\Griddly.Mvc\bin\$(Configuration)\netcoreapp3.1\Griddly.Mvc.dll" />
34+
<LibsCoreAppRazor Include="$(BaseDir)\Griddly.NetCore.Razor\bin\$(Configuration)\netcoreapp3.1\Griddly.NetCore.Razor*.dll" />
35+
<ContentCoreApp Include="$(BaseDir)\Griddly.NetCore.Razor\wwwroot\**\*.*" />
36+
<BuildCoreApp Include="$(BaseDir)\Build\props\**\*.props" />
37+
</ItemGroup>
3138

3239
<Exec Command="rd $(PackageDir) /s /q" />
3340
<RemoveDir Directories="$(PackageDir)" />
@@ -39,8 +46,12 @@
3946
<Copy SourceFiles="$(MSBuildProjectDirectory)\Griddly.Core.nuspec" DestinationFolder="$(PackageDir)\Griddly.Core" />
4047

4148
<!-- Copy the source files to the package dir -->
42-
<Copy SourceFiles="@(Content)" DestinationFolder="$(PackageDir)\Griddly\content\%(RecursiveDir)" />
43-
<Copy SourceFiles="@(Libs)" DestinationFolder="$(PackageDir)\Griddly.Core\lib\net45\%(RecursiveDir)" />
49+
<Copy SourceFiles="@(Content)" DestinationFolder="$(PackageDir)\Griddly\content\net45\%(RecursiveDir)" />
50+
<Copy SourceFiles="@(Libs)" DestinationFolder="$(PackageDir)\Griddly.Core\lib\net45\%(RecursiveDir)" />
51+
<Copy SourceFiles="@(ContentCoreApp)" DestinationFolder="$(PackageDir)\Griddly\staticwebassets\%(RecursiveDir)" />
52+
<Copy SourceFiles="@(LibsCoreApp)" DestinationFolder="$(PackageDir)\Griddly.Core\lib\netcoreapp3.1\%(RecursiveDir)" />
53+
<Copy SourceFiles="@(LibsCoreAppRazor)" DestinationFolder="$(PackageDir)\Griddly\lib\netcoreapp3.1\%(RecursiveDir)" />
54+
<Copy SourceFiles="@(BuildCoreApp)" DestinationFolder="$(PackageDir)\Griddly\%(RecursiveDir)" />
4455

4556
<!-- Get the version number of the main assembly to insert into the nuspec files -->
4657
<GetAssemblyIdentity AssemblyFiles="$(PackageDir)\Griddly.Core\lib\net45\Griddly.Mvc.dll">

Build/props/build/Griddly.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project>
2+
<ItemGroup>
3+
<StaticWebAsset Include="$(MSBuildThisFileDirectory)..\staticwebassets\**">
4+
<SourceType>Package</SourceType>
5+
<SourceId>Griddly</SourceId>
6+
<ContentRoot>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)..\staticwebassets'))</ContentRoot>
7+
<BasePath>/Griddly</BasePath>
8+
<RelativePath>%(RecursiveDir)%(FileName)%(Extension)</RelativePath>
9+
</StaticWebAsset>
10+
</ItemGroup>
11+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="..\build\Griddly.props" />
3+
</Project>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="..\build\Griddly.props" />
3+
</Project>

Griddly.Mvc/GriddlyExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public static async Task<IHtmlContent> Griddly(this IHtmlHelper htmlHelper, Grid
171171
#if NET45
172172
return htmlHelper.Partial("~/Views/Shared/Griddly/Griddly.cshtml", viewData);
173173
#else
174-
return await htmlHelper.PartialAsync("~/Views/Shared/Griddly/Griddly.cshtml", model, viewData);
174+
return await htmlHelper.PartialAsync("~/Pages/Shared/Griddly/Griddly.cshtml", model, viewData);
175175
#endif
176176
}
177177
else
@@ -190,7 +190,7 @@ public static MvcHtmlString GriddlyFilterBar(this HtmlHelper htmlHelper, Griddly
190190
#else
191191
public static async Task<IHtmlContent> GriddlyFilterBar(this IHtmlHelper htmlHelper, GriddlyFilterBarSettings settings)
192192
{
193-
return await htmlHelper.PartialAsync("~/Views/Shared/Griddly/GriddlyFilterBar.cshtml", settings, null);
193+
return await htmlHelper.PartialAsync("~/Pages/Shared/Griddly/GriddlyFilterBar.cshtml", settings, null);
194194
}
195195
#endif
196196

Griddly.Mvc/GriddlySettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,14 @@ public abstract class GriddlySettings : IGriddlyFilterSettings
3535
public static bool IsBootstrap4 => DefaultCss.IsBootstrap4;
3636
#endregion
3737

38+
#if NET45
3839
public static string ButtonTemplate = "~/Views/Shared/Griddly/BootstrapButton.cshtml";
3940
public static string ButtonListTemplate = "~/Views/Shared/Griddly/ButtonStrip.cshtml";
41+
#else
42+
public static string ButtonTemplate = "~/Pages/Shared/Griddly/BootstrapButton.cshtml";
43+
public static string ButtonListTemplate = "~/Pages/Shared/Griddly/ButtonStrip.cshtml";
44+
#endif
45+
4046
public static HtmlString DefaultBoolTrueHtml = null;
4147
public static HtmlString DefaultBoolFalseHtml = null;
4248
public static string ColumnLinkTemplate { get; set; } = "<a href=\"{0}\">{1}</a>";
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<OutputType>Library</OutputType>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\Griddly.Mvc\Griddly.Mvc.csproj" />
10+
</ItemGroup>
11+
12+
</Project>
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
@*
2+
* GriddlyButton renderer using Bootstrap html and styles
3+
* http://griddly.com
4+
* Copyright 2013-2021 Chris Hynes and Data Research Group, Inc.
5+
* Licensed under MIT (https://github.com/programcsharp/griddly/blob/master/LICENSE)
6+
*
7+
* WARNING: Don't edit this file -- it'll be overwitten when you upgrade.
8+
* Use the static properties on GriddlySettings to make config changes.
9+
*
10+
*@
11+
@using Griddly.Mvc
12+
@using Microsoft.AspNetCore.Html;
13+
@model GriddlyButton
14+
@{
15+
bool isListOnly = ViewBag.IsListOnly == true;
16+
var css = (GriddlyCss?)ViewBag.GriddlyCss ?? GriddlySettings.DefaultCss;
17+
18+
Func<(GriddlyButton button, bool isDropdown, bool isMenuItem), IHtmlContent> RenderLink = @<text>@{
19+
20+
var button = item.button;
21+
22+
if (button.ArgumentTemplate != null)
23+
{
24+
button.Argument = button.ArgumentTemplate(ViewData["ResolveContext"]).ToString();
25+
}
26+
27+
string href = null;
28+
if (button.Action != GriddlyButtonAction.Modal && (button.Action != GriddlyButtonAction.Navigate || (item.isDropdown && button.DropdownCaret != GriddlyDropdownCaret.Split)))
29+
{
30+
href = "javascript:;";
31+
}
32+
else if ((button.Action == GriddlyButtonAction.Navigate && (!item.isDropdown || button.DropdownCaret == GriddlyDropdownCaret.Split)) || (button.Action == GriddlyButtonAction.Modal && !string.IsNullOrWhiteSpace(button.Target)))
33+
{
34+
href = button.Argument;
35+
}
36+
else if (button.Action == GriddlyButtonAction.Modal && string.IsNullOrWhiteSpace(button.Target))
37+
{
38+
href = "#" + button.Argument;
39+
}
40+
41+
bool clearSelectionOnAction = button.ClearSelectionOnAction ?? (button.Action == GriddlyButtonAction.Ajax || button.Action == GriddlyButtonAction.AjaxBulk);
42+
43+
<a data-role="griddly-button" class="@(!item.isMenuItem ? css.ButtonDefault : null) @button.ClassName @(item.isDropdown && button.DropdownCaret != GriddlyDropdownCaret.Split ? "dropdown-toggle" : null) @(!button.Enabled || button.EnableOnSelection == true ? "disabled" : null) @(!string.IsNullOrWhiteSpace(button.Icon) ? "btn-with-icon" : null) @(item.isMenuItem && css.IsBootstrap4 ? "dropdown-item" : null)"
44+
@*onclick="@(button.Action == GriddlyButtonAction.Javascript ? button.Argument : null)"*@
45+
title="@button.Title"
46+
@Html.AttributeIf("target", button.Action == GriddlyButtonAction.Navigate && !string.IsNullOrWhiteSpace(button.Target), button.Target)
47+
href="@(href ?? "javscript:void()")"
48+
@Html.AttributeIf("data-toggle", button.Action != GriddlyButtonAction.Navigate && button.Action != GriddlyButtonAction.Javascript, button.Action.ToString().ToLower())
49+
@Html.AttributeIf("data-toggle", item.isDropdown && button.DropdownCaret != GriddlyDropdownCaret.Split, "dropdown")
50+
@Html.AttributeIf("data-onclick", button.Action == GriddlyButtonAction.Javascript && !string.IsNullOrWhiteSpace(button.Argument), button.Argument)
51+
@Html.AttributeIf("data-url", button.Action == GriddlyButtonAction.Ajax || button.Action == GriddlyButtonAction.AjaxBulk || button.Action == GriddlyButtonAction.Post || button.Action == GriddlyButtonAction.PostCriteria, button.Argument)
52+
@Html.AttributeIf("data-target", button.Action != GriddlyButtonAction.Navigate && !string.IsNullOrWhiteSpace(button.Target), button.Target)
53+
@Html.AttributeIf("data-enable-on-selection", button.EnableOnSelection, button.EnableOnSelection.ToString().ToLower())
54+
@Html.AttributeIf("data-clear-selection-on-action", clearSelectionOnAction, clearSelectionOnAction.ToString().ToLower())
55+
@Html.AttributeIf("data-confirm-message", button.ConfirmMessage != null, button.ConfirmMessage)
56+
@Html.AttributeIf("data-confirm-prompt-function", button.ConfirmPromptFunction != null, button.ConfirmPromptFunction)
57+
@Html.AttributeIf("data-rowids", button.RowIds != null, button.RowIds != null ? Html.Encode(Json.Serialize(button.RowIds.Select(x => x.ToLower()).ToArray())) : null)
58+
@Html.AttributeIf("data-append-rowids-to-url", (button.Action == GriddlyButtonAction.Modal || button.Action == GriddlyButtonAction.Navigate) && button.AppendRowIdsToUrl, "")
59+
@if (button.HtmlAttributes != null) { foreach (var attr in button.HtmlAttributes) { <text> @attr.Key="@attr.Value" </text> } }>
60+
61+
@if (!string.IsNullOrWhiteSpace(button.Icon) && GriddlySettings.IconTemplate != null)
62+
{
63+
@GriddlySettings.IconTemplate(button)
64+
}
65+
66+
@if (button.TextTemplate != null)
67+
{
68+
@button.TextTemplate(button)
69+
}
70+
@button.Text
71+
72+
@if (item.isDropdown && button.DropdownCaret == GriddlyDropdownCaret.Inline && !css.IsBootstrap4)
73+
{
74+
<span class="@css.Icons.CaretDown"></span>
75+
}
76+
</a>
77+
}</text>;
78+
79+
Func<List<GriddlyButton>, IHtmlContent> RenderList = @<text>@{
80+
foreach (GriddlyButton button in item)
81+
{
82+
if (css.IsBootstrap4)
83+
{
84+
if (button.IsSeparator)
85+
{
86+
<div class="dropdown-divider"></div>
87+
}
88+
else if (button is GriddlyHtmlButton)
89+
{@(((GriddlyHtmlButton)button).HtmlTemplate(button))}
90+
else
91+
{@RenderLink((button, false, true))}
92+
}
93+
else
94+
{
95+
if (button.IsSeparator)
96+
{
97+
<li class="divider"></li>
98+
}
99+
else
100+
{
101+
<li class="@(!button.Enabled || button.EnableOnSelection == true ? "disabled" : null)" @Html.AttributeIf("data-enable-on-selection", button.EnableOnSelection, button.EnableOnSelection.ToString().ToLower())>
102+
@if (button is GriddlyHtmlButton)
103+
{@(((GriddlyHtmlButton)button).HtmlTemplate(button))}
104+
else
105+
{@RenderLink((button, false, true))}
106+
</li>
107+
}
108+
}
109+
}
110+
}</text>;
111+
}
112+
113+
@if (Model is GriddlyHtmlButton)
114+
{
115+
@(((GriddlyHtmlButton)Model).HtmlTemplate(Model))
116+
}
117+
else if (!Model.Buttons.Any())
118+
{
119+
@RenderLink((Model, false, false))
120+
}
121+
else
122+
{
123+
if (!isListOnly)
124+
{
125+
<div class="btn-group">
126+
@RenderLink((Model, true, false))
127+
@if (Model.DropdownCaret == GriddlyDropdownCaret.Split)
128+
{
129+
<button type="button" class="dropdown-toggle dropdown-toggle-split @css.ButtonDefault" data-toggle="dropdown">
130+
@if (!css.IsBootstrap4)
131+
{
132+
<span class="@css.Icons.CaretDown"></span>
133+
}
134+
</button>
135+
}
136+
@if (css.IsBootstrap4)
137+
{
138+
<div class="dropdown-menu @(Model.AlignRight ? "dropdown-menu-right float-right" : "")">
139+
@RenderList(Model.Buttons)
140+
</div>
141+
}
142+
else
143+
{
144+
<ul class="dropdown-menu @(Model.AlignRight ? "pull-right" : "")">
145+
@RenderList(Model.Buttons)
146+
</ul>
147+
}
148+
</div>
149+
}
150+
else
151+
{
152+
@RenderList(Model.Buttons)
153+
}
154+
}

0 commit comments

Comments
 (0)