recent_feedback.mustache 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. <li style="<%= hidden if is_hidden %>" class="event">
  19. <%
  20. recent_feedback ||= nil
  21. show_context ||= false
  22. comment = nil
  23. grade = nil
  24. score = nil
  25. # current user needs to be in the cache key to bust the cache when they change course nicknames
  26. cache(['recent_feedback_render3', @current_user, recent_feedback || 'blank_feedback', Time.zone.utc_offset].cache_key) do
  27. context = recent_feedback.context
  28. assignment = recent_feedback.assignment
  29. url = context_url(context, :context_assignment_submission_url, :assignment_id => recent_feedback.assignment_id, :id=>@current_user.id)
  30. grade = readable_grade(recent_feedback)
  31. score = recent_feedback.score
  32. comment = recent_feedback.last_teacher_comment
  33. comment_text = HtmlTextHelper.strip_and_truncate(comment.comment, :max_length => 120) if comment
  34. icon_explanation, _, icon_class = icon_data(:context => context,
  35. :current_user => @current_user,
  36. :recent_event => assignment,
  37. :submission => recent_feedback,
  38. :student_only => true)
  39. %>
  40. <a
  41. data-track-category="dashboard"
  42. data-track-label="recent feedback"
  43. class="recent_feedback_icon" href="<%= url %>"
  44. >
  45. <i class="<%= icon_class %>"></i>
  46. <div class="event-details">
  47. <% if comment && comment.media_comment? %>
  48. <% kaltura_thumbnail_url = CanvasKaltura::ClientV3.new.thumbnail_url(comment.media_comment_id, :width => 50, :height => 35, :bgcolor => "F3F4F5") %>
  49. <img src="<%= kaltura_thumbnail_url %>" style="max-width: 50px; max-height: 35px; float: right; padding-left: 3px;" alt=""/>
  50. <% end %>
  51. <b class="event-details__title recent_feedback_title">
  52. <%= recent_feedback.assignment.title %>
  53. </b>
  54. <% if show_context %>
  55. <p class="event-details__context">
  56. <%= context.nickname_for(@current_user, :short_name) %>
  57. </p>
  58. <% end %>
  59. <% if grade %>
  60. <p><strong><%= grade %></strong></p>
  61. <% end %>
  62. <% if comment_text %>
  63. <p>"<%= comment_text %>"</p>
  64. <% end %>
  65. </div>
  66. <div class="clear"></div>
  67. </a>
  68. <div class="clear"></div>
  69. <% end %>
  70. </li>