From 6ec885350867b152ac16e669f13ef203c6eb7898 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 29 Oct 2026 23:29:46 -0400 Subject: [PATCH] Customer page: actions in the contextual area, with a plugin hook - New issue, Create estimate, Create payment and Edit now sit in Redmine's top-right contextual area (icons, like issue pages) instead of an "Actions" column next to the customer details - New view hook :view_customers_show_contextual (context: customer) for plugins to add their own action links there; replaces customer_actions_top / customer_actions_bottom (README updated) - The New issue link still picks up the estimate / vehicle ticked on the page (script moved to customers/_new_issue_link_script) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM --- README.md | 3 +-- ...ml.erb => _new_issue_link_script.html.erb} | 22 ++++-------------- app/views/customers/show.html.erb | 23 ++++++++++--------- 3 files changed, 18 insertions(+), 30 deletions(-) rename app/views/customers/{_actions.html.erb => _new_issue_link_script.html.erb} (76%) diff --git a/README.md b/README.md index ab70909..baed7a6 100644 --- a/README.md +++ b/README.md @@ -108,8 +108,7 @@ Available hooks: |Type|Hook|Note |--|--|--| -View Hook|:customer_actions_top, { customer: @customer }| Used to add action links to customer view -View Hook|:customer_actions_bottom, { customer: @customer} | Used to add action links to customer view +View Hook|:view_customers_show_contextual, { customer: @customer } | Used to add action links to the customer page's top-right action area (return links styled like Redmine's, e.g. `link_to sprite_icon('add', 'Label'), path, class: 'icon icon-add'`). Replaces `customer_actions_top` / `customer_actions_bottom` View Hook|:pdf_left, { issue: issue } | Used to add text to left side of PDF View Hook|:pdf_right, { issue: issue } | Used to add text to right side of PDF View Hook|:show_customer_view_right, { customer: customer } | Used to show partials on right side of customer view diff --git a/app/views/customers/_actions.html.erb b/app/views/customers/_new_issue_link_script.html.erb similarity index 76% rename from app/views/customers/_actions.html.erb rename to app/views/customers/_new_issue_link_script.html.erb index e690341..00358e0 100644 --- a/app/views/customers/_actions.html.erb +++ b/app/views/customers/_new_issue_link_script.html.erb @@ -1,19 +1,7 @@ -<%= call_hook :customer_actions_top, { customer: @customer } %> - -

- <%= link_to t(:label_new_issue), new_issue_path(issue: { customer_id: @customer.id }), id: "dynamic-new-issue-link", target: :_blank %> -

- -

- <%= link_to t(:label_create_estimate), "https://qbo.intuit.com/app/estimate?nameId=#{@customer.id}", target: :_blank %> -

- -

- <%= link_to t(:label_create_payment), "https://qbo.intuit.com/app/recvpayment?nameId=#{@customer.id}", target: :_blank %> -

- -<%= call_hook :customer_actions_bottom, { customer: @customer } %> - +<%# + Adds the estimate and vehicle ticked on the customer page to the "New issue" link + (#dynamic-new-issue-link in the contextual area). One of each can be ticked. +%> \ No newline at end of file + diff --git a/app/views/customers/show.html.erb b/app/views/customers/show.html.erb index 2992ca5..2c25e15 100644 --- a/app/views/customers/show.html.erb +++ b/app/views/customers/show.html.erb @@ -1,4 +1,13 @@
+ <%# New issue for this customer; picks up the estimate / vehicle ticked on this page %> + <%= link_to sprite_icon('add', l(:label_new_issue)), new_issue_path(issue: { customer_id: @customer.id }), + id: 'dynamic-new-issue-link', class: 'icon icon-add', target: :_blank %> + <%# Plugins add their customer actions here (e.g. redmine_qbo_calendar's Add appointment) %> + <%= call_hook :view_customers_show_contextual, { customer: @customer } %> + <%= link_to sprite_icon('document', l(:label_create_estimate)), "https://qbo.intuit.com/app/estimate?nameId=#{@customer.id}", + class: 'icon icon-document', target: :_blank %> + <%= link_to sprite_icon('add', l(:label_create_payment)), "https://qbo.intuit.com/app/recvpayment?nameId=#{@customer.id}", + class: 'icon icon-add', target: :_blank %> <% if User.current.allowed_to?(:edit_customers, nil, global: true) %> <%= link_to sprite_icon('edit', l(:button_edit)), edit_customer_path(@customer), class: 'icon icon-edit', accesskey: accesskey(:edit) %> @@ -16,17 +25,7 @@ -
-
-

<%=t(:field_customer)%>:

- <%= render partial: 'customers/details', locals: {customer: @customer} %> -
- -
-

<%=t(:label_actions)%>:

- <%= render partial: 'customers/actions', locals: {customer: @customer} %> -
-
+ <%= render partial: 'customers/details', locals: {customer: @customer} %> @@ -58,3 +57,5 @@

<%=@closed_issues.count%> <%=t(:label_closed_issues)%> - <%= @closed_hours.round(1)%> <%=t(:label_hours)%>

<%= render partial: 'issues/list_simple', locals: {issues: @closed_issues} %> + +<%= render partial: 'customers/new_issue_link_script' %>