Skip to content

Commit

Permalink
Merge pull request #7680 from fjordllc/feature/inquiry-pagination
Browse files Browse the repository at this point in the history
お問合せ一覧にページネーションを追加した
  • Loading branch information
komagata authored May 1, 2024
2 parents c1b543c + 31d952a commit 37d3dc3
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 37d3dc3

Please sign in to comment.