Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. #distance
  2. =number_with_precision(event.distance_to(@lat_lng), precision: 2)
  3.  
  4. @lat_lng = cookies[:lat_lng] ? cookies[:lat_lng].split("|") : nil
  5.  
  6. var ajax_update_latlng = function(){
  7. $.ajax({
  8. url: '/welcome/refresh'
  9. })
  10. }
  11.  
  12. $(function(){
  13. setInterval(ajax_update_latlng, 3000)
  14. });
  15.  
  16. Started GET "/welcome/refresh" for 127.0.0.1 at 2014-04-07 15:09:51 -0400
  17. Processing by WelcomeController#refresh as */*
  18. Rendered welcome/_info.html.haml (11.3ms)
  19. Rendered welcome/refresh_latlng.js.haml (12.2ms)
  20. Completed 500 Internal Server Error in 18ms
  21.  
  22. NameError - undefined local variable or method `event' for #<#<Class:0x007fdbeb4255d0>:0x007fdbeb430958>:
  23.  
  24. def refresh
  25. respond_to do |format|
  26. format.js {render :action =>"refresh_latlng.js" }
  27. end
  28. end
  29.  
  30. $('#distance').html("#{escape_javascript(render 'welcome/info', data: @lat_lng)}");
  31.  
  32. def index
  33. @events = Event.all
  34. @lat_lng = cookies[:lat_lng] ? cookies[:lat_lng].split("|") : nil
  35. @locations= Event.where( "start = ?", Date.today).all
  36. @hash = Gmaps4rails.build_markers(@locations) do |location, marker|
  37. marker.lat location.latitude
  38. marker.lng location.longitude
  39. marker.infowindow render_to_string(:partial => "info", :locals => { :event => location }) <--this is pulling the info partial
  40. marker.picture({
  41. "url" => "https://addons.cdn.mozilla.net/img/uploads/addon_icons/13/13028-64.png",
  42. "width" => 32,
  43. "height" => 37
  44. })
  45. end
  46.  
  47. .event-data{id: event.id}
  48. .row
  49. .small-3.columns.mright
  50. .avatar
  51. %img.avatar{:src => event.user.avatar(:thumb), class: 'th'}
  52. .small-6.columns.mleft.left-border
  53. .name
  54. %strong
  55. = event.user.name
  56. .address
  57. = event.address
  58. .times
  59. = event.start.strftime('%I:%M')
  60. to
  61. = event.end.strftime('%I:%M')
  62.  
  63. .small-2.columns.left-border
  64. .distance
  65. =number_with_precision(event.distance_to(@lat_lng), precision: 2)
  66. %br
  67. miles away
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement