mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-11-18 02:20:37 -05:00
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:
3 files changed
+16
-28
No files matched your search
@@ -108,8 +108,7 @@ Available hooks:
|
|||||||
|
|
||||||
|Type|Hook|Note
|
|Type|Hook|Note
|
||||||
|--|--|--|
|
|--|--|--|
|
||||||
View Hook|:customer_actions_top, { 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|:customer_actions_bottom, { customer: @customer} | Used to add action links to customer view
|
|
||||||
View Hook|:pdf_left, { issue: issue } | Used to add text to left side of PDF
|
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|: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
|
View Hook|:show_customer_view_right, { customer: customer } | Used to show partials on right side of customer view
|
||||||
|
|||||||
+4
-16
@@ -1,19 +1,7 @@
|
|||||||
<%= call_hook :customer_actions_top, { customer: @customer } %>
|
<%#
|
||||||
|
Adds the estimate and vehicle ticked on the customer page to the "New issue" link
|
||||||
<p>
|
(#dynamic-new-issue-link in the contextual area). One of each can be ticked.
|
||||||
<%= 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 } %>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function handleSingleSelect(event, className) {
|
function handleSingleSelect(event, className) {
|
||||||
if (event.target.checked) {
|
if (event.target.checked) {
|
||||||
@@ -1,4 +1,13 @@
|
|||||||
<div class="contextual">
|
<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) %>
|
<% if User.current.allowed_to?(:edit_customers, nil, global: true) %>
|
||||||
<%= link_to sprite_icon('edit', l(:button_edit)), edit_customer_path(@customer),
|
<%= link_to sprite_icon('edit', l(:button_edit)), edit_customer_path(@customer),
|
||||||
class: 'icon icon-edit', accesskey: accesskey(:edit) %>
|
class: 'icon icon-edit', accesskey: accesskey(:edit) %>
|
||||||
@@ -16,17 +25,7 @@
|
|||||||
|
|
||||||
<!-- Customer Info -->
|
<!-- Customer Info -->
|
||||||
|
|
||||||
<div class="splitcontent">
|
|
||||||
<div class="splitcontentleft">
|
|
||||||
<h4><%=t(:field_customer)%>:</h4>
|
|
||||||
<%= render partial: 'customers/details', locals: {customer: @customer} %>
|
<%= 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>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- QBO Info -->
|
<!-- QBO Info -->
|
||||||
@@ -58,3 +57,5 @@
|
|||||||
|
|
||||||
<h3><%=@closed_issues.count%> <%=t(:label_closed_issues)%> - <%= @closed_hours.round(1)%> <%=t(:label_hours)%></h3>
|
<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: 'issues/list_simple', locals: {issues: @closed_issues} %>
|
||||||
|
|
||||||
|
<%= render partial: 'customers/new_issue_link_script' %>
|
||||||
Reference in new issue
Block a user