From 31d952afc9d87ebfa14d03380e3cf2465319a18b Mon Sep 17 00:00:00 2001 From: nakamurakazuki Date: Mon, 15 Apr 2024 14:58:54 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=8A=E5=95=8F=E5=90=88=E3=81=9B=E4=B8=80?= =?UTF-8?q?=E8=A6=A7=E3=81=AB=E3=83=9A=E3=83=BC=E3=82=B8=E3=83=8D=E3=83=BC?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin/inquiries_controller.rb | 5 ++++- app/views/admin/inquiries/index.html.slim | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/inquiries_controller.rb b/app/controllers/admin/inquiries_controller.rb index 4049117819f..db7916b67f6 100644 --- a/app/controllers/admin/inquiries_controller.rb +++ b/app/controllers/admin/inquiries_controller.rb @@ -1,8 +1,11 @@ # frozen_string_literal: true class Admin::InquiriesController < AdminController + PAGER_NUMBER = 20 + def index - @inquiries = Inquiry.order(created_at: :desc) + per = params[:per] || PAGER_NUMBER + @inquiries = Inquiry.order(created_at: :desc).page(params[:page]).per(per) end def show diff --git a/app/views/admin/inquiries/index.html.slim b/app/views/admin/inquiries/index.html.slim index fd19de45a80..d561ae92330 100644 --- a/app/views/admin/inquiries/index.html.slim +++ b/app/views/admin/inquiries/index.html.slim @@ -19,6 +19,8 @@ hr.a-border .page-body__inner .container.is-md - if @inquiries.present? + = paginate @inquiries .card-list.a-card .card-list__items = render partial: 'inquiries_item', collection: @inquiries, as: :inquiry + = paginate @inquiries