From 9583bf52a8fb9c82828a688c803af4e9b101e237 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 23:16:23 -0400 Subject: [PATCH] Vehicle new/edit pages in Redmine's form style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - labelled_form_for with a "box tabular" form, like core Redmine forms: labels on the left, required fields (customer, VIN) marked with * - Breadcrumb headings ("Vehicles ยป vehicle"), Create/Save buttons and a Cancel link (back to the vehicle, or the customer for new vehicles) - Field order: customer, VIN, year, make, model, notes; the VIN field is limited to 17 characters and keeps focus - Keeps redmine_qbo's customer autocomplete and the duplicate-VIN link Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM --- app/views/vehicles/_form.html.erb | 92 ++++++++----------------------- app/views/vehicles/edit.html.erb | 12 +++- app/views/vehicles/new.html.erb | 12 +++- 3 files changed, 41 insertions(+), 75 deletions(-) diff --git a/app/views/vehicles/_form.html.erb b/app/views/vehicles/_form.html.erb index 2bb9784..954ca9e 100644 --- a/app/views/vehicles/_form.html.erb +++ b/app/views/vehicles/_form.html.erb @@ -1,72 +1,26 @@ -
-
-
+<%= error_messages_for 'vehicle' %> - <%= form_for @vehicle do |f| %> - <%= error_messages_for 'vehicle' %> - - <% if @existing_vehicle %> -

- <%= l(:text_vin_already_on_file) %> - <%= link_to @existing_vehicle.to_s, vehicle_path(@existing_vehicle) %> -

- <% end %> - -
- <%=t(:field_customer)%>: -
- <%= f.text_field :customer, class: "customer-name", autocomplete: "off", value: @vehicle.customer&.name, required: true,data: { autocomplete_url: "/customers/autocomplete" } %> - <%= f.hidden_field :customer_id, id: "customer_id" %> -
-
- -
- <%=t(:label_year)%>: -
- <%= f.number_field :year, autocomplete: "off" %> -
-
- -
- <%=t(:label_make)%>: -
- <%= f.text_field :make, autocomplete: "off" %> -
-
- -
- <%=t(:label_model)%>: -
- <%= f.text_field :model, autocomplete: "off" %> -
-
- -
- <%=t(:field_vin)%>: -
- <%= f.text_field :vin , autofocus: true %> -
-
- -
- <%=t(:field_notes)%>: -
-

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

-
-
- -
- <%= f.submit %> -
- <% end %> - -
+<% if @existing_vehicle %> +
+ <%= l(:text_vin_already_on_file) %> + <%= link_to @existing_vehicle.to_s, vehicle_path(@existing_vehicle) %>
+<% end %> + +
+

+ <%# Customer autocomplete from redmine_qbo: fills the hidden customer_id %> + <%= f.text_field :customer, label: :field_customer, required: true, size: 60, + value: @vehicle.customer&.name, class: 'customer-name', autocomplete: 'off', + data: { autocomplete_url: '/customers/autocomplete' } %> + <%= f.hidden_field :customer_id, id: 'customer_id' %> +

+

<%= f.text_field :vin, label: :field_vin, required: true, size: 20, maxlength: 17, autofocus: true %>

+

<%= f.number_field :year, label: :label_year, min: 1900, max: Date.today.year + 2, autocomplete: 'off' %>

+

<%= f.text_field :make, label: :label_make, size: 30, autocomplete: 'off' %>

+

<%= f.text_field :model, label: :label_model, size: 30, autocomplete: 'off' %>

+

+ <%= f.text_area :notes, label: :field_notes, rows: 8, class: 'wiki-edit', id: 'vehicle_notes' %> + <%= wikitoolbar_for 'vehicle_notes' %> +

diff --git a/app/views/vehicles/edit.html.erb b/app/views/vehicles/edit.html.erb index 7803874..70b992a 100644 --- a/app/views/vehicles/edit.html.erb +++ b/app/views/vehicles/edit.html.erb @@ -1,3 +1,9 @@ -

<%=t(:label_edit_customer_vehicle)%>

-
-<%= render partial: 'vehicles/form' %> +

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

+ +<%= labelled_form_for @vehicle do |f| %> + <%= render partial: 'vehicles/form', locals: { f: f } %> + <%= submit_tag l(:button_save) %> + <%= link_to l(:button_cancel), vehicle_path(@vehicle) %> +<% end %> + +<% html_title(l(:label_edit_customer_vehicle)) -%> diff --git a/app/views/vehicles/new.html.erb b/app/views/vehicles/new.html.erb index ea9c7b1..c8eed15 100644 --- a/app/views/vehicles/new.html.erb +++ b/app/views/vehicles/new.html.erb @@ -1,3 +1,9 @@ -

<%=t(:label_new_vehicle)%>

-
-<%= render partial: 'vehicles/form' %> +

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

+ +<%= labelled_form_for @vehicle do |f| %> + <%= render partial: 'vehicles/form', locals: { f: f } %> + <%= submit_tag l(:button_create) %> + <%= link_to l(:button_cancel), @vehicle.customer ? customer_path(@vehicle.customer) : vehicles_path %> +<% end %> + +<% html_title(l(:label_new_vehicle)) -%>