Updated all current Models to include Pagination for index views.

This commit is contained in:
Ben 2024-01-30 00:04:20 -06:00
parent d5e19f561e
commit 66aaeb4ed6
7 changed files with 8 additions and 5 deletions

View File

@ -3,7 +3,7 @@ class EmployersController < ApplicationController
# GET /employers # GET /employers
def index 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 end
# GET /employers/:id # GET /employers/:id

View File

@ -3,7 +3,6 @@ class ParticipantsController < ApplicationController
def index def index
@participants = Participant.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed @participants = Participant.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed
end end

View File

@ -1,6 +1,6 @@
class VendorsController < ApplicationController class VendorsController < ApplicationController
def index def index
@vendors = Vendor.all @vendors = Vendor.order(:name).page(params[:page]).per(5) # Adjust the number per page as needed
end end
def show def show

View File

@ -1,6 +1,6 @@
class WorkersController < ApplicationController class WorkersController < ApplicationController
def index def index
@workers = Worker.all @workers = Worker.order(:last_name).page(params[:page]).per(5) # Adjust the number per page as needed
end end
def show def show

View File

@ -5,7 +5,7 @@
<%= link_to 'New Employer', new_employer_path, class: 'btn btn-dark mb-3' %> <%= link_to 'New Employer', new_employer_path, class: 'btn btn-dark mb-3' %>
</div> </div>
<%= paginate @employers %>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="table-light"> <thead class="table-light">

View File

@ -5,6 +5,8 @@
<%= link_to 'New Vendor', new_vendor_path, class: 'btn btn-dark mb-3' %> <%= link_to 'New Vendor', new_vendor_path, class: 'btn btn-dark mb-3' %>
</div> </div>
<%= paginate @vendors %>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>

View File

@ -5,6 +5,8 @@
<%= link_to 'New Worker', new_worker_path, class: 'btn btn-dark mb-3' %> <%= link_to 'New Worker', new_worker_path, class: 'btn btn-dark mb-3' %>
</div> </div>
<%= paginate @workers %>
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead class="table-light"> <thead class="table-light">
<tr> <tr>