afimb/chouette2

View on GitHub
app/views/stop_areas/_genealogical.html.erb

Summary

Maintainability
Test Coverage
    <h3><%= genealogical_title %></h3>

    <% if @stop_area.parent.present? %> 
    <div class="parent">
      <%= link_to([@referential, @stop_area.parent], :title => t("area_types.label.#{ @stop_area.parent.stop_area_type}") + " #{ @stop_area.parent.name}") do %> 
        <%= image_tag "map/" + @stop_area.parent.stop_area_type + ".png"   %><span><%= @stop_area.parent.name %></span>        
      <% end %>
    </div> 
    <div class="link"><%= image_tag "icons/link.png"%></div>
    <% elsif @stop_area.routing_lines.present? %> 
    <div class="lines">
      <% @stop_area.routing_lines.each do |line| %>
      <div class="line">
        <%= link_to([@referential, line]) do %> 
          <span><%= line.name %></span>         
        <% end %>  
      </div>
      <% end %>
    </div> 
    <div class="link"><%= image_tag "icons/link.png"%></div>
    <% else %>
    <div class="no_parent">&nbsp;</div>
    <% end %>

    <div class="target">
      <%= image_tag "map/" + @stop_area.stop_area_type + ".png"%><span><%= @stop_area.name %></span>
    </div> 
    
    <% if @stop_area.children.present? %>
    <div class="link"><%= image_tag "icons/link.png"%></div>
    <div class="children">
      <% @stop_area.children.each do |child| %>
      <div class="child">
        <%= link_to([@referential, child], :title => t("area_types.label.#{ child.stop_area_type}") + " #{ child.name}") do %> 
          <%= image_tag "map/" + child.stop_area_type + ".png"   %><span><%= child.name %></span>         
        <% end %>  
      </div>
      <% end %>
    </div> 
    <% elsif @stop_area.routing_stops.present? %>
    <div class="link"><%= image_tag "icons/link.png"%></div>
    <div class="children">
      <% @stop_area.routing_stops.each do |stop| %>
      <div class="child">
        <%= link_to([@referential, stop], :title => t("area_types.label.#{ stop.stop_area_type}") + " #{ stop.name}") do %> 
          <%= image_tag "map/" + stop.stop_area_type + ".png"   %><span><%= "#{stop.name} #{' [' + stop.registration_number + ']' if stop.registration_number.present? }" %></span>         
        <% end %>  
      </div>
      <% end %>
    </div> 
    <% elsif @stop_area.routes.present? %>
    <div class="link"><%= image_tag "icons/link.png"%></div>
    <div class="children">
      <% @stop_area.routes.each do |route| %>
      <div class="child">
        <%= link_to([@referential, route.line ]) do %> 
          <span><%= route.line.number %></span>     
        <% end %>  
        &nbsp;
        <%= link_to([@referential, route.line , route]) do %> 
          <span><%= route.name %></span>     
        <% end %>      
      </div>
      <% end %>
    </div> 
    <% end %>