add pagy, improve checks#index

This commit is contained in:
david 2024-07-21 00:33:38 +02:00
parent c44c9ccaba
commit 6d3a269231
11 changed files with 274 additions and 10 deletions

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
include Pagy::Backend
before_action :initialize_navbar
private

View file

@ -3,7 +3,7 @@ class ChecksController < ApplicationController
# GET /checks or /checks.json
def index
@checks = Check.all
@pagy, @checks = pagy(Check.search(filter_params[:s]))
end
# GET /checks/1 or /checks/1.json
@ -66,6 +66,10 @@ class ChecksController < ApplicationController
end
end
def filter_params
@filter_params ||= params.permit(filter: %i[s level])[:filter] || {}
end
private
# Use callbacks to share common setup or constraints between actions.