<%
# 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/>.
%>

<%
   provide :page_title, t(:page_title, 'Notification Preferences')
   css_bundle :notification_preferences
   js_bundle :notification_preferences
   add_crumb(@user.short_name, user_profile_path(@current_user) )
   add_crumb(t(:crumb_notification_preferences, 'Notification Preferences'), communication_profile_path )
%>


<style type="text/css">
  .event-option-buttons label {
    width: 1.7em;
    padding: 0;
  }
</style>


<h1><%= t('headers.notification_preferences', 'Notification Preferences') %><i id="notifications_save_status"></i></h1>

<% unless @current_user.registered? %>
  <p class="alert alert-info">
    <%= t "confirm_email_instructions", <<-TEXT, :email => @current_user.email, :wrapper => {'*' => '<a href="' + re_send_confirmation_path(@current_user, @current_user.communication_channel) + '" class="re_send_confirmation_link">\1</a>'}
      Before you can receive any notifications, you need to verify your email address (%{email}) by clicking the link in the email we sent you.
      If you don't see it, *click to re-send the email*, and make sure to check your spam box.
    TEXT
    %>
  </p>
<% end %>

<div id="notification-preferences" class="notification-table-wrapper">
</div>

<span class='weekly_notification_range'>
  <% weekly_notification_range = @current_user.weekly_notification_range %>
  <%= t "weekly_notification_range", "Your weekly notifications will be sent %{weekday} between %{start_time} and %{end_time}.",
    :weekday => I18n.l(weekly_notification_range.first.in_time_zone.to_date, :format => :weekday),
    :start_time => time_string(weekly_notification_range.first),
    :end_time => time_string(weekly_notification_range.last) %>
</span>
