show.html.erb 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <div class='container'>
  2. <div class='row'>
  3. <div class='col-md-12'>
  4. <div class="page-header">
  5. <h2>Event from <%= @event.agent.name %></h2>
  6. </div>
  7. <p>
  8. <b>Expires in:</b>
  9. <%= @event.expires_at ? time_ago_in_words(@event.expires_at) : 'never' %>
  10. </p>
  11. <p>
  12. <b>Payload:</b>
  13. <pre><%= Utils.pretty_jsonify @event.payload || {} %></pre>
  14. </p>
  15. <% if @event.lat && @event.lng %>
  16. <% content_for :head do -%>
  17. <%= javascript_include_tag "https://maps.googleapis.com/maps/api/js?sensor=false" %>
  18. <%= javascript_include_tag "map_marker" %>
  19. <% end -%>
  20. <p>
  21. <b>Lat:</b>
  22. <%= @event.lat %>
  23. <br/>
  24. <b>Lng:</b>
  25. <%= @event.lng %>
  26. </p>
  27. <div id="map_canvas" style="width:400px; height:300px"></div>
  28. <script type="text/javascript">
  29. var mapOptions = {
  30. center: new google.maps.LatLng(<%= @event.lat %>, <%= @event.lng %>),
  31. zoom:15,
  32. mapTypeId:google.maps.MapTypeId.ROADMAP
  33. };
  34. var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
  35. map_marker(map, <%= Utils.jsonify(@event.location) %>);
  36. </script>
  37. <% end %>
  38. <br />
  39. <div class="btn-group">
  40. <%= link_to icon_tag('glyphicon-chevron-left') + ' Back'.html_safe, events_path, class: "btn btn-default" %>
  41. </div>
  42. </div>
  43. </div>
  44. </div>