<% # 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| %>
<%= f.text_field :subject, :value => announcement.subject, :class => 'ic-Input', :id => "account_notification_subject_#{announcement.id}" %>
<%= f.text_area :message, :value => announcement.message, :id => "account_notification_message_#{announcement.id}", :class => 'alert_message edit_notification_form' %> <% if @account.site_admin? %>

<%= t("Enter \"{{ACCOUNT_DOMAIN}}\" to substitute the user's root account domain") %>

<%= t("Enter \"{{CANVAS_USER_ID}}\" to substitute the user's unique Canvas ID") %>

<% end %>
<% 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 "Show to" %> <%= roles_message(@account) %>
<%= t "Course roles" %>
<% role_ids = announcement.account_notification_roles.map {|r| r.role_id} %> <% @course_roles.each do |r| %> <% course_role_checked = role_ids.include? r[:id] %>
<%= check_box_tag "account_notification_roles[]", r[:id], course_role_checked, { :class => "account_notification_role_cbx", :id => "account_notification_role_#{r[:id]}_cbx_#{announcement.id}" } %>
<% end %> <% if @account.root_account? %> <% nil_role_checked = role_ids.include? nil %>
<%= check_box_tag "account_notification_roles[]", "NilEnrollment", nil_role_checked, { :class => "account_notification_role_cbx", :id => "account_notification_role_NilEnrollment_cbx_#{announcement.id}" } %>
<% end %>
<%= t "Account roles" %> <% @account_roles.each do |r| %> <% account_role_checked = role_ids.include? r[:id] %>
<%= check_box_tag "account_notification_roles[]", r[:id], account_role_checked, { :class => "account_notification_role_cbx", :id => "account_notification_role_#{r[:id]}_cbx_#{announcement.id}" } %>
<% end %>
<% 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 %>
<% 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 %>