Ruby on Rails #157 Calendar Pagination with gem Pagy

21/01/2024 (4 months ago)
calendar pagination pagy

We are all used to pagination by clicking a prev or next page link.

But what if we could paginate by year/month/day?

Some time ago I asked Domizio Demichelis (@ddnexus), the creator of Pagy gem, this question. And it resulted in the creation of Pagy::Calendar!

Let's explore how we can add calendar pagination to our app and make it useable.

Episode source code: https://github.com/corsego/157-pagy-calendar/commit/008a13dee887e57a5d6b8c81240950677adf9020
Based on this blogpost: https://blog.corsego.com/pagy-calendar-pagination

0:00 Calendar pagination demo
02:20 Install Pagy Calendar
6:58 Tailwind styling
7:56 Paginate by year/month/week/day
11:08 Toggle calendar and normal pagination
12:58 Create an event for current date
17:04 Fix bug with max year being wrong
19:25 redirect back to page in calendar
22:11 link to Today


0
Sign in to join the conversation