Refactor vehicle views for improved formatting and note handling

This commit is contained in:
2026-08-11 18:33:16 -04:00
parent 9d101fef38
commit 9cc2af9cec
4 changed files with 42 additions and 40 deletions
@@ -1,17 +1,20 @@
<div class="vehicle attribute"> <div class="vehicle attribute">
<div class="label"><%=t(:field_vehicle)%>:</div> <div class="label"><%= t(:field_vehicle) %>:</div>
<div class="value"><%= vehicle %></div> <div class="value"><%= vehicle %></div>
</div> </div>
<div class="vehicle_vin attribute"> <div class="vehicle_vin attribute">
<div class="label"><%=t(:field_vin)%>:</div> <div class="label"><%= t(:field_vin) %>:</div>
<div class="value" id="vin"> <div class="value" id="vin">
<div id="copyLink" onclick="handleCopy(event)"><%=split_vin[0] if split_vin%><b><%=split_vin[1] if split_vin%></b></div> <div id="copyLink" onclick="handleCopy(event)"><%= split_vin[0] if split_vin %><b><%= split_vin[1] if split_vin %></b></div>
</div> </div>
</div> </div>
<div class="vehicle_notes attribute"> <div class="vehicle_notes attribute">
<div class="label"><%=t(:field_notes)%>:</div> <div class="label"><%= t(:field_notes) %>:</div>
<pre class="value" id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit; "><%=notes%></pre> <% if vehicle.present? %>
<div class="value wiki">
<%= textilizable(@issue.vehicle, :notes) %>
</div>
<% end %>
</div> </div>
+19 -26
View File
@@ -1,13 +1,12 @@
<div class="issue"> <div class="issue">
<div class="splitcontent"> <div class="splitcontent">
<div class="splitcontentleft"> <div class="splitcontentleft">
<h4><%=t(:label_details)%>:</h4> <h4><%= t(:label_details) %>:</h4>
<table> <table>
<tbody> <tbody>
<tr> <tr>
<th><%= t(:field_customer)%></th> <th><%= t(:field_customer) %></th>
<td><%= vehicle.customer ? link_to(vehicle.customer.name, customer_path(vehicle.customer)) : t(:no_customer) %></td> <td><%= vehicle.customer ? link_to(vehicle.customer.name, customer_path(vehicle.customer)) : t(:no_customer) %></td>
</tr> </tr>
@@ -19,39 +18,33 @@
<tr> <tr>
<th><%= t(:field_vin) %></th> <th><%= t(:field_vin) %></th>
<td> <td>
<div onclick="handleCopy(event)"><%= @vin[0] if @vin %><b><%=@vin[1] if @vin%></b></div> <div onclick="handleCopy(event)"><%= @vin[0] if @vin %><b><%= @vin[1] if @vin %></b></div>
</td> </td>
</tr> </tr>
<th><%= t(:label_trim) %></th> <tr>
<td><%= vehicle.doors %> <%=t(:label_door) if vehicle.doors? %> <%= vehicle.trim %></td> <th><%= t(:label_trim) %></th>
<td><%= vehicle.doors %> <%= t(:label_door) if vehicle.doors? %> <%= vehicle.trim %></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="splitcontentleft"> <div class="splitcontentright">
<h4><%= t(:field_notes) %>:</h4>
<h4><%=t(:field_notes)%>:</h4> <div class="vehicle_notes attribute">
<pre id="note-display" style="text-align: left; white-space: pre-wrap; font-family: inherit; "> <div class="label"><%= t(:field_notes) %>:</div>
<td><%= vehicle.notes %></td> <% if vehicle.notes.present? %>
</pre> <div class="value wiki">
</tr> <%= textilizable(vehicle, :notes) %>
</div>
<script> <% end %>
const preElement = document.getElementById('note-display'); </div>
// This takes the text, trims the edges, and puts it back
preElement.textContent = preElement.textContent.trim();
</script>
</div> </div>
</div> </div>
</div> </div>
<% <% mileage = vehicle.last_service_mileage %>
mileage = vehicle.last_service_mileage
%>
<% if mileage %> <% if mileage %>
<p> <p>
@@ -61,6 +54,6 @@
<% end %> <% end %>
<div style="float: right;"> <div style="float: right;">
<%= button_to t(:label_edit), edit_vehicle_path(vehicle), method: :get%> <%= 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_delete), vehicle, method: :delete, data: { confirm: t(:warn_ru_sure) } %>
</div> </div>
+8 -1
View File
@@ -42,7 +42,14 @@
<div class="clearfix"> <div class="clearfix">
<%=t(:field_notes)%>: <%=t(:field_notes)%>:
<div class="input"> <div class="input">
<%= f.text_area :notes, cols: 60, rows: 10, no_label: true %> <p>
<%= f.text_area :notes,
rows: 8,
class: 'wiki-edit',
style: 'width: 95%;',
id: 'customer_appointment_description' %>
<%= wikitoolbar_for 'customer_appointment_description' %>
</p>
</div> </div>
</div> </div>
@@ -20,8 +20,7 @@ module Vehicles
partial: 'issues/show_issue_view_right', partial: 'issues/show_issue_view_right',
locals: { locals: {
vehicle: context[:issue].vehicle ? link_to(context[:issue].vehicle) : nil, 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, split_vin: context[:issue].vehicle ? context[:issue].vehicle.vin.to_s.scan(/.{1,9}/) : nil
notes: context[:issue].vehicle ? context[:issue].vehicle.notes : nil
} }
}) })
end end