current_enrollment.mustache 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. <% dashboard ||= false %>
  19. <% unless dashboard %>
  20. <tr class="course-list-table-row">
  21. <% end %>
  22. <% if current_enrollment.workflow_state == "invited" && !current_enrollment.inactive? %>
  23. <div class="<%= dashboard ? 'communication_message dashboard_notification alert alert-info' : 'reminder' %>">
  24. <h2><a href="<%= course_path(current_enrollment.course_id, :invitation => current_enrollment.uuid) %>"><%= current_enrollment.long_name %></a></h2>
  25. <div class="body">
  26. {{> views/shared/invitation}}
  27. </div>
  28. </div>
  29. <% else %>
  30. <% show_link = [:active, :invited, :accepted, :completed].include?(current_enrollment.state_based_on_date) && (!current_enrollment.course.unpublished? || current_enrollment.admin?) %>
  31. <% if @show_star_column %>
  32. <td class="course-list-star-column">
  33. <% favorite_course = @favorite_course_ids.include?(current_enrollment.course_id) %>
  34. <% past_course = @past_enrollments.include? current_enrollment %>
  35. <% favorite_past_course = past_course && favorite_course %>
  36. <% tooltip_message = t('nonfavorited_tooltip', "Click to add to the courses menu.") if !favorite_course %>
  37. <% tooltip_message = t("This course cannot be added to the courses menu at this time.") if (!show_link || past_course) %>
  38. <% tooltip_message = t('favorited_tooltip', "Click to remove from the courses menu.") if favorite_course || favorite_past_course %>
  39. <span
  40. class="<%= "course-list-favorite-course" if favorite_course %> <%= "course-list-not-favoritable disabled" if (!show_link || favorite_past_course) %> <%= "course-list-favoritable" if show_link %>"
  41. data-tooltip="bottom"
  42. title="<%= tooltip_message %>"
  43. role="button"
  44. tabindex="0"
  45. data-course-id="<%= current_enrollment.course_id %>"
  46. <% if (show_link && (favorite_past_course || !(past_course && !favorite_course))) %>
  47. <%= "data-favorite-url=#{api_v1_add_favorite_course_url(current_enrollment.course_id)}" %>
  48. <% end %>
  49. >
  50. <i class="<%= "course-list-favorite-icon #{favorite_course ? "icon-star" : "icon-star-light"}" %>"></i>
  51. <span id="course_list_screenreader_message_<%= current_enrollment.course_id %>" class="screenreader-only">
  52. <%= tooltip_message %>
  53. </span>
  54. </span>
  55. </td>
  56. <% end %>
  57. <% course_color = @current_user.custom_colors["course_#{current_enrollment.course_id}"] %>
  58. <td class="course-list-course-title-column
  59. <%= "course-list-no-left-border" if @show_star_column %>
  60. <%= "course-list-not-favoritable" unless @show_star_column %>">
  61. <% if course_color.present? %>
  62. <span aria-hidden="true" class="course-color-block" style="<%= "color: #{course_color};" %>" ></span>
  63. <% end %>
  64. <% if show_link %><a href="<%= course_path(current_enrollment.course_id) %>" title="<%= current_enrollment.course.name %>"><% end %>
  65. <span class="name">
  66. <%= current_enrollment.course.name %>
  67. </span>
  68. <% if show_link %></a>
  69. <% end %>
  70. </td>
  71. <td class="course-list-no-left-border course-list-nickname-column">
  72. <%= current_enrollment.course.nickname_for(@current_user, nil) %>
  73. </td>
  74. <td class="course-list-no-left-border course-list-term-column">
  75. <% if current_enrollment.course.enrollment_term.default_term? %>
  76. <% else %>
  77. <%= current_enrollment.course.enrollment_term.name %>
  78. <% end %>
  79. </td>
  80. <td class="course-list-no-left-border course-list-enrolled-as-column">
  81. <%= current_enrollment.readable_role_name %>
  82. </td>
  83. <td class="course-list-no-left-border course-list-published-column ">
  84. <% if current_enrollment.course.created? || current_enrollment.course.claimed? %>
  85. <span data-tooltip title="{{#t}}This course has not been published. Students should contact the course instructor for access.") %>"><%= t('unpublished_course', "No{{/t}}</span>
  86. <% else %>
  87. <span data-tooltip title="{{#t}}This course has been published.") %>"><%= t('published_course', "Yes{{/t}}</span>
  88. <% end %>
  89. </td>
  90. <% end %>
  91. <% unless dashboard %>
  92. </tr>
  93. <% end %>