forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrades.html.erb
More file actions
122 lines (120 loc) · 6.28 KB
/
Copy pathgrades.html.erb
File metadata and controls
122 lines (120 loc) · 6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>
<%
content_for :page_title, join_title(t(:page_title, "Grades"), @current_user.name)
js_bundle :user_grades
css_bundle :user_grades
%>
<h1 class='screenreader-only'><%= t(:page_title, 'Grades') %></h1>
<% unless @presenter.student_enrollments.empty? %>
<h2><%= t('titles.current_student_courses', "Courses I'm Taking") %></h2>
<table class="course_details student_grades">
<% @presenter.student_enrollments.each do |course, enrollment| %>
<tr>
<td class="course"><a href="<%= course_student_grades_path(course.id, enrollment.user_id) %>"><%= course.name %></a></td>
<td class="percent">
<% if course.hide_final_grades? || (@grading_periods[course.id] && @grading_periods[course.id][:selected_period_id] == 0 && !course.display_totals_for_all_grading_periods?)%>
--
<% elsif @grades[:student_enrollments][course.id] %>
<%= I18n.n(@grades[:student_enrollments][course.id], percentage: true) %>
<% else %>
<%= t('no_grade', 'no grade') %>
<% end %>
</td>
<td style="display: none;"><a href="#" title="<%= t('send_teacher_message', 'Send a Message to the Teacher') %>" class="no-hover"><%= image_tag "email.png", :alt => t('Send a Message to the Teacher') %></a></td>
<td class="grading_period_dropdown">
<% if @grading_periods[course.id] %>
<%= render partial: "shared/grading_periods_selector", locals: {selected_period_id: @grading_periods[course.id][:selected_period_id], enrollment_id: enrollment.global_id, grading_periods: @grading_periods[course.id][:periods], all_grading_periods_option: course.display_totals_for_all_grading_periods?} %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% end %>
<% unless @presenter.observed_enrollments.empty? %>
<h2 style="margin-top: 20px;"><%= t('linked_student_accounts', 'Linked Student Accounts') %></h2>
<table class="course_details observer_grades">
<% @presenter.observed_enrollments.each do |enrollment| %>
<tr>
<td class="course"><a href="<%= course_student_grades_path(enrollment.course_id, enrollment.user_id) %>"><%= context_user_name(enrollment.course, enrollment.user_id) %>, <%= enrollment.course.name %></a></td>
<td class="percent">
<% if enrollment.course.hide_final_grades? || (@grading_periods[enrollment.course_id] && @grading_periods[enrollment.course_id][:selected_period_id] == 0) && !enrollment.course.display_totals_for_all_grading_periods?%>
--
<% elsif @grades[:observed_enrollments][enrollment.course_id][enrollment.user_id] %>
<%= @grades[:observed_enrollments][enrollment.course_id][enrollment.user_id] %>%
<% else %>
<%= t('no_grade', 'no grade') %>
<% end %>
</td>
<td style="display: none;"><a href="#" title="<%= t('send_teacher_message', 'Send a Message to the Teacher') %>" class="no-hover"><%= image_tag "email.png", :alt => t('Send a Message to the Teacher') %></a></td>
<td class="grading_period_dropdown">
<% if @grading_periods[enrollment.course_id] %>
<%= render partial: "shared/grading_periods_selector", locals: {selected_period_id: @grading_periods[enrollment.course_id][:selected_period_id], enrollment_id: enrollment.global_id, grading_periods: @grading_periods[enrollment.course_id][:periods], all_grading_periods_option: enrollment.course.display_totals_for_all_grading_periods?} %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% end %>
<% unless @presenter.teacher_enrollments.empty? %>
<h2 style="margin-top: 20px;"><%= t('current_teacher_courses', "Courses I'm Teaching") %></h2>
<table class="course_details teacher_grades">
<% @presenter.teacher_enrollments.each do |enrollment| %>
<tr>
<td class="course" style="vertical-align: middle;"><a href="<%= course_grades_path(enrollment.course_id) %>"><%= enrollment.course.name %></a></td>
<td class="percent">
<% if @presenter.course_grade_summaries[enrollment.course_id][:score] %>
<%= n(@presenter.course_grade_summaries[enrollment.course_id][:score], percentage: true, precision: 2) %>
<div style="font-size: 0.6em; font-weight: normal;"><%= t('average_grades', {:one => "average for 1 student", :other => "average for %{count} students"}, :count => @presenter.course_grade_summaries[enrollment.course_id][:students]) %></div>
<% else %>
<span style="font-weight: normal; font-size: 0.9em;"><%= t('no_grades', 'no grades') %></span>
<% end %>
</td>
<td style="display: none;"><a href="#" title="<%= t('send_teacher_message', 'Send a Message to the Teacher') %>" class="no-hover"><%= image_tag "email.png", :alt => t('Send a Message to the Teacher') %></a></td>
<td class="report">
<%= link_to(t('links.teacher_activity', 'Student Interactions Report'), user_course_teacher_activity_url(@current_user, enrollment.course_id)) unless @presenter.course_grade_summaries[enrollment.course_id][:students].try(:zero?) %>
</td>
</tr>
<% end %>
</table>
<% end %>
<% unless @presenter.prior_enrollments.empty? %>
<div style="margin-top: 20px; display: none;" id="previous_courses">
<h2><%= t('titles.previous_courses', 'Previous Courses') %></h2>
<table class="summary" style="margin-left: 20px; min-width: 350px;">
<thead><tr>
<th><%= t('course', 'Course') %></th>
<th><%= t('percent', 'Percent') %></th>
</tr></thead>
<% @presenter.prior_enrollments.each do |enrollment| %>
<tr>
<td><%= enrollment.course.name %></td>
<td>
<% if enrollment.course.hide_final_grades? %>
--
<% elsif enrollment.computed_current_score %>
<%= enrollment.computed_current_score %>%
<% else %>
--
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<% end %>