Skip to content

Commit

Permalink
お問合せ一覧にページネーションを追加した
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamu-kazu222 committed Apr 15, 2024
1 parent 457ac79 commit 31d952a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/admin/inquiries_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/inquiries/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 31d952a

Please sign in to comment.