mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-02-13 09:34:00 -05:00
Cleaned up issue show hook
This commit is contained in:
@@ -13,28 +13,15 @@ module Vehicles
|
|||||||
|
|
||||||
class IssuesShowHookListener < Redmine::Hook::ViewListener
|
class IssuesShowHookListener < Redmine::Hook::ViewListener
|
||||||
|
|
||||||
# View Issue
|
# Display vehicle information on the issue view page.
|
||||||
# Display the quickbooks contact in the issue
|
|
||||||
def show_issue_view_right(context={})
|
def show_issue_view_right(context={})
|
||||||
issue = context[:issue]
|
|
||||||
|
|
||||||
begin
|
|
||||||
v = issue.vehicle
|
|
||||||
vehicle = link_to v.to_s, vehicle_path( v.id )
|
|
||||||
vin = v.vin
|
|
||||||
notes = v.notes
|
|
||||||
rescue
|
|
||||||
#do nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
split_vin = vin.scan(/.{1,9}/) if vin
|
|
||||||
|
|
||||||
context[:controller].send(:render_to_string, {
|
context[:controller].send(:render_to_string, {
|
||||||
partial: 'issues/show_issue_view_right',
|
partial: 'issues/show_issue_view_right',
|
||||||
locals: {
|
locals: {
|
||||||
vehicle: vehicle,
|
vehicle: link_to(context[:issue].vehicle),
|
||||||
split_vin: split_vin,
|
split_vin: context[:issue].vehicle ? context[:issue].vehicle.vin.to_s.scan(/.{1,9}/) : nil,
|
||||||
notes: notes
|
notes: context[:issue].vehicle ? context[:issue].vehicle.notes : nil
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user