afimb/chouette2

View on GitHub
app/views/time_tables/_time_table.html.erb

Summary

Maintainability
Test Coverage
<div id="index_item" class="panel panel-default time_table">
  <div class="panel-heading">
    <div class="panel-title clearfix">
      <% if policy(:application).write? %>
        <span class="pull-right">
          <%= link_to edit_referential_time_table_path(@referential, time_table), :class => "btn btn-default btn-sm" do %>
            <span class="fa fa-pencil"></span>
          <% end %>
          <%= link_to('<span class="fa fa-trash-o"></span>'.html_safe, referential_time_table_path(@referential, time_table), :method => :delete, :data => {:confirm =>  t('time_tables.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm") if delete %>
        </span>
      <% end %>
      <h5>
        <%= link_to([@referential, time_table], :class => "preview", :title => "#{Chouette::TimeTable.model_name.human.capitalize} #{time_table.comment}") do %>
        <span class="state-code <%= time_table.presenter.time_table_state_code %>"><i class="fa fa-certificate"></i></span>
        <span class="name">
          <%= truncate(time_table.comment, :length => 20) %>
        </span>
        <% end %>
      </h5>
    </div>
  </div>
  <div class="panel-body">
    <%= time_table.presenter.time_tables_shortest_info %>
    <% unless time_table.periods.empty? %>
      <div>
      <% %w(monday tuesday wednesday thursday friday saturday sunday).each do |day_type| %>
        <span class="<%= time_table.send( day_type) ? "included_day_type" : "excluded_day_type" %>">
          <%= time_table.human_attribute_name(day_type).first(2) %>
        </span>
      <% end %>
      </div>
    <% end %>
    <% unless time_table.tags.empty? %>
      <div><%= time_table.presenter.tag_list_shortened %></div>
    <% end %>
  </div>
</div>