1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <%
- # Copyright (C) 2011 - present Instructure, Inc.
- #
- # This file is part of Canvas.
- #
- # Canvas is free software: you can redistribute it and/or modify it under
- # the terms of the GNU Affero General Public License as published by the Free
- # Software Foundation, version 3 of the License.
- #
- # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
- # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
- # details.
- #
- # You should have received a copy of the GNU Affero General Public License along
- # with this program. If not, see <http://www.gnu.org/licenses/>.
- %>
- <%# cache expires at the top of the next hour %>
- <% cache(['mini_calendar_render', current.to_s, first_day.to_s].cache_key, :expires_in => (3600 - (Time.now.to_i % 3600)).seconds) do %>
- <div class="mini_month">
- <div class="mini-cal-header">
- <button class="prev_month_link Button Button--icon-action"><i class="icon-arrow-open-left"></i></button>
- <button class="next_month_link Button Button--icon-action"><i class="icon-arrow-open-right"></i></button>
- <span class="mini-cal-month-and-year">
- <span class="month_name"><%= I18n.t('date.month_names')[current.month] %></span>
- <span class="year_number"><%= current.year %></span>
- </span>
- </div>
- <div style="display: none;">
- <span class="month_number"><%= current.month %></span>
- </div>
- <% today = Time.zone.today %>
- <table class="mini_calendar" cellspacing="0">
- <caption class="screenreader-only"><%= I18n.t 'Calendar' %></caption>
- <% day = first_day %>
- <thead>
- <tr>
- <% 7.times do |day_number| %>
- <th scope="col">
- <span class="screenreader-only">
- <%= I18n.t('date.day_names')[day_number] %>
- </span>
- </th>
- <% end %>
- </tr>
- </thead>
- <tbody>
- <% 6.times do %>
- <tr class="mini_calendar_week">
- <% 7.times do %>
- <td id="<%= day.strftime("mini_day_%Y_%m_%d") %>" class="mini_calendar_day day <%= day.month == current.month ? 'current_month' : "other_month #{day.month == (current.month + 1) % 12 ? 'next_month' : 'previous_month'}" %><%= day == today ? ' today' : '' %> <%= day.strftime("date_%m_%d_%Y") %>">
- <div class="day_wrapper">
- <span class="day_number">
- <%= day.day %>
- </span>
- <span class="screenreader-only previous_month_text"><%= I18n.t 'Previous month' %></span>
- <span class="screenreader-only next_month_text"><%= I18n.t 'Next month' %></span>
- <span class="screenreader-only today_text"><%= I18n.t 'Today' %></span>
- <span class="screenreader-only event_link_text"><%= I18n.t 'Click to view event details' %></span>
- </div>
- </td>
- <% day = day.next %>
- <% end %>
- </tr>
- <% end %>
- </tbody>
- </table>
- </div>
- <% end %>
|