mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-11-18 02:40:37 -05:00
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>
15 lines
1.0 KiB
ERB
15 lines
1.0 KiB
ERB
<% 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 %>
|
|
<% 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 %>
|
|
<% end %>
|
|
</div>
|
|
<% end %> |