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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-29 23:29:46 -04:00
1 parent b99887362f
commit 6ec8853508
3 files changed
+17 -29

No files matched your search

+1 -2
View File
@@ -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
@@ -1,19 +1,7 @@
<%= call_hook :customer_actions_top, { customer: @customer } %>
<p>
<%= link_to t(:label_new_issue), new_issue_path(issue: { customer_id: @customer.id }), id: "dynamic-new-issue-link", target: :_blank %>
</p>
<p>
<%= link_to t(:label_create_estimate), "https://qbo.intuit.com/app/estimate?nameId=#{@customer.id}", target: :_blank %>
</p>
<p>
<%= link_to t(:label_create_payment), "https://qbo.intuit.com/app/recvpayment?nameId=#{@customer.id}", target: :_blank %>
</p>
<%= 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.
%>
<script>
function handleSingleSelect(event, className) {
if (event.target.checked) {
+12 -11
View File
@@ -1,4 +1,13 @@
<div class="contextual">
<%# 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 @@
<!-- Customer Info -->
<div class="splitcontent">
<div class="splitcontentleft">
<h4><%=t(:field_customer)%>:</h4>
<%= render partial: 'customers/details', locals: {customer: @customer} %>
</div>
<div class="splitcontentleft">
<h4><%=t(:label_actions)%>:</h4>
<%= render partial: 'customers/actions', locals: {customer: @customer} %>
</div>
</div>
<%= render partial: 'customers/details', locals: {customer: @customer} %>
<!-- QBO Info -->
@@ -58,3 +57,5 @@
<h3><%=@closed_issues.count%> <%=t(:label_closed_issues)%> - <%= @closed_hours.round(1)%> <%=t(:label_hours)%></h3>
<%= render partial: 'issues/list_simple', locals: {issues: @closed_issues} %>
<%= render partial: 'customers/new_issue_link_script' %>