outcome_result.mustache 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. <% outcome_result ||= nil %>
  19. <% show_results_link = true if show_results_link.nil? %>
  20. <li class="outcome_result" id="result_<%= outcome_result ? outcome_result.id : "blank" %>" style="<%= hidden unless outcome_result %>">
  21. <% if show_results_link %>
  22. <a href="<%= context_url(@context, :context_outcome_result_url, @outcome, outcome_result ? outcome_result.id : "{{ id }}") %>" class="title">
  23. <% else %>
  24. <span class="title">
  25. <% end %>
  26. <%= outcome_result.try_rescue(:title) %>
  27. <% if show_results_link %>
  28. </a>
  29. <% else %>
  30. </span>
  31. <% end %>
  32. <div class="scoring">
  33. <%= t :scoring, "%{points} out of %{possible_points}",
  34. :points => raw("<span class=\"score\">#{outcome_result.try_rescue(:score) || nbsp}</span>"),
  35. :possible_points => raw("<span class=\"possible\">#{outcome_result.try_rescue(:possible) || nbsp}</span>")
  36. %>
  37. <% if outcome_result && outcome_result.mastery? %>
  38. <span class="mastery">(<i class="icon-check" aria-hidden="true"></i><%= t :outcome_mastered, 'mastered' %>)</span>
  39. <% end %>
  40. </div>
  41. <div class="last_attempt">
  42. <%= t :attempt_info, "attempt #%{attempt_number}, %{attempt_date}", :attempt_number => "<span class=\"attempt\">#{outcome_result.try_rescue(:attempt) || "1"}</span>".html_safe, :attempt_date => "<span class=\"assessed_at_formatted\">#{datetime_string(outcome_result.try_rescue(:assessed_at))}</span>".html_safe %>
  43. </div>
  44. <% if show_results_link %>
  45. <div class="results_link">
  46. <a href="<%= context_url(@context, :context_user_outcomes_results_url, outcome_result ? outcome_result.user_id : "{{ user_id }}") %>"><%= t :all_outcomes, "all outcome results for this student" %></a>
  47. </div>
  48. <% end %>
  49. </li>