diff --git a/app/assets/stylesheets/application.tailwind.css b/app/assets/stylesheets/application.tailwind.css index 1657f66..ddae8e9 100644 --- a/app/assets/stylesheets/application.tailwind.css +++ b/app/assets/stylesheets/application.tailwind.css @@ -115,3 +115,33 @@ input[type=text], textarea { .flash-success { @apply border-green-500; } + +/* pagy */ + +.pagy-nav.pagination { + @apply isolate inline-flex -space-x-px rounded shadow-sm; +} + +.page.next a { + @apply relative inline-flex items-center rounded-r border border-gray-300 bg-white py-1 px-4 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20; +} + +.page.prev a { + @apply relative inline-flex items-center rounded-l border border-gray-300 bg-white py-1 px-4 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20; +} + +.page.next.disabled { + @apply relative inline-flex items-center rounded-r border border-gray-300 bg-slate-100 py-1 px-4 text-sm font-medium text-gray-500 focus:z-20; +} + +.page.prev.disabled { + @apply relative inline-flex items-center rounded-l border border-gray-300 bg-slate-100 py-1 px-4 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20; +} + +.page a, .page.gap { + @apply bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center border px-4 py-1 text-sm font-medium focus:z-20; +} + +.page.active { + @apply z-10 border-red-700 bg-red-50 text-red-700 relative inline-flex items-center border px-4 py-1 text-sm font-medium focus:z-20; +} diff --git a/app/controllers/saab900_controller.rb b/app/controllers/saab900_controller.rb index e780e41..07a1ed0 100644 --- a/app/controllers/saab900_controller.rb +++ b/app/controllers/saab900_controller.rb @@ -2,6 +2,6 @@ class Saab900Controller < ApplicationController include Pagy::Backend def show - @pagy, @records = pagy(Upload.published.ordered_chronologically) + @pagy, @records = pagy(Upload.published.ordered_chronologically, items: 10) end end diff --git a/app/views/uploads/_index.html.haml b/app/views/uploads/_index.html.haml index e2b0696..77cf301 100644 --- a/app/views/uploads/_index.html.haml +++ b/app/views/uploads/_index.html.haml @@ -1,12 +1,17 @@ - if records.any? - = raw pagy_nav(@pagy) if @pagy.pages > 1 + .flex.justify-center + = raw pagy_nav(@pagy) if @pagy.pages > 1 %ul.text-center - records.each do |record| %li.gallery-item = render 'uploads/file', record: record, image_size: :gallery + .flex.justify-center + = raw pagy_nav(@pagy) if @pagy.pages > 1 + + - else .text-gray-500.text-center = t('.nothing_there_yet')