afimb/chouette2

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

Summary

Maintainability
Test Coverage
<div class="time_table_show">

  <div class="resume">
    <div class="validity <%= time_table_state_code(@time_table) %>"></div>
    <label>
      <% if @time_table.bounding_dates.empty? %>
        <%= t(".resume_empty") %>
      <% else %>
        <%= t(".resume", :start_date => l(@time_table.bounding_dates.min),
                   :end_date => l(@time_table.bounding_dates.max)) %>
      <% end %>
    </label>
  </div>
  <div class="summary">
    <p>
      <label><%= @time_table.human_attribute_name("version") %>: </label>
      <%= @time_table.version %>
    </p>
    <p>
      <label><%= @time_table.human_attribute_name("tag_list") %>: </label>
      <%= @time_table.tag_list %>
    </p>
    <p>
      <label><%= @time_table.human_attribute_name("day_types") %>:&nbsp;&nbsp;</label>
      <% if @time_table.int_day_types & 508 == 0 %>
        <label><%= @time_table.human_attribute_name("none") %></label>
      <% else %>
          <% if @time_table.monday %>
              <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("monday") %>&nbsp;</span>
          <% end %>

          <% if @time_table.tuesday %>
              <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("tuesday") %>&nbsp;</span>
          <% end %>

          <% if @time_table.wednesday %>
            <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("wednesday") %>&nbsp;</span>
          <% end %>

          <% if @time_table.thursday %>
              <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("thursday") %>&nbsp;</span>
          <% end %>

          <% if @time_table.friday %>
              <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("friday") %>&nbsp;</span>
          <% end %>

          <% if @time_table.saturday %>
              <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("saturday") %>&nbsp;</span>
          <% end %>

          <% if @time_table.sunday %>
              <span class='day_type'>&nbsp;<%= @time_table.human_attribute_name("sunday") %>&nbsp;</span>
          <% end %>
      <% end %>
    </p>

  <h3 class="time_table_calendars">
    <a class="calendars"><%= @time_table.human_attribute_name("calendars") %>
      <%= image_tag("icons/plus.png"  , :class => "switcher", :style => "display: none;") %>
      <%= image_tag("icons/minus.png"  , :class => "switcher" ) %>
    </a>

  </h3>
  <div class="calendars content">
    <div class="year_choice">
      <span class="previous"> <%= link_to("<", referential_time_table_path(@referential, @time_table, :year => (@year - 1)) ) %> </span>
      <span class="year"> <%= "#{@year}" %> </span>
      <span class="next"> <%= link_to(">", referential_time_table_path(@referential, @time_table, :year => (@year + 1)) ) %> </span>
    </div>
    <div class="calendar_helper">
    <%= cal = ""
      (1..12).each do |month|
        cal << calendar(:year => @year, :month => month, :first_day_of_week => 1) do |d|
                 if @time_table.excluded_date?(d)
                   [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "excluded_date"}]
                 elsif @time_table.include_in_overlap_dates?(d)
                   [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "overlap_date"}]
                 elsif @time_table.include_in_dates?(d)
                   [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "selected_date"}]
                 elsif @time_table.include_in_periods?(d)
                   [link_to(d.mday, edit_referential_time_table_path(@referential, @time_table) ), {:class => "selected_period"}]
                 end
               end
      end
      cal.html_safe
    %>
    </div>
  </div>


  </div>
  <h3 class="time_table_periods">
    <a class="periods"><%= @time_table.human_attribute_name("periods") %>
      <%= image_tag("icons/plus.png"  , :class => "switcher", :style => "display: none;") %>
      <%= image_tag("icons/minus.png"  , :class => "switcher" ) %>
    </a>

  </h3>
  <div class="periods content">
      <%= render "time_tables/periods" %>
  </div>

  <h3 class="time_table_dates">
    <a class="dates"><%= @time_table.human_attribute_name("dates") %>
      <%= image_tag("icons/plus.png"  , :class => "switcher", :style => "display: none;") %>
      <%= image_tag("icons/minus.png"  , :class => "switcher" ) %>
    </a>
  </h3>

  <div class="dates content">
      <%= render "time_tables/dates" %>
  </div>

  <h3 class="time_table_dates">
    <a class="excluded_dates"><%= @time_table.human_attribute_name("excluded_dates") %>
      <%= image_tag("icons/plus.png"  , :class => "switcher", :style => "display: none;") %>
      <%= image_tag("icons/minus.png"  , :class => "switcher" ) %>
    </a>
  </h3>

  <div class="excluded_dates content">
      <%= render "time_tables/excluded_dates" %>
  </div>

</div>