Guest User

Untitled

a guest
May 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. ## app/models/rental_map.rb [ruby_on_rails]
  2.  
  3. class RentalMap
  4. MAP_NAME = 'RentalMap'
  5. CSS_ID_NAME = 'RentalMap'
  6.  
  7. # ..snip..
  8. end
  9.  
  10. ## app/models/property.rb [ruby_on_rails]
  11.  
  12. class Property < ActiveRecord::Base
  13. # ..snip..
  14.  
  15. # javascript_map_marker_code() # {{{
  16. #
  17. # Returns a chunk of Javascript that creates a map marker for the property, and adds it to the map.
  18. #
  19. # Arguments:
  20. # None
  21. #
  22. # Example Call:
  23. # Property.find(:first).javascript_map_marker_code
  24. #
  25. def javascript_map_marker_code
  26. "marker#{id} = create_map_marker(#{latitude}, #{longitude}, #{id});
  27. #{RentalMap::MAP_NAME}.addOverlay(marker#{id});
  28. "
  29. end # }}}
  30.  
  31. # ..snip..
  32. end
Add Comment
Please, Sign In to add comment