From 632206146263b05239ee528d5b54c9deb103f619 Mon Sep 17 00:00:00 2001 From: Mike Alhayek Date: Fri, 20 Dec 2024 09:28:19 -0800 Subject: [PATCH] Style Pager in TheTheme (#17268) --- .../TheTheme/Views/Pager.cshtml | 8 ++++++++ .../TheTheme/Views/Pager_CurrentPage.cshtml | 13 +++++++++++++ .../TheTheme/Views/Pager_First.cshtml | 18 ++++++++++++++++++ .../TheTheme/Views/Pager_Gap.cshtml | 11 +++++++++++ .../TheTheme/Views/Pager_Last.cshtml | 18 ++++++++++++++++++ .../TheTheme/Views/Pager_Link.cshtml | 13 +++++++++++++ .../TheTheme/Views/Pager_Next.cshtml | 18 ++++++++++++++++++ .../TheTheme/Views/Pager_Previous.cshtml | 18 ++++++++++++++++++ 8 files changed, 117 insertions(+) create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_CurrentPage.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_First.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_Gap.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_Last.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_Link.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_Next.cshtml create mode 100644 src/OrchardCore.Themes/TheTheme/Views/Pager_Previous.cshtml diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager.cshtml new file mode 100644 index 00000000000..80025eb8ff4 --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager.cshtml @@ -0,0 +1,8 @@ +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Links"; +} + + diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_CurrentPage.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_CurrentPage.cshtml new file mode 100644 index 00000000000..9daeed99a7c --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_CurrentPage.cshtml @@ -0,0 +1,13 @@ +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Link"; + var parentTag = Model.Tag as TagBuilder; + + if (parentTag != null) + { + parentTag.AddCssClass("active"); + parentTag.MergeAttribute("aria-current", "page"); + } +} + +@await DisplayAsync(Model) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_First.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_First.cshtml new file mode 100644 index 00000000000..16ae34eabe8 --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_First.cshtml @@ -0,0 +1,18 @@ +@using Microsoft.AspNetCore.Html + +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Link"; + var value = new HtmlContentBuilder(); + value.AppendHtml(""); + Model.Value = value; + + var parentTag = Model.Tag as TagBuilder; + + if (parentTag != null) + { + parentTag.MergeAttribute("title", T["Go to first page."].Value); + } +} + +@await DisplayAsync(Model) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_Gap.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_Gap.cshtml new file mode 100644 index 00000000000..47346bbca9c --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_Gap.cshtml @@ -0,0 +1,11 @@ +@using Microsoft.AspNetCore.Html + +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Link"; + var value = new HtmlContentBuilder(); + value.AppendHtml(""); + Model.Value = value; +} + +@await DisplayAsync(Model) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_Last.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_Last.cshtml new file mode 100644 index 00000000000..b3e7a3cfdf3 --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_Last.cshtml @@ -0,0 +1,18 @@ +@using Microsoft.AspNetCore.Html + +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Link"; + var value = new HtmlContentBuilder(); + value.AppendHtml(""); + Model.Value = value; + + var parentTag = Model.Tag as TagBuilder; + + if (parentTag != null) + { + parentTag.MergeAttribute("title", T["Go to last page."].Value); + } +} + +@await DisplayAsync(Model) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_Link.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_Link.cshtml new file mode 100644 index 00000000000..a0e1c197509 --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_Link.cshtml @@ -0,0 +1,13 @@ +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "ActionLink"; + Model.Classes.Add("page-link"); + var parentTag = Model.Tag as TagBuilder; + + if (parentTag != null) + { + parentTag.AddCssClass("page-item"); + } +} + +@await DisplayAsync(Model) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_Next.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_Next.cshtml new file mode 100644 index 00000000000..7031a4cdd9c --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_Next.cshtml @@ -0,0 +1,18 @@ +@using Microsoft.AspNetCore.Html + +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Link"; + var value = new HtmlContentBuilder(); + value.AppendHtml(""); + Model.Value = value; + + var parentTag = Model.Tag as TagBuilder; + + if (parentTag != null) + { + parentTag.MergeAttribute("title", T["Go to next page."].Value); + } +} + +@await DisplayAsync(Model) diff --git a/src/OrchardCore.Themes/TheTheme/Views/Pager_Previous.cshtml b/src/OrchardCore.Themes/TheTheme/Views/Pager_Previous.cshtml new file mode 100644 index 00000000000..5622b9e3e68 --- /dev/null +++ b/src/OrchardCore.Themes/TheTheme/Views/Pager_Previous.cshtml @@ -0,0 +1,18 @@ +@using Microsoft.AspNetCore.Html + +@{ + Model.Metadata.Alternates.Clear(); + Model.Metadata.Type = "Pager_Link"; + var value = new HtmlContentBuilder(); + value.AppendHtml(""); + Model.Value = value; + + var parentTag = Model.Tag as TagBuilder; + + if (parentTag != null) + { + parentTag.MergeAttribute("title", T["Go to previous page."].Value); + } +} + +@await DisplayAsync(Model)