Skip to content
Permalink
Browse files

Custom pagination with Bootstrap pagination

  • Loading branch information
aaronamm committed Jan 28, 2020
1 parent b10a778 commit 09a9e89b16cd512604981b727f9d10945b7c090b
@@ -224,12 +224,6 @@
<ItemGroup>
<Content Include="Views\Pager.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Pager.First.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Pager.Last.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Parts.Title-Blog.cshtml" />
</ItemGroup>
@@ -249,6 +243,12 @@
<Content Include="Styles\fontawesome-webfont.woff" />
<Content Include="Styles\fontawesome-webfont.woff2" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Pager.Link.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Pager.CurrentPage.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
@@ -0,0 +1,15 @@
@{
// Attributes of parent li
var listItemAttributes = Model.Tag.Attributes as IDictionary<string, string>;
const string classAttributeKey = "class";
if (!listItemAttributes.ContainsKey(classAttributeKey))
{
listItemAttributes.Add(classAttributeKey, null);
}

var classNames = new[] { listItemAttributes["class"], "disabled" }.Where(c => !string.IsNullOrEmpty(c));
listItemAttributes[classAttributeKey] = string.Join(" ", classNames);
}

<a class="page-link" href="#" tabindex="-1">@Model.Value.ToString()</a>

This file was deleted.

This file was deleted.

@@ -0,0 +1,8 @@
@{
Model.Classes.Add("page-link");
Model.Metadata.Alternates.Clear();
Model.Metadata.Type = "ActionLink";
}

@Display(Model)

@@ -1,26 +1,27 @@
@{
// number of page number links to show, 0 means no link, 1 means only the current page, or more accepted.
Model.Quantity = 0;

Model.PreviousText = T("Newer");
Model.NextText = T("Older");
Model.Classes.Add("group");
// Number of page number links to show, 0 means no link, 1 means only the current page, or more accepted.
Model.Quantity = 5;

Model.FirstText = T("First");
Model.LastText = T("Last");

Model.PreviousText = T("Previous");
Model.NextText = T("Next");

Model.Metadata.Alternates.Clear();

// Later, Model.Metadata.Type will be set to List type in CoreShapes.Pager_Links method
Model.Metadata.Type = "Pager_Links";

// Add classes for ul tag (List core shape)
Model.Classes.Add("pagination");
Model.Classes.Add("justify-content-center");

// Add class for li tag (List core shape)
Model.ItemClasses = new List<string>() { "page-item" };
}

<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
<nav>
@Display(Model)
</nav>

@*Display(Model)*@

0 comments on commit 09a9e89

Please sign in to comment.
You can’t perform that action at this time.