{"id":19101836,"url":"https://github.com/PioneerCode/pioneer-pagination","last_synced_at":"2025-04-18T19:31:01.890Z","repository":{"id":76744847,"uuid":"67724671","full_name":"PioneerCode/pioneer-pagination","owner":"PioneerCode","description":"ASP.NET Core Tag Helper that simplifies pagination. ","archived":true,"fork":false,"pushed_at":"2020-07-29T16:51:47.000Z","size":1148,"stargazers_count":28,"open_issues_count":5,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-04T00:35:28.930Z","etag":null,"topics":["asp-net-core","pagination","paging","tag-helper"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PioneerCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-08T17:21:29.000Z","updated_at":"2024-04-30T21:33:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"3c114aee-f009-4d42-a633-a85d125e4498","html_url":"https://github.com/PioneerCode/pioneer-pagination","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PioneerCode%2Fpioneer-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PioneerCode%2Fpioneer-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PioneerCode%2Fpioneer-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PioneerCode%2Fpioneer-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PioneerCode","download_url":"https://codeload.github.com/PioneerCode/pioneer-pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783179,"owners_count":17201911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","pagination","paging","tag-helper"],"created_at":"2024-11-09T03:53:29.371Z","updated_at":"2025-04-18T19:31:01.883Z","avatar_url":"https://github.com/PioneerCode.png","language":"C#","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# Pioneer Pagination\n\n[![](https://img.shields.io/nuget/v/Pioneer.Pagination.svg)](https://www.nuget.org/packages/Pioneer.Pagination/)\n[![](https://img.shields.io/nuget/dt/Pioneer.Pagination.svg)](https://www.nuget.org/packages/Pioneer.Pagination/)\n\n\n## What is Pioneer Pagination?\nPioneer Pagination is an ASP.Net Core Tag Helper that produces a paginated list which is configured to a desired state.\n![Pagination Image](http://pioneercode.com/images/github/pioneer-pagination.png \"Pagination Image\")\n\n## Where can I get it?\nPioneer Pagination is available as a [NuGet package](https://www.nuget.org/packages/Pioneer.Pagination/). \n\n## How does it work?\n1. In your controller, you make a call to ```PaginatedMetaService``` which returns a ```PaginatedMetaModel```.\n2. Your ```PaginatedMetaModel``` is then passed to your view so that the Tag Helper can utilize it. \n3. In your view, you bind the ```PaginatedMetaModel``` to an attribute and set a route on another attribute.\n4. The Tag Helper generates a paginated list. \n\n## How do I use it?\n\nFor a full working example, clone this repository and run the [Pioneer.Pagination.Example](https://github.com/PioneerCode/pioneer-pagination/tree/master/src/Pioneer.Pagination.Example) project locally.\n\n### Install\nTo install, run the following command from your package manager console:\n```cmd\nPM\u003e Install-Package Pioneer.Pagination\n```\n\n### Gain access to the PaginatedMetaService service. \n\nIn your Startup.cs class, add ```PaginatedMetaService``` into your dependency injection container.\n```csharp\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddTransient\u003cIPaginatedMetaService, PaginatedMetaService\u003e();\n}\n```\n\nIn your controller, add a reference to the ```IPaginatedMetaService``` interface and set it through dependency injection.\n```csharp\npublic class BlogController : Controller\n{\n    private readonly IPaginatedMetaService _paginatedMetaService;\n\n    public BlogController(IPaginatedMetaService paginatedMetaService)\n    {\n        _paginatedMetaService = paginatedMetaService;\n    }\n}\n```\n\n### Add PaginatedMetaModel to ViewBag\nFrom your controller, bind the ```PaginatedMetaModel``` to your ```ViewBag```.\n```csharp\npublic ActionResult Index(int page = 1)\n{\n\t// Typically obtained from a service/repository\n    var totalNumberInCollection = 100;\n\t// Typically obtained from configuration\n    var itemsPerPage = 5;\n    ViewBag.PaginatedMeta = _paginatedMetaService.GetMetaData(totalNumberInCollection, page, itemsPerPage);\n    return View(\"Blog\", post);\n}\n```\n\n### Add Tag Helper to your view\n```csharp\n\u003cpioneer-pagination info=\"@ViewBag.PaginatedMeta\" route=\"/blog\"\u003e\u003c/pioneer-pagination\u003e\n```\n\n### Configuration\n\n- **previous-page-text**\n  - default = next\n- **previous-page-text**\n  - default = previous\n\n```csharp\n\u003cpioneer-pagination info=\"@ViewBag.PaginatedMeta\" route=\"/blog\" previous-page-text=\"hey\" next-page-text=\"you\"\u003e\u003c/pioneer-pagination\u003e\n```\n\n## What about styling?\nThe markup this produces is based on [Foundation Pagination](http://foundation.zurb.com/sites/docs/pagination.html).  This leaves you one of three options.\n\n1. Use [Foundation](http://foundation.zurb.com/sites/docs/) and it will work out of the box.\n2. Map the classes to Bootstrap stylings.\n3. Use the starting [CSS](https://github.com/PioneerCode/pioneer-pagination/blob/master/src/Pioneer.Pagination.Example/wwwroot/pioneer.pagination.css) or [sass](https://github.com/PioneerCode/pioneer-pagination/blob/master/src/Pioneer.Pagination.Example/sass/pioneer.pagination.scss) files provided in the example.\n\n## Clamping\nThe services will clamp out of range indexes passed to `_paginatedMetaService.GetMetaData`.  If you pass a current page value \u003c 1, it will be clamped to 1.\nIf you pass a current page value \u003e then the `collectionSize \\ itemsPerPage` , it will get clamped to the last valid page.\n\nBecause the aggragation of data is handled independetly of the actual tag helper, you will need to insure you are clamping the requests coming from the user in the same manner.\n\n## Change Log\n\n### [3.0]\n- Migrate to .net standard 2.1\n- Migrate example to .net core 3.1\n\n### [2.1.2]\n- Security updates. \n\n### [2.1.1]\n- Account for out of range request for a page by clamping them. \n\n### [2.1.0]\n- Add configuration for previous and next verbiage - [ryn0](https://github.com/ryn0)\n\n### [2.0.0]\n- Migarted to .NET Standard 2.x\n- Migarted example project to ASP.NET Core 2.x\n\n### [1.1.2]\n- Fixed Next button not being displayed \n\t- Next should be displayed up until last page.\n\t- Added supported UTs. \n\n### [1.1.0]\n- Upgrade to LTS 1.0.3\n- Fixed previous and next button indexing\n   - Supporting UTs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPioneerCode%2Fpioneer-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPioneerCode%2Fpioneer-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPioneerCode%2Fpioneer-pagination/lists"}