From 23f4a2507095378196a21eecbe4fb5dfeaa4feb4 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sun, 1 Nov 2026 17:47:25 -0500 Subject: [PATCH] =?UTF-8?q?Vehicle=20pages:=20Customers=20=C2=BB=20custome?= =?UTF-8?q?r=20=C2=BB=20vehicle=20trail,=20actions=20under=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vehicle, edit and new vehicle pages' titles are a trail through the vehicle's customer (Vehicles » vehicle when it has none), and the vehicle page's actions sit under the title like the customer page's. Co-Authored-By: Claude Opus 5.5 --- app/views/vehicles/_trail.html.erb | 9 +++++++++ app/views/vehicles/edit.html.erb | 2 +- app/views/vehicles/new.html.erb | 2 +- app/views/vehicles/show.html.erb | 9 ++++++--- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 app/views/vehicles/_trail.html.erb diff --git a/app/views/vehicles/_trail.html.erb b/app/views/vehicles/_trail.html.erb new file mode 100644 index 0000000..fa489eb --- /dev/null +++ b/app/views/vehicles/_trail.html.erb @@ -0,0 +1,9 @@ +<%# Page title: Customers » the vehicle's customer » tail (Vehicles » tail for a vehicle without a customer) %> +

+ <% if vehicle.customer %> + <%= link_to l(:label_customers), customers_path %> » <%= link_to vehicle.customer.to_s, customer_path(vehicle.customer) %> + <% else %> + <%= link_to l(:field_vehicles), vehicles_path %> + <% end %> + » <%= tail %> +

diff --git a/app/views/vehicles/edit.html.erb b/app/views/vehicles/edit.html.erb index 70b992a..85b03f9 100644 --- a/app/views/vehicles/edit.html.erb +++ b/app/views/vehicles/edit.html.erb @@ -1,4 +1,4 @@ -

<%= link_to l(:field_vehicles), vehicles_path %> » <%= link_to @vehicle.to_s, vehicle_path(@vehicle) %>

+<%= render partial: 'vehicles/trail', locals: { vehicle: @vehicle, tail: link_to(@vehicle.to_s, vehicle_path(@vehicle)) } %> <%= labelled_form_for @vehicle do |f| %> <%= render partial: 'vehicles/form', locals: { f: f } %> diff --git a/app/views/vehicles/new.html.erb b/app/views/vehicles/new.html.erb index 729ed17..479632c 100644 --- a/app/views/vehicles/new.html.erb +++ b/app/views/vehicles/new.html.erb @@ -1,4 +1,4 @@ -

<%= link_to l(:field_vehicles), vehicles_path %> » <%= l(:label_new_vehicle) %>

+<%= render partial: 'vehicles/trail', locals: { vehicle: @vehicle, tail: l(:label_new_vehicle) } %> <%= labelled_form_for @vehicle do |f| %> <%# Where to go back to, and what the vehicle is being added for (see VehiclesController#create) %> diff --git a/app/views/vehicles/show.html.erb b/app/views/vehicles/show.html.erb index 268d64b..4c5d2d6 100644 --- a/app/views/vehicles/show.html.erb +++ b/app/views/vehicles/show.html.erb @@ -1,4 +1,9 @@ -
+<% html_title @vehicle.to_s %> + +<%= render partial: 'vehicles/trail', locals: { vehicle: @vehicle, tail: @vehicle.to_s } %> + +<%# Under the title, like the customer page (redmine_qbo's qbo-under-title) %> +
<% if User.current.allowed_to?(:edit_vehicles, nil, global: true) %> <%= link_to sprite_icon('edit', l(:button_edit)), edit_vehicle_path(@vehicle), class: 'icon icon-edit', accesskey: accesskey(:edit) %> @@ -9,8 +14,6 @@ <% end %>
-

<%=t(:field_vehicle)%> #<%=@vehicle.id%>

- <% unless @vehicle.vin_decoded? %>
"> <% if @vehicle.error%>