mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-11-18 02:40:37 -05:00
Vehicle new/edit pages in Redmine's form style
- 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
3 files changed
+41
-75
No files matched your search
@@ -1,72 +1,26 @@
|
||||
<div class="row">
|
||||
<div class="span6 columns">
|
||||
<fieldset>
|
||||
<%= error_messages_for 'vehicle' %>
|
||||
|
||||
<%= form_for @vehicle do |f| %>
|
||||
<%= error_messages_for 'vehicle' %>
|
||||
|
||||
<% if @existing_vehicle %>
|
||||
<p class="flash warning">
|
||||
<%= l(:text_vin_already_on_file) %>
|
||||
<%= link_to @existing_vehicle.to_s, vehicle_path(@existing_vehicle) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<div class="clearfix">
|
||||
<%=t(:field_customer)%>:
|
||||
<div class="input">
|
||||
<%= 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" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<%=t(:label_year)%>:
|
||||
<div class="input">
|
||||
<%= f.number_field :year, autocomplete: "off" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<%=t(:label_make)%>:
|
||||
<div class="input">
|
||||
<%= f.text_field :make, autocomplete: "off" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<%=t(:label_model)%>:
|
||||
<div class="input">
|
||||
<%= f.text_field :model, autocomplete: "off" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<%=t(:field_vin)%>:
|
||||
<div class="input">
|
||||
<%= f.text_field :vin , autofocus: true %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<%=t(:field_notes)%>:
|
||||
<div class="input">
|
||||
<p>
|
||||
<%= f.text_area :notes,
|
||||
rows: 8,
|
||||
class: 'wiki-edit',
|
||||
style: 'width: 95%;',
|
||||
id: 'vehicle_notes' %>
|
||||
<%= wikitoolbar_for 'vehicle_notes' %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</fieldset>
|
||||
<% if @existing_vehicle %>
|
||||
<div class="flash warning">
|
||||
<%= l(:text_vin_already_on_file) %>
|
||||
<%= link_to @existing_vehicle.to_s, vehicle_path(@existing_vehicle) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="box tabular">
|
||||
<p>
|
||||
<%# 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' %>
|
||||
</p>
|
||||
<p><%= f.text_field :vin, label: :field_vin, required: true, size: 20, maxlength: 17, autofocus: true %></p>
|
||||
<p><%= f.number_field :year, label: :label_year, min: 1900, max: Date.today.year + 2, autocomplete: 'off' %></p>
|
||||
<p><%= f.text_field :make, label: :label_make, size: 30, autocomplete: 'off' %></p>
|
||||
<p><%= f.text_field :model, label: :label_model, size: 30, autocomplete: 'off' %></p>
|
||||
<p>
|
||||
<%= f.text_area :notes, label: :field_notes, rows: 8, class: 'wiki-edit', id: 'vehicle_notes' %>
|
||||
<%= wikitoolbar_for 'vehicle_notes' %>
|
||||
</p>
|
||||
</div>
|
||||
@@ -1,3 +1,9 @@
|
||||
<h2><%=t(:label_edit_customer_vehicle)%></h2>
|
||||
<br/>
|
||||
<%= render partial: 'vehicles/form' %>
|
||||
<h2><%= link_to l(:field_vehicles), vehicles_path %> » <%= link_to @vehicle.to_s, vehicle_path(@vehicle) %></h2>
|
||||
|
||||
<%= 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)) -%>
|
||||
@@ -1,3 +1,9 @@
|
||||
<h2><%=t(:label_new_vehicle)%></h2>
|
||||
<br/>
|
||||
<%= render partial: 'vehicles/form' %>
|
||||
<h2><%= link_to l(:field_vehicles), vehicles_path %> » <%= l(:label_new_vehicle) %></h2>
|
||||
|
||||
<%= 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)) -%>
|
||||
Reference in new issue
Block a user