123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <%
- # 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 <http://www.gnu.org/licenses/>.
- %>
- <%= 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| %>
- <div class="grid-row">
- <div class="col-xs-12 col-lg-6">
- <div class="ic-Form-control">
- <label for="<%= "account_notification_subject_#{announcement.id}" %>" class="ic-Label">
- {{#t}}Title{{/t}}
- </label>
- <%= f.text_field :subject, :value => announcement.subject, :class => 'ic-Input', :id => "account_notification_subject_#{announcement.id}" %>
- </div>
- </div>
- <div class="col-xs-12 col-lg-6">
- <div class="ic-Form-control">
- <label for="account_notification_icon" class="ic-Label">
- {{#t}}Announcement type{{/t}}
- </label>
- <select id="account_notification_icon" 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) %>
- </select>
- </div>
- </div>
- </div>
- <div class="ic-Form-control">
- <label for="account_notification_message_<%= announcement.id %>" class="ic-Label">
- {{#t}}Message{{/t}}
- </label>
- <%= f.text_area :message, :value => announcement.message, :id => "account_notification_message_#{announcement.id}", :class => 'alert_message edit_notification_form' %>
- <% if @account.site_admin? %>
- <p>{{#t}}Enter \"{{ACCOUNT_DOMAIN}}\" to substitute the user's root account domain{{/t}}</p>
- <p>{{#t}}Enter \"{{CANVAS_USER_ID}}\" to substitute the user's unique Canvas ID{{/t}}</p>
- <% end %>
- </div>
- <div class="ic-Form-control">
- <div class="ic-Label" id="aria-announcements-send-to-group">
- <%= t "Send to" %>
- <%= roles_message(@account) %>
- </div>
- <div class="grid-row">
- <div class="col-xs-12 col-lg-4">
- <i><%= t "Course roles" %></i>
- <div class="ic-Checkbox-group" role="group" aria-labelledby="aria-announcements-send-to-group">
- <% role_ids = announcement.account_notification_roles.map {|r| r.role_id} %>
- <% @course_roles.each do |r| %>
- <% course_role_checked = role_ids.include? r[:id] %>
- <div class="ic-Form-control ic-Form-control--checkbox">
- <%= 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}" } %>
- <label class="ic-Label" for="<%= "account_notification_role_#{r[:id]}_cbx_#{announcement.id}" %>">
- <%= r[:label] %>
- <span class="screenreader-only">
- <%=t "Send this announcement to users with the course role of %{role}", :role => r[:label] %>
- </span>
- </label>
- </div>
- <% end %>
- <% if @account.root_account? %>
- <% nil_role_checked = role_ids.include? nil %>
- <div class="ic-Form-control ic-Form-control--checkbox">
- <%= check_box_tag "account_notification_roles[]", "NilEnrollment", nil_role_checked, { :class => "account_notification_role_cbx", :id => "account_notification_role_NilEnrollment_cbx_#{announcement.id}" } %>
- <label class="ic-Label" for="<%= "account_notification_role_NilEnrollment_cbx_#{announcement.id}" %>">
- <%= t "Unenrolled users" %>
- <span class="screenreader-only">
- <%=t "Send this announcement to unenrolled users" %>
- </span>
- </label>
- </div>
- <% end %>
- </div>
- </div>
- <div class="col-xs-12 col-lg-4">
- <i><%= t "Account roles" %></i>
- <% @account_roles.each do |r| %>
- <% account_role_checked = role_ids.include? r[:id] %>
- <div class="ic-Form-control ic-Form-control--checkbox">
- <%= 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}" } %>
- <label class="ic-Label" for="<%= "account_notification_role_#{r[:id]}_cbx_#{announcement.id}" %>">
- <%= r[:label] %>
- <span class="screenreader-only">
- <%=t "Send this announcement to users with the account role of %{role}", :role => r[:label] %>
- </span>
- </label>
- </div>
- <% end %>
- </div>
- </div>
- </div>
- <div class="grid-row">
- <div class="col-xs-12 col-lg-6">
- <div class="ic-Form-control">
- <label class="ic-Label" id="announcement_starts_at_label">
- {{#t}}Announcement starts at{{/t}}
- <span class="screenreader-only">
- <%= datepicker_screenreader_prompt %>
- </span>
- </label>
- <% 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 %>
- </div>
- </div>
- <div class="col-xs-12 col-lg-6">
- <div class="ic-Form-control">
- <label class="ic-Label" id="announcement_ends_at_label">
- {{#t}}Announcement ends at{{/t}}
- <span class="screenreader-only">
- <%= datepicker_screenreader_prompt %>
- </span>
- </label>
- <% 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 %>
- </div>
- </div>
- </div>
- <div class="ic-Form-actions">
- <%= 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') %>
- </div>
- <% end %>
|