alerts.mustache 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <%
  2. # Copyright (C) 2011 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <% css_bundle :alerts %>
  19. <% js_bundle :alerts %>
  20. <p>
  21. <%=
  22. if @context.is_a? Course
  23. t(:alerts_description_course,
  24. 'An alert is generated for each student that meets all of the criteria. They are ' +
  25. 'checked every day, and notifications will be sent to the student and/or the ' +
  26. 'teacher until the triggering problem is resolved.')
  27. else
  28. t(:alerts_description_account,
  29. 'An alert is generated for each student that meets all of the criteria. They are ' +
  30. 'checked every day, and notifications will be sent to the student, teacher, and/or ' +
  31. 'account admin until the triggering problem is resolved.')
  32. end
  33. %>
  34. </p>
  35. <div class="alerts_list">
  36. {{> views/alerts/alert}}
  37. {{> views/alerts/alert}}
  38. <a href="#" class="delete_item_link editing" style="display:none;" title="{{#t}}Remove this item{{/t}}"><i class="icon-end"></i></a>
  39. </div>
  40. <div class="button-container" style="margin-top: 20px;">
  41. <button class="Button Button--primary add_alert_link">
  42. <span aria-hidden="true"><i class="icon-plus"></i> {{#t}}Alert{{/t}}</span>
  43. </button>
  44. </div>
  45. <%
  46. count = "%{count}" # we'll replace this with an input in js-land
  47. alert_data = {
  48. :DATA => @alerts,
  49. :POSSIBLE_RECIPIENTS_ORDER => [':student', ':teachers'],
  50. :POSSIBLE_RECIPIENTS => {
  51. ':student' => {:label => t(:the_student, "The Student")},
  52. ':teachers' => {:label => t(:the_teacher, "The Teacher")}
  53. },
  54. :POSSIBLE_CRITERIA_ORDER => ['Interaction', 'UngradedCount', 'UngradedTimespan'],
  55. :POSSIBLE_CRITERIA => {
  56. :Interaction => {
  57. :label => t(:description, "A teacher has not interacted with the student for %{count} days", :count => count),
  58. :option => t(:option, "No Teacher Interaction"),
  59. :title => t(:title, "Days since a teacher has interacted with the student"),
  60. :default_threshold => 7
  61. },
  62. :UngradedCount => {
  63. :label => t(:ungraded_count_description, "More than %{count} submissions have not been graded", :count => count),
  64. :option => t(:ungraded_count_option, "Ungraded Submissions (Count)"),
  65. :title => t(:ungraded_count_title, "Number of submissions that have not been graded"),
  66. :default_threshold => 3
  67. },
  68. :UngradedTimespan => {
  69. :label => t(:ungraded_timespan_description, "A submission has been left ungraded for %{count} days", :count => count),
  70. :option => t(:ungraded_timespan_option, "Ungraded Submissions (Time)"),
  71. :title => t(:ungraded_timespan_title, "Days that a submission has been left ungraded"),
  72. :default_threshold => 7
  73. }
  74. }
  75. }
  76. (@account_roles || []).each do |role|
  77. alert_data[:POSSIBLE_RECIPIENTS_ORDER] << role[:id]
  78. alert_data[:POSSIBLE_RECIPIENTS][role[:id]] = {:label => role[:label]}
  79. end
  80. if @context.enable_user_notes
  81. alert_data[:POSSIBLE_CRITERIA_ORDER] << 'UserNote'
  82. alert_data[:POSSIBLE_CRITERIA]['UserNote'] = {
  83. :label => t(:usernote_description, "No faculty journal entry has been added for %{count} days", :count => count),
  84. :option => t(:usernote_option, "No Faculty Journal Entry"),
  85. :title => t(:usernote_title, "Days since a faculty journal has been added"),
  86. :default_threshold => 7
  87. }
  88. end
  89. js_env :ALERTS => alert_data
  90. %>