diff --git a/README.md b/README.md index baed7a6..b8c3581 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,8 @@ Available hooks: |Type|Hook|Note |--|--|--| 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|:view_customers_show_estimate_link, { customer: @customer } | Replaces the customer page's Create Estimate link (which opens QuickBooks) with the link a plugin returns +View Hook|:view_estimate_actions, { estimate: estimate } | Used to add small action links after an estimate on the customer page's estimate list and the issue page (e.g. an Edit link) 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/show.html.erb b/app/views/customers/show.html.erb index 2c25e15..6866c60 100644 --- a/app/views/customers/show.html.erb +++ b/app/views/customers/show.html.erb @@ -4,8 +4,14 @@ 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 %> + <%# A plugin can replace the Create Estimate link (e.g. redmine_qbo_estimates writes estimates in Redmine) %> + <% estimate_link = call_hook(:view_customers_show_estimate_link, { customer: @customer }) %> + <% if estimate_link.present? %> + <%= estimate_link %> + <% else %> + <%= link_to sprite_icon('document', l(:label_create_estimate)), "https://qbo.intuit.com/app/estimate?nameId=#{@customer.id}", + class: 'icon icon-document', target: :_blank %> + <% end %> <%= 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) %> diff --git a/app/views/estimates/_list.html.erb b/app/views/estimates/_list.html.erb index db22fd8..d714f39 100644 --- a/app/views/estimates/_list.html.erb +++ b/app/views/estimates/_list.html.erb @@ -4,6 +4,7 @@