Customer new/edit pages in Redmine's form style

- labelled_form_for with Redmine's "box tabular" layout: labels on the
  left, Display name marked required
- Breadcrumb headings ("Customers » customer"), Create/Save buttons and
  a Cancel link back to the customer (or the customer list)
- Keeps the form tag in the partial and the customer_name / customer_notes
  ids used by redmine_qbo_calendar's quick-create popup (hide_submit /
  hide_toolbar still supported)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-29 23:23:18 -04:00
1 parent 0dd3073841
commit b99887362f
3 files changed
+32 -41

No files matched your search

+23 -37
View File
@@ -1,44 +1,30 @@
<%= form_for @customer do |f| %> <%#
Customer form, in Redmine's form style. Also loaded by redmine_qbo_calendar's quick-create popup
(hide_submit / hide_toolbar), which relies on the form tag being here and the name field's
customer_name id.
%>
<%= labelled_form_for @customer do |f| %>
<%= error_messages_for 'customer' %> <%= error_messages_for 'customer' %>
<div class="box tabular"> <div class="box tabular">
<p>
<p> <%= f.text_field :name, label: :label_display_name, required: true, size: 60,
<%= f.label :name, t(:label_display_name) %> class: 'customer-name', autocomplete: 'off',
<%= f.text_field :name, required: true, class: "customer-name", autocomplete: "off", data: { autocomplete_url: "/customers/autocomplete" } %> data: { autocomplete_url: '/customers/autocomplete' } %>
</p> </p>
<p><%= f.telephone_field :primary_phone, label: :label_primary_phone, size: 20, autocomplete: 'off' %></p>
<p> <p><%= f.telephone_field :mobile_phone, label: :label_mobile_phone, size: 20, autocomplete: 'off' %></p>
<%= f.label :primary_phone, t(:label_primary_phone) %> <p><%= f.email_field :email, label: :label_email, size: 60, autocomplete: 'off' %></p>
<%= f.telephone_field :primary_phone, autocomplete: "off" %> <p>
</p> <%= f.text_area :notes, label: :field_notes, rows: 8, class: 'wiki-edit', id: 'customer_notes' %>
<% unless local_assigns[:hide_toolbar] %>
<p> <%= wikitoolbar_for 'customer_notes' %>
<%= f.label :mobile_phone, t(:label_mobile_phone) %> <% end %>
<%= f.telephone_field :mobile_phone, autocomplete: "off" %> </p>
</p>
<p>
<%= f.label :email, t(:label_email) %>
<%= f.email_field :email, autocomplete: "off" %>
</p>
<p>
<%= f.label :notes, t(:field_notes) %>
<%= f.text_area :notes,
rows: 8,
class: 'wiki-edit',
style: 'width: 99%;',
id: 'customer_notes' %>
<% unless local_assigns[:hide_toolbar] %>
<%= wikitoolbar_for 'customer_notes' %>
<% end %>
</p>
</div> </div>
<% unless local_assigns[:hide_submit] %> <% unless local_assigns[:hide_submit] %>
<p class="buttons"> <%= submit_tag @customer.new_record? ? l(:button_create) : l(:button_save) %>
<%= submit_tag t(:button_save) %> <%= link_to l(:button_cancel), @customer.new_record? ? customers_path : customer_path(@customer) %>
</p>
<% end %> <% end %>
<% end %> <% end %>
+4 -2
View File
@@ -1,3 +1,5 @@
<h1><%=t(:label_edit_customer)%></h1> <h2><%= link_to l(:label_customers), customers_path %> &#187; <%= link_to @customer.to_s, customer_path(@customer) %></h2>
<br/>
<%= render partial: 'customers/form' %> <%= render partial: 'customers/form' %>
<% html_title(l(:label_edit_customer)) -%>
+5 -2
View File
@@ -1,2 +1,5 @@
<h2><%=t(:label_new_customer)%></h2> <h2><%= link_to l(:label_customers), customers_path %> &#187; <%= l(:label_new_customer) %></h2>
<%= render partial: 'customers/form' %>
<%= render partial: 'customers/form' %>
<% html_title(l(:label_new_customer)) -%>