submission_sidebar.mustache 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. <% cache([
  19. 'submission_sidebar_render',
  20. @current_user_submission,
  21. Time.zone.utc_offset,
  22. @current_user_submission.assigned_assessments.count,
  23. @current_user_submission.assigned_assessments.incomplete.count
  24. ].cache_key) do %>
  25. <div class="details">
  26. <h3><%= t 'titles.submission', "Submission" %></h3>
  27. <% if @current_user_submission.excused? %>
  28. <div class="header">
  29. <%= t "Excused!" %>
  30. </div>
  31. <% elsif @assignment.expects_submission? %>
  32. <div class="header">
  33. <% if @current_user_submission.has_submission? %>
  34. <i class="icon-check" aria-hidden="true"></i>
  35. <%= t 'titles.submission_turned_in', "Turned In!" %>
  36. <% else %>
  37. <i class="icon-x" aria-hidden="true"></i>
  38. <%= t 'titles.submission_not_turned_in', "Not Turned In!" %>
  39. <% end %>
  40. </div>
  41. <% end %>
  42. <div class="content">
  43. <span class="<%= "late" if @current_user_submission.late? %>">
  44. <% if @current_user_submission.late? %>
  45. <%= t 'messages.submission_late_timestamp', "%{submitted_at} (late)", :submitted_at => datetime_string(@current_user_submission.submitted_at) %>
  46. <% else %>
  47. <%= datetime_string(@current_user_submission.submitted_at) %>
  48. <% end %>
  49. </span>
  50. <div>
  51. <a href="<%= context_url(@assignment.context, :context_assignment_submission_url, @assignment.id, @current_user.id) %>">
  52. <%= t 'links.submission.details', "Submission Details" %>
  53. </a>
  54. </div>
  55. <% if @current_user_submission.submission_type == "online_url" %>
  56. <div>
  57. <a href="<%= @current_user_submission.url %>" target="_new" id="view-original-link">
  58. <%= t 'links.submission.view_original_page', "View the Original Page" %>
  59. </a>
  60. </div>
  61. <% elsif @current_user_submission.submission_type == "online_upload" %>
  62. <% @current_user_submission.attachments.each do |attachment| %>
  63. <div>
  64. <a href="<%= context_url(@context, :context_assignment_submission_url, @assignment.id, @current_user_submission.user_id, :download => attachment.id) %>">
  65. <%= t 'links.submission.download_attachment', "Download %{attachment_display_name}", {
  66. :attachment_display_name => attachment.display_name
  67. } %>
  68. </a>
  69. </div>
  70. <% end %>
  71. <% elsif @current_user_submission.submission_type == "online_quiz" %>
  72. <a href="<%= context_url(@assignment.context, :context_quiz_url, @assignment.quiz.id) %>" target="_new">
  73. <i class="icon-quiz" aria-hidden="true"></i>
  74. <%= @assignment.quiz.survey? ? t('links.submission.view_survey', "View the Survey Submission") :
  75. t('links.submission.view_quiz', "View the Quiz Submission") %>
  76. </a>
  77. <% end %>
  78. <div class="module">
  79. <% if @current_user_submission.grade && !@assignment.muted? %>
  80. <% if @current_user_submission.excused? %>
  81. <span><%= t "This assignment has been excused." %></span>
  82. <% else %>
  83. <div><%= t 'labels.grade', "Grade: %{grade} *(%{points_possible} pts possible)*", {
  84. :grade => i18n_grade(@current_user_submission.grade, @assignment.grading_type),
  85. :points_possible => n(round_if_whole(@assignment.points_possible)),
  86. :wrapper => '<span style="font-size: 0.8em;">\1</span>'
  87. } %></div>
  88. <div><%= t 'labels.graded_anonymously', "Graded Anonymously: %{value}", {
  89. :value => @current_user_submission.graded_anonymously ? t('labels.yes', "yes") : t('labels.no', "no")
  90. } %></div>
  91. <% end %>
  92. <% end %>
  93. <% if @current_user_submission.rubric_assessment %>
  94. <a href="<%= context_url(@context, :context_assignment_submission_url, @assignment.id, @current_user_submission.user_id) %>#rubric" class='Submission__Link--has-icon'>
  95. <i class="icon-rubric" aria-hidden="true"></i>
  96. <%= t 'links.view_rubric_evaluation', "View Rubric Evaluation" %>
  97. </a>
  98. <% end %>
  99. </div>
  100. <% if @assignment.has_peer_reviews? && @current_user_submission.user == @current_user %>
  101. <h4><%= t 'titles.assigned_peer_reviews', "Assigned Peer Reviews" %></h4>
  102. <ul class="unstyled_list Submission__List">
  103. <li style="<%= hidden unless @current_user_submission.assigned_assessments.empty? %>"><%= t 'labels.none_assigned', "None Assigned" %></li>
  104. <% @current_user_submission.assigned_assessments.each do |assessment| %>
  105. <li><%= student_peer_review_link_for @context, @assignment, assessment %></li>
  106. <% end %>
  107. </ul>
  108. <% end %>
  109. <div class="comments module">
  110. <% if @assignment.muted? %>
  111. <p><%= t 'You may not see all comments right now because the assignment is currently being graded.' %></p>
  112. <% else %>
  113. <h4><%= t 'titles.comments', "Comments:" %> </h4>
  114. <% visible_comments = @current_user_submission.visible_submission_comments -%>
  115. <%= t('messages.no_comments', "No Comments") if visible_comments.empty? %>
  116. <% visible_comments.each do |comment| %>
  117. <div id="comment-<%= comment.id %>" class="comment">
  118. <%= comment.comment %>
  119. <div class="comment_attachments">
  120. <% comment.attachments.each do |attachment| %>
  121. <div class="comment_attachment">
  122. <a href="<%= context_url(@context, :context_assignment_submission_url, @assignment.id, @current_user_submission.user_id, :comment_id => comment.id, :download => attachment.id) %>" class="comment_attachment_link <%= attachment.mime_class %>"><%= attachment.display_name %></a>
  123. </div>
  124. <% end %>
  125. </div>
  126. <div class="signature" style="font-size: 0.8em; text-align: right; color: #888;">
  127. <%= t :comment_signature, "%{author}, %{created_at}", {
  128. :author => comment_author_name_for(comment),
  129. :created_at => datetime_string(comment.created_at)
  130. } %>
  131. </div>
  132. </div>
  133. <% end %>
  134. <% end %>
  135. </div>
  136. </div>
  137. </div>
  138. <% end %>