Updates introduce support for preloading contacts to Gon in order to support client-side rendering of aspect membership dropdown box.
8 lines
308 B
Ruby
8 lines
308 B
Ruby
module GonHelper
|
|
def gon_load_contact(contact)
|
|
Gon.preloads[:contacts] ||= []
|
|
if Gon.preloads[:contacts].none? {|stored_contact| stored_contact[:person][:id] == contact.person_id }
|
|
Gon.preloads[:contacts] << ContactPresenter.new(contact, current_user).full_hash_with_person
|
|
end
|
|
end
|
|
end
|