Skip to content

Commit

Permalink
Fix for bottom paging next/previous buttons from losing usersearch qu…
Browse files Browse the repository at this point in the history
…erystring
  • Loading branch information
MrKevJoy committed Nov 6, 2023
1 parent 0b1fce5 commit b766b81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<govuk-pagination>
@if (Model.PreviousPage.HasValue)
{
<govuk-pagination-previous asp-page="Users" asp-all-route-data="@Model.GetPage((int)Model.PreviousPage!)" asp-route-usersearch="@Model.UserSearch" />
<govuk-pagination-previous asp-page="Users" asp-all-route-data="@Model.GetPage((int)Model.PreviousPage!)" />
}

@for (int i = 0; i < Model.PaginationPages!.Length; i++)
Expand All @@ -77,12 +77,12 @@
<govuk-pagination-ellipsis/>
}

<govuk-pagination-item asp-page="Users" asp-all-route-data=@Model.GetPage(item) is-current="@(item == Model.PageNumber)" asp-route-usersearch="@Model.UserSearch">@item</govuk-pagination-item>
<govuk-pagination-item asp-page="Users" asp-all-route-data=@Model.GetPage(item) is-current="@(item == Model.PageNumber)">@item</govuk-pagination-item>
}

@if (Model.NextPage.HasValue)
{
<govuk-pagination-next asp-page="Users" asp-all-route-data=@Model.GetPage((int)Model.NextPage!) asp-route-usersearch="@Model.UserSearch" />
<govuk-pagination-next asp-page="Users" asp-all-route-data=@Model.GetPage((int)Model.NextPage!) />
}
</govuk-pagination>
}
Expand Down Expand Up @@ -124,12 +124,12 @@
<govuk-pagination>
@if (Model.PreviousPage.HasValue)
{
<govuk-pagination-previous asp-page="Users" asp-all-route-data=@Model.GetPage((int)Model.PreviousPage!)/>
<govuk-pagination-previous asp-page="Users" asp-all-route-data=@Model.GetPage((int)Model.PreviousPage!) />
}

@if (Model.NextPage.HasValue)
{
<govuk-pagination-next asp-page="Users" asp-all-route-data=@Model.GetPage((int)Model.NextPage!)/>
<govuk-pagination-next asp-page="Users" asp-all-route-data=@Model.GetPage((int)Model.NextPage!) />
}
</govuk-pagination>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,16 @@ public Dictionary<string, string> GetPage(int pageNumber)
var pageData = new Dictionary<string, string>
{
{ "PageNumber", pageNumber.ToString() },
{ "UserSearch", UserSearch ?? "" }
};

for (var i = 0; i < LookupStatus!.Length; i++)
{
pageData.Add($"LookupStatus[{i}]", LookupStatus[i].ToString()!);
}



return pageData;
}

Expand Down

0 comments on commit b766b81

Please sign in to comment.