Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/web/JSE.WebApp.MVC/Controllers/CatalogoController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public async Task<IActionResult> Index([FromQuery] int ps = 8, [FromQuery] int p
{
var produtos = await _catalogoService.ObterTodos(ps, page, q);
ViewBag.Pesquisa = q;
produtos.ReferenceAction = "Index";

return View(produtos);
}
Expand Down
13 changes: 13 additions & 0 deletions src/web/JSE.WebApp.MVC/Extensions/PaginacaoViewComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using JSE.WebApp.MVC.Models;
using Microsoft.AspNetCore.Mvc;

namespace JSE.WebApp.MVC.Extensions
{
public class PaginacaoViewComponent : ViewComponent
{
public IViewComponentResult Invoke(IPagedList modelopaginado)
{
return View(modelopaginado);
}
}
}
3 changes: 3 additions & 0 deletions src/web/JSE.WebApp.MVC/Views/Catalogo/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

</div>


@* //TODO - ViewComponent de paginação *@
<nav aria-label="...">
<ul class="pagination">
@{
Expand All @@ -65,5 +67,6 @@
}
</ul>
</nav>

</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@model IPagedList

<nav aria-label="...">
<ul class="pagination">
@{
for (var i = 1; i < Model.TotalPages + 1; i++)
{
if (i == Model.PageIndex)
{
<li class="page-item active">
<a class="page-link" asp-action="@Model.ReferenceAction" asp-route-ps="@Model.PageSize" asp-route-page="@i" asp-route-q="@Model.Query">@i</a>
</li>
}
else
{
<li class="page-item">
<a class="page-link" asp-action="@Model.ReferenceAction" asp-route-ps="@Model.PageSize" asp-route-page="@i" asp-route-q="@Model.Query">@i</a>
</li>
}
}
}
</ul>
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading