Skip to content

Commit

Permalink
support X.PagedList 8.1.0 and drop .NET Framewrok support
Browse files Browse the repository at this point in the history
  • Loading branch information
lettucebo committed Jun 12, 2021
1 parent dae67e0 commit 45f6412
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 69 deletions.
8 changes: 1 addition & 7 deletions ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,4 @@ steps:
inputs:
command: test
projects: '**/*[Tt]est/*.csproj'
arguments: '--configuration $(BuildConfiguration) --no-restore'

- task: NuGetCommand@2
displayName: 'NuGet pack X.PagedList.Mvc.Bootstrap4.Core'
inputs:
command: pack
packagesToPack: 'src/X.PagedList.Mvc.Bootstrap4.Core\X.PagedList.Mvc.Bootstrap4.Core.csproj'
arguments: '--configuration $(BuildConfiguration) --no-restore'
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using X.PagedList.Mvc.Bootstrap4.Core.Example.Models;
using X.PagedList.Mvc.Bootstrap4.SampleData;

namespace X.PagedList.Mvc.Bootstrap4.Core.Example.Controllers
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace X.PagedList.Mvc.Bootstrap4.Core.Example.Models
{
public class ErrorViewModel
Expand Down
6 changes: 0 additions & 6 deletions src/X.PagedList.Mvc.Bootstrap4.Core.Example/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace X.PagedList.Mvc.Bootstrap4.Core.Example
{
Expand Down
4 changes: 0 additions & 4 deletions src/X.PagedList.Mvc.Bootstrap4.Core.Example/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@model IEnumerable<X.PagedList.Mvc.Bootstrap4.SampleData.SampleModel>
@using X.PagedList
@using X.PagedList.Mvc
@using X.PagedList.Mvc.Bootstrap4
@using X.PagedList.Mvc.Bootstrap4.Core
@using X.PagedList.Mvc.Core
@{
Expand All @@ -11,7 +9,7 @@

<hr />

@Html.Partial("_LinkPartial")
@await Html.PartialAsync("_LinkPartial")

<hr />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
@using X.PagedList.Mvc.Bootstrap4.Core
@using X.PagedList.Mvc.Core
@using X.PagedList.Web.Common
@using Microsoft.AspNetCore.Http
@{
}

<h2>Custom - IfNeeded</h2>

<hr />

@Html.Partial("_LinkPartial")
@await Html.PartialAsync("_LinkPartial")

<hr />

Expand All @@ -22,7 +21,7 @@
</form>
</div>

@Html.PagedListPager((IPagedList)Model, page => Url.Action("Custom", new { page, name = Context.Request.Query["name"] }), new Bootstrap4PagedListRenderOptions() { Display = PagedListDisplayMode.IfNeeded })
@Html.PagedListPager((IPagedList)Model, page => Url.Action("Custom", new { page, name = Context.Request.Query["name"] }), new PagedListRenderOptions() { Display = PagedListDisplayMode.IfNeeded }.ApplyBootstrap4Style())

<table class="table table-hover table-striped">
<tr>
Expand All @@ -41,4 +40,4 @@
}
</table>

@Html.PagedListPager((IPagedList)Model, page => Url.Action("Custom", new { page, name = Context.Request.Query["name"] }), new Bootstrap4PagedListRenderOptions() { Display = PagedListDisplayMode.IfNeeded })
@Html.PagedListPager((IPagedList)Model, page => Url.Action("Custom", new { page, name = Context.Request.Query["name"] }), new PagedListRenderOptions() { Display = PagedListDisplayMode.IfNeeded }.ApplyBootstrap4Style())
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<hr />

@Html.Partial("_LinkPartial")
@await Html.PartialAsync("_LinkPartial")

<hr />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@model IEnumerable<X.PagedList.Mvc.Bootstrap4.SampleData.SampleModel>
@using X.PagedList
@using X.PagedList.Mvc
@using X.PagedList.Mvc.Bootstrap4
@using X.PagedList.Mvc.Bootstrap4.Core
@using X.PagedList.Mvc.Core
@{
Expand All @@ -11,7 +9,7 @@

<hr />

@Html.Partial("_LinkPartial")
@await Html.PartialAsync("_LinkPartial")

<hr />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<hr />

@Html.Partial("_LinkPartial")
@await Html.PartialAsync("_LinkPartial")

<hr />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@model IEnumerable<X.PagedList.Mvc.Bootstrap4.SampleData.SampleModel>
@using X.PagedList
@using X.PagedList.Mvc
@using X.PagedList.Mvc.Bootstrap4
@using X.PagedList.Mvc.Bootstrap4.Core
@using X.PagedList.Mvc.Core
@{
Expand All @@ -11,7 +9,7 @@

<hr />

@Html.Partial("_LinkPartial")
@await Html.PartialAsync("_LinkPartial")

<hr />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
<script src="~/lib/jquery/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@RenderSection("Scripts", required: false)
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="X.PagedList.Mvc.Core" Version="8.0.7" />
<PackageReference Include="X.PagedList.Mvc.Core" Version="8.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
using System.Runtime.CompilerServices;
using X.PagedList.Web.Common;
using X.PagedList.Web.Common;

namespace X.PagedList.Mvc.Bootstrap4.Core
{
public class Bootstrap4PagedListRenderOptions : PagedListRenderOptionsBase
/// <summary>
/// Some built-in bootstrap4 <see cref="PagedListRenderOptions"/>
/// </summary>
public class Bootstrap4PagedListRenderOptions
{

public Bootstrap4PagedListRenderOptions()
{
LiElementClasses = new[] { "page-item" };
PageClasses = new[] { "page-link" };

// Due to no way change Ellipses element class, try setting EllipsesElementClass but fail, so disable Ellipses
DisplayEllipsesWhenNotShowingAllPageNumbers = false;
}

private static PagedListRenderOptionsBase GetCommonSetting()
private static PagedListRenderOptions GetCommonSetting()
{
var option = new PagedListRenderOptionsBase()
var option = new PagedListRenderOptions()
{
LiElementClasses = new[] { "page-item" },
PageClasses = new[] { "page-link" },
Expand All @@ -28,7 +20,7 @@ private static PagedListRenderOptionsBase GetCommonSetting()
return option;
}

public static PagedListRenderOptionsBase Default
public static PagedListRenderOptions Default
{
get
{
Expand All @@ -43,7 +35,7 @@ public static PagedListRenderOptionsBase Default
}
}

public new static PagedListRenderOptionsBase ClassicPlusFirstAndLast
public static PagedListRenderOptions ClassicPlusFirstAndLast
{
get
{
Expand All @@ -58,7 +50,7 @@ public new static PagedListRenderOptionsBase ClassicPlusFirstAndLast
}
}

public new static PagedListRenderOptionsBase Classic
public static PagedListRenderOptions Classic
{
get
{
Expand All @@ -73,7 +65,7 @@ public new static PagedListRenderOptionsBase Classic
}
}

public new static PagedListRenderOptionsBase Minimal
public static PagedListRenderOptions Minimal
{
get
{
Expand All @@ -89,7 +81,7 @@ public new static PagedListRenderOptionsBase Minimal
}
}

public new static PagedListRenderOptionsBase PageNumbersOnly
public static PagedListRenderOptions PageNumbersOnly
{
get
{
Expand All @@ -105,7 +97,7 @@ public new static PagedListRenderOptionsBase PageNumbersOnly
}
}

public new static PagedListRenderOptionsBase OnlyShowFivePagesAtATime
public static PagedListRenderOptions OnlyShowFivePagesAtATime
{
get
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using X.PagedList.Web.Common;

namespace X.PagedList.Mvc.Bootstrap4.Core
{
public static class PagedListRenderOptionsExtension
{
/// <summary>
/// Set bootstrap4 style for raw <see cref="PagedListRenderOptions"/>
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public static PagedListRenderOptions ApplyBootstrap4Style(this PagedListRenderOptions options)
{
options.LiElementClasses = new[] { "page-item" };
options.PageClasses = new[] { "page-link" };

// Due to no way change Ellipses element class, try setting EllipsesElementClass but fail, so disable Ellipses
options.DisplayEllipsesWhenNotShowingAllPageNumbers = false;

return options;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>8.0.7.1</Version>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>8.1.0</Version>
<AssemblyVersion>8.1.0</AssemblyVersion>
<FileVersion>8.1.0</FileVersion>
<FileVersion>8.1.0</FileVersion>
<Authors>Money Yu</Authors>
<Description>X.PagedList.Mvc pager style for bootstrap 4</Description>
<PackageProjectUrl>https://github.com/lettucebo/X.PagedList.Mvc.Bootstrap4</PackageProjectUrl>
<PackageIconUrl>https://i.imgur.com/3xZ4Cdx.png</PackageIconUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="X.PagedList.Mvc.Core" Version="8.0.7" />
<PackageReference Include="X.PagedList.Mvc.Core" Version="8.1.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<iconUrl>$PackageIconUrl$</iconUrl>
<dependencies>
<group targetFramework=".NETStandard2.0">
<dependency id="X.PagedList.Mvc.Core" version="8.0.7" />
<dependency id="X.PagedList.Mvc.Core" version="8.1.0" />
</group>
</dependencies>
</metadata>
Expand Down

0 comments on commit 45f6412

Please sign in to comment.