%
# Copyright (C) 2016 - 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 .
%>
<%= form_for :account_notification,
url: {controller: 'account_notifications', action: 'update', id: announcement.id},
html: {
id: "edit_notification_form_#{announcement.id}",
class: 'edit_notification_form hidden_form',
role: 'region',
method: 'put' } do |f| %>
" class="ic-Label">
<%= t("Title") %>
<%= f.text_field :subject, :value => announcement.subject, :class => 'ic-Input', :id => "account_notification_subject_#{announcement.id}" %>
" class="ic-Label">
<%= t("Announcement type") %>
" class="ic-Input" name="account_notification[icon]">
<%= options_for_select([[t("information"), "information", {:class=>"information"}],
[t("error"), "error", {:class=>"error"}],
[t("warning"), "warning", {:class=>"warning"}],
[t("question"), "question", {:class=>"question"}],
[t("calendar"), "calendar", {:class=>"calendar"}]], announcement.icon) %>
<% if @account.root_account.trust_exists? %>
<%= f.check_box :domain_specific, :checked => announcement.domain_specific %>
<%= f.label :domain_specific, t("Only show announcement on current account domain") %>
<% end %>
<%= t("Announcement starts at") %>
<%= datepicker_screenreader_prompt %>
<% if announcement.start_at < Date.today %>
<%= f.text_field :start_at,
:value => announcement.start_at.strftime('%b %d, %Y %-I:%M%P'),
:id => "account_notification_start_at_#{announcement.id}",
"aria-labelledby" => "announcement_starts_at_label",
:title => accessible_date_format,
:readonly => true %>
<% else %>
<%= f.text_field :start_at,
:value => announcement.start_at.strftime('%b %d, %Y %-I:%M%P'),
:id => "account_notification_start_at_#{announcement.id}",
:class => 'datetime_field',
"aria-labelledby" => "announcement_starts_at_label",
"data-tooltip" => "",
:title => accessible_date_format %>
<% end %>
<%= t("Announcement ends at") %>
<%= datepicker_screenreader_prompt %>
<% if announcement.end_at < Date.today %>
<%= f.text_field :end_at,
:value => announcement.end_at.strftime('%b %d, %Y %-I:%M%P'),
:id => "account_notification_end_at_#{announcement.id}",
"aria-labelledby" => "announcement_ends_at_label",
:title => accessible_date_format,
:readonly => true %>
<% else %>
<%= f.text_field :end_at,
:value => announcement.end_at.strftime('%b %d, %Y %-I:%M%P'),
:id => "account_notification_end_at_#{announcement.id}",
:class => 'datetime_field',
"aria-labelledby" => "announcement_ends_at_label",
"data-tooltip" => "",
:title => accessible_date_format %>
<% end %>
<% if !@account.site_admin? %>
<%= f.check_box :send_message, :checked => announcement.send_message? && !announcement.messages_sent_at,
:id => "account_notification_send_message_#{announcement.id}" %>
<% if announcement.messages_sent_at? %>
<%= f.label :send_message, t("Re-send notification directly to users when announcement starts"),
:class => "ic-Label", :for => "account_notification_send_message_#{announcement.id}" %>
<% else %>
<%= f.label :send_message, t("Send notification directly to users when announcement starts"),
:class => "ic-Label", :for => "account_notification_send_message_#{announcement.id}" %>
<% end %>
<% end %>
<%= button_tag(t("Cancel"), :class => "element_toggler btn button-secondary edit_cancel_focus", 'aria-controls' => "edit_notification_form_#{announcement.id}", 'data-cancel-focus-id' => announcement.id) %>
<%= button_tag(t("Save Changes"), :class => 'btn btn-primary') %>
<% end %>