mysociety/alaveteli

View on GitHub
app/views/admin_holidays/index.html.erb

Summary

Maintainability
Test Coverage
<% @title = 'Public Holidays' %>
<h1><%= @title %></h1>

<p>
  Alaveteli calculates the due dates of requests taking account of the
  public holidays shown here. If you have set the
  <code>WORKING_OR_CALENDAR_DAYS</code><a
    href="http://alaveteli.org/docs/customising/config/#working_or_calendar_days"
    target="_blank">(docs)</a> setting for Alaveteli to
  <code>working</code>, the date when a response to a request is
  officially overdue will be calculated in days that are not weekends
  or public holidays. If you have set
  <code>WORKING_OR_CALENDAR_DAYS</code> to <code>calendar</code>, the
  date will be calculated in calendar days, but if the due date falls
  on a public holiday or weekend day, then the due date is considered
  to be the next week day that isn't a holiday.
</p>

<div class="btn-toolbar">
  <div class="btn-group">
    <%= link_to 'New holiday',
                new_admin_holiday_path,
                class: 'btn btn-primary',
                id: 'new-holiday-button' %>
  </div>

  <div class="btn-group">
    <%= link_to new_admin_holiday_import_path, class: 'btn btn-warning' do %>
      Create holidays from suggestions or iCal feed
    <% end %>
  </div>
</div>

<div id="existing-holidays">
  <% @years.each do |year| %>
    <h2><%= year %></h2>

    <table class="table table-striped table-condensed">
      <tbody>
        <% @holidays_by_year[year].sort_by(&:day).each do |holiday| %>
          <% tag_opts = { class: 'holiday',
                          id: dom_id(holiday),
                          data: { target: edit_admin_holiday_path(holiday) } }
          %>

          <%= content_tag :tr, holiday, tag_opts do %>
            <%= render partial: 'holiday', locals: { holiday: holiday } %>
          <% end %>
        <% end %>
      </tbody>
    </table>
  <% end %>
</div>