afimb/chouette2

View on GitHub
app/views/routes/show.html.erb

Summary

Maintainability
Test Coverage
<%= title_tag t('routes.show.title', :route => @route.name, :line => @route.line.name ) %>

<div class="route_show">
  <%= @map.to_html %>

  <div class="summary">
    <p>
      <label><%= @route.human_attribute_name(:name) %>: </label>
      <%= @route.name %>
    </p>
    <p>
      <label><%= @route.human_attribute_name(:published_name) %>: </label>
      <%= @route.published_name %>
    </p>
    <p>
      <label><%= @route.human_attribute_name(:number) %>: </label>
      <%= @route.number %>
    </p>
    <p>
      <label><%= @route.human_attribute_name(:comment) %>: </label>
      <%= @route.comment %>
    </p>
    <p>
      <label><%= @route.human_attribute_name(:direction_code) %>: </label>
      <% if @route.direction_code %>
        <%= t("directions.label.#{@route.direction_code}").capitalize %>
      <% else %>
        <%= t(".undefined") %>
      <% end %>
    </p>
    <p>
      <label><%= @route.human_attribute_name(:wayback_code) %>: </label>
      <% if @route.wayback_code %>
        <%= t("waybacks.label.#{@route.wayback_code}").capitalize %>
      <% else %>
        <%= t(".undefined") %>
      <% end %>
    </p>
    <p>
      <label><%= @route.human_attribute_name(:opposite_route) %>: </label>
      <% if @route.opposite_route %>
        <%= link_to @route.opposite_route.name, [@referential, @line, @route.opposite_route] %>
      <% else %>
        <%= t(".no_opposite_route") %>
      <% end %>
    </p>
  </div>

</div>

<p class="after_map" />

<div class="panel-group" id="accordion">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#stop_points">
          <%= t('.stop_points') %>
        </a>
      </h4>
    </div>
    <div id="stop_points" class="panel-collapse collapse">
      <div class="panel-body">
        <div class="stop_points paginated_content">
          <%= paginated_content( @route.stop_points, "stop_points/stop_point") %>
        </div>
      </div>
    </div>
  </div>
</div>

<div class="panel-group" id="accordion">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#journey_patterns">
          <%= t('.journey_patterns') %>
        </a>
      </h4>
    </div>
    <div id="journey_patterns" class="panel-collapse collapse">
      <div class="panel-body">
        <div class="journey_patterns paginated_content">
          <%= paginated_content( @route.journey_patterns, "journey_patterns/journey_pattern") %>
        </div>
      </div>
    </div>
  </div>
</div>

<% content_for :sidebar do %>
<ul class="actions">
  <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> 
  <li><%= link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li>
  <li><%= link_to t('routes.actions.destroy'), referential_line_route_path(@referential, @line, @route), :method => :delete, :data => {:confirm =>  t('routes.actions.destroy_confirm')}, :class => "remove" %></li>
</ul>
<ul class="actions">
  <% if @route.stop_points.size >= 2 %>
  <li><%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %></li>
  <% end %>
  <% if @route.stop_points.present? %>
  <li><%= link_to t('routes.actions.edit_boarding_alighting'), edit_boarding_alighting_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li>
  <% end %>
  <% if @route.journey_patterns.size > 0 %>
  <li>
    <%= link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], :class => "clock" %>
  </li>
  <% end %>
</ul>

<ul class="actions">
  <li><%= link_to t('vehicle_journey_imports.new.title'), new_referential_line_route_vehicle_journey_import_path( @referential, @line, @route ), :class => "import" %></li>
  <li><%= link_to t('vehicle_journey_exports.new.title'), referential_line_route_vehicle_journey_exports_path(@referential, @line, @route, :format => :zip), :class => "export" %></li>
</ul>

<%= creation_tag(@route) %>
<% end %>