mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Add appointment link in the customer page's contextual area
Uses redmine_qbo's new :view_customers_show_contextual hook (replacing customer_actions_top) and renders "Add appointment" as a Redmine-style icon link alongside the customer's other actions. Needs the matching redmine_qbo update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
2 files changed
+9
-13
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
<% customer = context[:customer] %>
|
<% if customer && User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
|
||||||
<% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %>
|
<%= link_to sprite_icon('time-add', l(:label_add_appointment)),
|
||||||
<p>
|
new_customer_appointment_path(customer_id: customer.id),
|
||||||
<%= link_to l(:label_add_appointment), new_customer_appointment_path(customer_id: customer.id), target: :_blank, id: :appointment_link %>
|
class: 'icon icon-time-add', target: :_blank, id: 'appointment_link' %>
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -13,14 +13,11 @@ module RedmineQboCalendar
|
|||||||
|
|
||||||
class CustomerActionsHookListener < Redmine::Hook::ViewListener
|
class CustomerActionsHookListener < Redmine::Hook::ViewListener
|
||||||
|
|
||||||
# This hook is called in the customer view, and allows us to add a link to create a new appointment for the customer.
|
# Adds "Add appointment" to the customer page's top-right action area
|
||||||
def customer_actions_top(context = {})
|
# (redmine_qbo's :view_customers_show_contextual hook).
|
||||||
context[:controller].send(:render_to_string, {
|
def view_customers_show_contextual(context = {})
|
||||||
partial: 'customer_appointments/customer_actions',
|
context[:hook_caller].render(partial: 'customer_appointments/customer_actions',
|
||||||
locals: {
|
locals: { customer: context[:customer] })
|
||||||
context: context
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user