afimb/chouette2

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

Summary

Maintainability
Test Coverage
<div id="index_item" class="panel panel-default route">
  <div class="panel-heading">
    <div class="panel-title clearfix">
      <% if policy(:application).write? %>
        <span class="pull-right">
          <%= link_to edit_referential_line_route_path(@referential, @line, route), :class => "btn btn-default btn-sm" do %>
            <span class="fa fa-pencil"></span>
          <% end %>
          <%= link_to referential_line_route_path(@referential, @line, route), :method => :delete, :data => {:confirm =>  t('routes.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
            <span class="fa fa-trash-o"></span>
          <% end %>
        </span>
      <% end %>
      <h5>
        <%= link_to([@referential, @line, route], :class => "preview", :title => "#{Chouette::Route.model_name.human.capitalize} #{route.name}") do %>
        <span class="name">
          <% if ( route.wayback_code ) %>
          <%= fonticon_wayback(route.wayback) %>
          <% end %>
          <%= truncate(route.name, :length => 20) %>
        </span>
        <% end %>
      </h5>
    </div>
  </div>
  <div class="panel-body">
    <% if exist_vehicle_journeys?(route) %>
      <p>
        <% if route.journey_patterns.size > 0 %>
          <i class="fa fa-clock-o"></i>
          <%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route) %>
        <% else %>
          <%= t('.no_journey_pattern')%>
        <% end%>
      </p>
    <% end%>
    <% if exist_vehicle_journey_frequencies?(route) %>
      <p>
        <i class="fa fa-clock-o"></i>
        <%= link_to t("vehicle_journey_frequencies.actions.index"), referential_line_route_vehicle_journey_frequencies_path(@referential, @line, route) %>
      </p>
    <% end %>
    <p>
      <% if route.opposite_route %>
        <%= fonticon_wayback(route.opposite_route.wayback) %><%= link_to truncate(route.opposite_route.name, :length => 30), referential_line_route_path( @referential, @line, route.opposite_route) %>
      <% else %>
        <%= t('.no_opposite') %>
      <% end %>
    </p>
    <p>
      <% if ! route.direction.blank? %>
        <%= route.human_attribute_name('direction_code') %> : <%= t('directions.label.'+route.direction_code) %>
      <% else %>
        <br>
      <% end %>
    </p>
  </div>
</div>