From 66aaeb4ed67ad06859424d1c2715d260a878b616 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 30 Jan 2024 00:04:20 -0600 Subject: [PATCH] Updated all current Models to include Pagination for index views. --- app/controllers/employers_controller.rb | 2 +- app/controllers/participants_controller.rb | 1 - app/controllers/vendors_controller.rb | 2 +- app/controllers/workers_controller.rb | 2 +- app/views/employers/index.html.erb | 2 +- app/views/vendors/index.html.erb | 2 ++ app/views/workers/index.html.erb | 2 ++ 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/employers_controller.rb b/app/controllers/employers_controller.rb index e8dfa31..8d46786 100644 --- a/app/controllers/employers_controller.rb +++ b/app/controllers/employers_controller.rb @@ -3,7 +3,7 @@ class EmployersController < ApplicationController # GET /employers def index - @employers = Employer.order(:last_name) + @employers = Employer.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed end # GET /employers/:id diff --git a/app/controllers/participants_controller.rb b/app/controllers/participants_controller.rb index e76a746..8016eb7 100644 --- a/app/controllers/participants_controller.rb +++ b/app/controllers/participants_controller.rb @@ -3,7 +3,6 @@ class ParticipantsController < ApplicationController def index @participants = Participant.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed - end diff --git a/app/controllers/vendors_controller.rb b/app/controllers/vendors_controller.rb index 33e83ed..8d7cbcc 100644 --- a/app/controllers/vendors_controller.rb +++ b/app/controllers/vendors_controller.rb @@ -1,6 +1,6 @@ class VendorsController < ApplicationController def index - @vendors = Vendor.all + @vendors = Vendor.order(:name).page(params[:page]).per(5) # Adjust the number per page as needed end def show diff --git a/app/controllers/workers_controller.rb b/app/controllers/workers_controller.rb index 10db428..4c0e3c8 100644 --- a/app/controllers/workers_controller.rb +++ b/app/controllers/workers_controller.rb @@ -1,6 +1,6 @@ class WorkersController < ApplicationController def index - @workers = Worker.all + @workers = Worker.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed end def show diff --git a/app/views/employers/index.html.erb b/app/views/employers/index.html.erb index c282731..32e3eac 100644 --- a/app/views/employers/index.html.erb +++ b/app/views/employers/index.html.erb @@ -5,7 +5,7 @@ <%= link_to 'New Employer', new_employer_path, class: 'btn btn-dark mb-3' %> - + <%= paginate @employers %> diff --git a/app/views/vendors/index.html.erb b/app/views/vendors/index.html.erb index 95d6619..8594c4e 100644 --- a/app/views/vendors/index.html.erb +++ b/app/views/vendors/index.html.erb @@ -5,6 +5,8 @@ <%= link_to 'New Vendor', new_vendor_path, class: 'btn btn-dark mb-3' %> + <%= paginate @vendors %> +
diff --git a/app/views/workers/index.html.erb b/app/views/workers/index.html.erb index 7237f37..40224ba 100644 --- a/app/views/workers/index.html.erb +++ b/app/views/workers/index.html.erb @@ -5,6 +5,8 @@ <%= link_to 'New Worker', new_worker_path, class: 'btn btn-dark mb-3' %> + <%= paginate @workers %> +