afimb/chouette2

View on GitHub
app/views/api/kml/connection_links/index.kml.erb

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name><%= h(Chouette::ConnectionLink.model_name.human) %></name>
    <% @connection_links.each do |connection_link| %>
      <Placemark id="<%= connection_link.objectid %>" >
        <name><%= h(connection_link.name) %></name>
        <ExtendedData>
        <% [ :connection_link_type, :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop| %>
          <Data name="<%= prop.to_s %>">
            <value><%= h(connection_link.send( prop)) %></value>
          </Data>
        <% end %>
        <Data name="departure_objectid">
          <value><%= h(connection_link.departure.objectid) %></value>
        </Data>
        <Data name="arrival_objectid">
          <value><%= h(connection_link.arrival.objectid) %></value>
        </Data>
        </ExtendedData>
        <%= connection_link.geometry_presenter.geometry.kml_representation.html_safe %>
      </Placemark>
    <% end %>
  </Document>
</kml>