From 9cc2af9cec9b2c7c699377e42eb9c24ada52dd9f Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Tue, 11 Aug 2026 18:33:16 -0400 Subject: [PATCH] Refactor vehicle views for improved formatting and note handling --- .../issues/_show_issue_view_right.html.erb | 21 ++++---- app/views/vehicles/_details.html.erb | 49 ++++++++----------- app/views/vehicles/_form.html.erb | 9 +++- .../hooks/issues_show_hook_listener.rb | 3 +- 4 files changed, 42 insertions(+), 40 deletions(-) diff --git a/app/views/issues/_show_issue_view_right.html.erb b/app/views/issues/_show_issue_view_right.html.erb index 86942f4..4301b78 100644 --- a/app/views/issues/_show_issue_view_right.html.erb +++ b/app/views/issues/_show_issue_view_right.html.erb @@ -1,17 +1,20 @@
-
<%=t(:field_vehicle)%>:
-
<%= vehicle %>
+
<%= t(:field_vehicle) %>:
+
<%= vehicle %>
-
<%=t(:field_vin)%>:
-
- -
- +
<%= t(:field_vin) %>:
+
+ +
-
<%=t(:field_notes)%>:
-
<%=notes%>
+
<%= t(:field_notes) %>:
+ <% if vehicle.present? %> +
+ <%= textilizable(@issue.vehicle, :notes) %> +
+ <% end %>
\ No newline at end of file diff --git a/app/views/vehicles/_details.html.erb b/app/views/vehicles/_details.html.erb index b46a232..4a0d24b 100644 --- a/app/views/vehicles/_details.html.erb +++ b/app/views/vehicles/_details.html.erb @@ -1,13 +1,12 @@
-

<%=t(:label_details)%>:

+

<%= t(:label_details) %>:

- - + @@ -19,39 +18,33 @@ - - - + + + +
<%= t(:field_customer)%><%= t(:field_customer) %> <%= vehicle.customer ? link_to(vehicle.customer.name, customer_path(vehicle.customer)) : t(:no_customer) %>
<%= t(:field_vin) %> -
<%= @vin[0] if @vin %><%=@vin[1] if @vin%>
+
<%= @vin[0] if @vin %><%= @vin[1] if @vin %>
<%= t(:label_trim) %><%= vehicle.doors %> <%=t(:label_door) if vehicle.doors? %> <%= vehicle.trim %>
<%= t(:label_trim) %><%= vehicle.doors %> <%= t(:label_door) if vehicle.doors? %> <%= vehicle.trim %>
-
-
- -

<%=t(:field_notes)%>:

-
-          <%= vehicle.notes %>
-        
- - - - +
+

<%= t(:field_notes) %>:

+
+
<%= t(:field_notes) %>:
+ <% if vehicle.notes.present? %> +
+ <%= textilizable(vehicle, :notes) %> +
+ <% end %> +
-<% - mileage = vehicle.last_service_mileage -%> +<% mileage = vehicle.last_service_mileage %> <% if mileage %>

@@ -61,6 +54,6 @@ <% end %>

- <%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get%> - <%= button_to t(:label_delete), vehicle, method: :delete, data: {confirm: t(:warn_ru_sure)} %> -
+ <%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get %> + <%= button_to t(:label_delete), vehicle, method: :delete, data: { confirm: t(:warn_ru_sure) } %> +
\ No newline at end of file diff --git a/app/views/vehicles/_form.html.erb b/app/views/vehicles/_form.html.erb index ce9e7e0..1cb4e54 100644 --- a/app/views/vehicles/_form.html.erb +++ b/app/views/vehicles/_form.html.erb @@ -42,7 +42,14 @@
<%=t(:field_notes)%>:
- <%= f.text_area :notes, cols: 60, rows: 10, no_label: true %> +

+ <%= f.text_area :notes, + rows: 8, + class: 'wiki-edit', + style: 'width: 95%;', + id: 'customer_appointment_description' %> + <%= wikitoolbar_for 'customer_appointment_description' %> +

diff --git a/lib/vehicles/hooks/issues_show_hook_listener.rb b/lib/vehicles/hooks/issues_show_hook_listener.rb index 4a80fa9..1f72331 100644 --- a/lib/vehicles/hooks/issues_show_hook_listener.rb +++ b/lib/vehicles/hooks/issues_show_hook_listener.rb @@ -20,8 +20,7 @@ module Vehicles partial: 'issues/show_issue_view_right', locals: { vehicle: context[:issue].vehicle ? link_to(context[:issue].vehicle) : nil, - split_vin: context[:issue].vehicle ? context[:issue].vehicle.vin.to_s.scan(/.{1,9}/) : nil, - notes: context[:issue].vehicle ? context[:issue].vehicle.notes : nil + split_vin: context[:issue].vehicle ? context[:issue].vehicle.vin.to_s.scan(/.{1,9}/) : nil } }) end