show.html.erb 1.7 KB

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