%
# 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 .
%>
<%
event_list ||= []
title ||= t('titles.events', "Events")
display_count ||= 3
display_count += 1 if event_list.length == display_count + 1
period ||= nil
show_context ||= false
show_more ||= true
upcoming ||= false
is_recent_feedback ||= false
partial = is_recent_feedback ? 'courses/recent_feedback' : 'courses/recent_event'
contexts_to_link_to ||= nil
%>
<% if !event_list || event_list.empty? %>
-
<% if period == :one_week %>
<%= t('nothing_one_week', 'Nothing for the next week') %>
<% elsif period == :two_weeks && !is_recent_feedback %>
<%= t('nothing_two_weeks', 'Nothing for the next two weeks') %>
<% else %>
<%= t('nothing_for_now', 'Nothing for now') %>
<% end %>
<% else %>
<% (event_list || []).each_with_index do |e, i| %>
<%= render :partial => partial, :object => e, :locals => {:show_context => show_context, :is_hidden => i >= display_count, :upcoming => upcoming } %>
<% end %>
<% if event_list.length > display_count && show_more %>
-
<% if event_list.length >= 20 %>
<% if upcoming %>
<% if period == :one_week %>
<%= t('at_least_more_events_one_week_future', 'at least %{count_of_events} more in the next week', :count_of_events => (event_list.length - display_count)) %>
<% elsif period == :two_weeks %>
<%= t('at_least_more_events_two_weeks_future', 'at least %{count_of_events} more in the next two weeks', :count_of_events => (event_list.length - display_count)) %>
<% else %>
<%= t('at_least_more_events', 'at least %{count_of_events} more', :count_of_events => (event_list.length - display_count)) %>
<% end %>
<% else %>
<% if period == :one_week %>
<%= t('at_least_more_events_one_week', 'at least %{count_of_events} more in the past week', :count_of_events => (event_list.length - display_count)) %>
<% elsif period == :two_weeks %>
<%= t('at_least_more_events_two_weeks', 'at least %{count_of_events} more in the past two weeks', :count_of_events => (event_list.length - display_count)) %>
<% else %>
<%= t('at_least_more_events', 'at least %{count_of_events} more', :count_of_events => (event_list.length - display_count)) %>
<% end %>
<% end %>
<% else %>
<% if upcoming %>
<% if period == :one_week %>
<%= t('more_events_one_week_future', '%{count_of_events} more in the next week', :count_of_events => (event_list.length - display_count)) %>
<% elsif period == :two_weeks %>
<%= t('more_events_two_weeks_future', '%{count_of_events} more in the next two weeks', :count_of_events => (event_list.length - display_count)) %>
<% else %>
<%= t('more_events', '%{count_of_events} more', :count_of_events => (event_list.length - display_count)) %>
<% end %>
<% else %>
<% if period == :one_week %>
<%= t('more_events_one_week', '%{count_of_events} more in the past week', :count_of_events => (event_list.length - display_count)) %>
<% elsif period == :two_weeks %>
<%= t('more_events_two_weeks', '%{count_of_events} more in the past two weeks', :count_of_events => (event_list.length - display_count)) %>
<% else %>
<%= t('more_events', '%{count_of_events} more', :count_of_events => (event_list.length - display_count)) %>
<% end %>
<% end %>
<% end %>
…
<% end %>
<% end %>