Vehicles paged by Redmine instead of will_paginate

The vehicle search, a customer's vehicles and the customer page's vehicle list use Redmine's paginator
(will_paginate came from redmine_qbo's Gemfile, which no longer has it). The customer page's list keeps
its own page parameter, without per-page links, and lists vehicles by year, make and model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-01 17:47:25 -05:00
1 parent 53991ed087
commit d842b9b724
4 files changed
+22 -9

No files matched your search

+6 -1
View File
@@ -1,7 +1,12 @@
<% if User.current.allowed_to?(:view_vehicles, nil, global: true) %>
<h4><%=t(:field_vehicles)%>:</h4>
<%# Own page parameter so this list doesn't page together with the other lists on the customer page %>
<%= render partial: 'vehicles/list', locals: { vehicles: customer.vehicles.paginate(page: params[:vehicles_page]), show_customer: false, show_checkbox: true, page_param: :vehicles_page } %>
<% vehicle_scope = customer.vehicles.order(:year, :make, :model, :id) %>
<% vehicle_count = vehicle_scope.count %>
<% vehicle_pages = Redmine::Pagination::Paginator.new(vehicle_count, Setting.per_page_options_array.first || 25, params[:vehicles_page], :vehicles_page) %>
<%= render partial: 'vehicles/list', locals: { vehicles: vehicle_scope.limit(vehicle_pages.per_page).offset(vehicle_pages.offset).to_a,
pages: vehicle_pages, count: vehicle_count, per_page_links: false,
show_customer: false, show_checkbox: true } %>
<div style="float: right;">
<% if User.current.allowed_to?(:add_vehicles, nil, global: true) %>
<%= button_to t(:button_new_vehicle), new_customer_vehicle_path(customer), method: :get %>