Files
redmine_qbo_vehicles/app/views/vehicles/_details.html.erb
T
Claude 129a9f668c VIN click-to-copy: shared snippet, last 8 bold only for 17-char VINs
- New vehicles/_vin partial used on the issue page, vehicle page and
  vehicle lists (replaces three copies of the markup, inline onclick
  handlers and a fixed id="copyLink")
- 17-character VINs show the last 8 in bold (what dealerships ask for
  when ordering parts); older or short VINs are shown plain
- Copies the VIN from a data attribute, restores the exact display
  afterwards, shows "Copied!" or "Couldn't copy", falls back when the
  Clipboard API isn't available, and supports Enter/Space; pointer
  cursor and "Click to copy" tooltip
- The copy script is written into the page by the layout hook instead
  of served as copy.js, so it can't 404 when Redmine's asset manifest
  is out of date; one listener handles every VIN on the page
- Issue PDFs split 17-character VINs before the last 8; others whole

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
2026-10-29 20:09:27 -04:00

64 lines
1.9 KiB
ERB

<div class="issue">
<div class="splitcontent">
<div class="splitcontentleft">
<h4><%= t(:label_details) %>:</h4>
<table>
<tbody>
<tr>
<th><%= t(:field_customer) %></th>
<td><%= vehicle.customer ? link_to(vehicle.customer.name, customer_path(vehicle.customer)) : t(:no_customer) %></td>
</tr>
<tr>
<th><%= t(:field_vehicle) %></th>
<td><%= vehicle.to_s %></td>
</tr>
<tr>
<th><%= t(:field_vin) %></th>
<td>
<%= render partial: 'vehicles/vin', locals: { vin: vehicle.vin } %>
</td>
</tr>
<tr>
<th><%= t(:label_trim) %></th>
<td><%= vehicle.doors %> <%= t(:label_door) if vehicle.doors? %> <%= vehicle.trim %></td>
</tr>
</tbody>
</table>
</div>
<div class="splitcontentright">
<h4><%= t(:field_notes) %>:</h4>
<div class="vehicle_notes attribute">
<div class="label"><%= t(:field_notes) %>:</div>
<% if vehicle.notes.present? %>
<div class="value wiki">
<%= textilizable(vehicle, :notes) %>
</div>
<% end %>
</div>
</div>
</div>
</div>
<% mileage = vehicle.last_service_mileage %>
<% if mileage %>
<p>
<b><%= t(:label_last_service) %></b> <%= vehicle.last_service_date %>
at <%= mileage %> <%= t(:label_miles) %>
</p>
<% end %>
<div style="float: right;">
<% if User.current.allowed_to?(:edit_vehicles, nil, global: true) %>
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get %>
<% end %>
<%# Vehicles with issues can't be deleted, to keep their service history %>
<% if User.current.allowed_to?(:delete_vehicles, nil, global: true) && !vehicle.issues.exists? %>
<%= button_to t(:label_delete), vehicle, method: :delete, data: { confirm: t(:warn_ru_sure) } %>
<% end %>
</div>