From b99887362f30b819fe486342680dbd50e5ef0cd4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 23:23:18 -0400 Subject: [PATCH] Customer 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 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 Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM --- app/views/customers/_form.html.erb | 60 ++++++++++++------------------ app/views/customers/edit.html.erb | 6 ++- app/views/customers/new.html.erb | 7 +++- 3 files changed, 32 insertions(+), 41 deletions(-) diff --git a/app/views/customers/_form.html.erb b/app/views/customers/_form.html.erb index 979fedb..8751d7b 100644 --- a/app/views/customers/_form.html.erb +++ b/app/views/customers/_form.html.erb @@ -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' %>
- -

- <%= f.label :name, t(:label_display_name) %> - <%= f.text_field :name, required: true, class: "customer-name", autocomplete: "off", data: { autocomplete_url: "/customers/autocomplete" } %> -

- -

- <%= f.label :primary_phone, t(:label_primary_phone) %> - <%= f.telephone_field :primary_phone, autocomplete: "off" %> -

- -

- <%= f.label :mobile_phone, t(:label_mobile_phone) %> - <%= f.telephone_field :mobile_phone, autocomplete: "off" %> -

- -

- <%= f.label :email, t(:label_email) %> - <%= f.email_field :email, autocomplete: "off" %> -

- -

- <%= 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 %> -

+

+ <%= f.text_field :name, label: :label_display_name, required: true, size: 60, + class: 'customer-name', autocomplete: 'off', + data: { autocomplete_url: '/customers/autocomplete' } %> +

+

<%= f.telephone_field :primary_phone, label: :label_primary_phone, size: 20, autocomplete: 'off' %>

+

<%= f.telephone_field :mobile_phone, label: :label_mobile_phone, size: 20, autocomplete: 'off' %>

+

<%= f.email_field :email, label: :label_email, size: 60, autocomplete: 'off' %>

+

+ <%= f.text_area :notes, label: :field_notes, rows: 8, class: 'wiki-edit', id: 'customer_notes' %> + <% unless local_assigns[:hide_toolbar] %> + <%= wikitoolbar_for 'customer_notes' %> + <% end %> +

<% unless local_assigns[:hide_submit] %> -

- <%= submit_tag t(:button_save) %> -

+ <%= submit_tag @customer.new_record? ? l(:button_create) : l(:button_save) %> + <%= link_to l(:button_cancel), @customer.new_record? ? customers_path : customer_path(@customer) %> <% end %> -<% end %> \ No newline at end of file +<% end %> diff --git a/app/views/customers/edit.html.erb b/app/views/customers/edit.html.erb index c6eef66..dc690c2 100644 --- a/app/views/customers/edit.html.erb +++ b/app/views/customers/edit.html.erb @@ -1,3 +1,5 @@ -

<%=t(:label_edit_customer)%>

-
+

<%= link_to l(:label_customers), customers_path %> » <%= link_to @customer.to_s, customer_path(@customer) %>

+ <%= render partial: 'customers/form' %> + +<% html_title(l(:label_edit_customer)) -%> diff --git a/app/views/customers/new.html.erb b/app/views/customers/new.html.erb index 9295442..2206582 100644 --- a/app/views/customers/new.html.erb +++ b/app/views/customers/new.html.erb @@ -1,2 +1,5 @@ -

<%=t(:label_new_customer)%>

-<%= render partial: 'customers/form' %> \ No newline at end of file +

<%= link_to l(:label_customers), customers_path %> » <%= l(:label_new_customer) %>

+ +<%= render partial: 'customers/form' %> + +<% html_title(l(:label_new_customer)) -%>