|
1 |
| -<% unless @bare_layout %> |
2 |
| - <div class="course-point-header"> |
3 |
| - <h1>Summary of points for <%= @course.title %></h1> |
4 |
| - <% if can?(:teach, @course) %> |
5 |
| - <div class="alternative-format-links"><%= link_to('Export as CSV', organization_course_points_path(@organization, @course, :sort_by => params[:sort_by], :format => 'csv'), class: "btn btn-primary") %></div> |
| 1 | +<div class="points-container"> |
| 2 | + <% unless @bare_layout %> |
| 3 | + <div class="course-point-header"> |
| 4 | + <h1>Summary of points for <%= @course.title %></h1> |
| 5 | + <% if can?(:teach, @course) %> |
| 6 | + <div class="alternative-format-links"><%= link_to('Export as CSV', organization_course_points_path(@organization, @course, :sort_by => params[:sort_by], :format => 'csv'), class: "btn btn-primary") %></div> |
| 7 | + <% end %> |
| 8 | + </div> |
6 | 9 | <% end %>
|
7 |
| - </div> |
8 |
| -<% end %> |
9 | 10 |
|
10 |
| -<% |
11 |
| - show_total_column = @summary[:sheets].size > 1 |
12 |
| -%> |
| 11 | + <% |
| 12 | + show_total_column = @summary[:sheets].size > 1 |
| 13 | + %> |
13 | 14 |
|
14 |
| -<%= content_tag('div', :class => if @bare_layout then nil else 'scrollable' end) do %> |
15 |
| - <table class="points"> |
16 |
| - <thead> |
17 |
| - <tr> |
18 |
| - <th></th> |
19 |
| - <th colspan="<%= (@user_fields ? @user_fields.length : 0) + 1 %>">Number of students</th> |
20 |
| - <% if !@summary[:sheets].empty? %> |
21 |
| - <th colspan="<%= @summary[:sheets].count %>">Total points/possible</th> |
22 |
| - <% end %> |
23 |
| - <% if show_total_column %> |
24 |
| - <th>Total</th> |
25 |
| - <% end %> |
26 |
| - </tr> |
27 |
| - <tr class="table-totals"> |
28 |
| - <td>-</td> |
29 |
| - <% nstudents = @summary[:users].length %> |
30 |
| - <td><%= nstudents %></td> |
31 |
| - <% if @user_fields %> |
32 |
| - <td colspan="<%= @user_fields.length %>"></td> |
33 |
| - <% end %> |
34 |
| - <% @summary[:sheets].each do |sheet| %> |
35 |
| - <td> |
36 |
| - <%= "#{sheet[:total_awarded]}/#{sheet[:total_available]*nstudents}" %> |
37 |
| - </td> |
38 |
| - <% end %> |
39 |
| - <% if show_total_column %> |
40 |
| - <td> |
41 |
| - <%= "#{@summary[:total_awarded]}/#{@summary[:total_available]*nstudents}" %> |
42 |
| - </td> |
43 |
| - <% end %> |
44 |
| - </tr> |
45 |
| - <tr> |
46 |
| - <th></th> |
47 |
| - <th> |
48 |
| - Student<br /> |
49 |
| - <% unless params[:sort_by].blank? %> |
50 |
| - [<%= link_to 'sort', organization_course_points_path(@organization, @course) %>] |
51 |
| - <% else %> |
52 |
| - [sort] |
53 |
| - <% end %> |
54 |
| - </th> |
55 |
| - <% if @user_fields %> |
56 |
| - <% @user_fields.each do |field| %> |
57 |
| - <th><%= field.label %></th> |
| 15 | + <div class="scrollable-container"> |
| 16 | + <%= content_tag('div', :class => if @bare_layout then nil else 'scrollable' end) do %> |
| 17 | + <% @user_fields_length = @user_fields ? @user_fields.length : 0 %> |
| 18 | + <% @exercises_length = @summary[:sheets] ? @summary[:sheets].length : 0 %> |
| 19 | + <table class="points" > |
| 20 | + <thead> |
| 21 | + <tr> |
| 22 | + <th></th> |
| 23 | + <th colspan="<%= (@user_fields ? @user_fields.length : 0) + 1 %>">Number of students</th> |
| 24 | + <% if !@summary[:sheets].empty? %> |
| 25 | + <th colspan="<%= @summary[:sheets].count %>">Total points/possible</th> |
58 | 26 | <% end %>
|
59 |
| - <% end %> |
60 |
| - <% @summary[:sheets].map{|s| s[:name]}.each do |sheet| %> |
61 |
| - <th> |
62 |
| - <%= sheet %><br /> |
63 |
| - [<%= link_to 'open', organization_course_point_path(@organization, @course, sheet) %>] |
64 |
| - <% unless params[:sort_by] == "#{sheet}_points" %> |
65 |
| - [<%= link_to 'sort', organization_course_points_path(@organization, @course, :sort_by => "#{sheet}_points") %>] |
66 |
| - <% else %> |
67 |
| - [sort] |
| 27 | + <% if show_total_column %> |
| 28 | + <th>Total</th> |
68 | 29 | <% end %>
|
69 |
| - </th> |
70 |
| - <% end %> |
71 |
| - <% if show_total_column %> |
72 |
| - <th> |
73 |
| - Total<br /> |
74 |
| - <% unless params[:sort_by] == 'total_points' %> |
75 |
| - [<%= link_to 'sort', organization_course_points_path(@organization, @course, :sort_by => "total_points") %>] |
76 |
| - <% else %> |
77 |
| - [sort] |
| 30 | + </tr> |
| 31 | + <tr class="table-totals"> |
| 32 | + <td>-</td> |
| 33 | + <% nstudents = @summary[:users].length %> |
| 34 | + <td><%= nstudents %></td> |
| 35 | + <% if @user_fields %> |
| 36 | + <td colspan="<%= @user_fields.length %>"></td> |
78 | 37 | <% end %>
|
79 |
| - </th> |
80 |
| - <% end %> |
81 |
| - </tr> |
82 |
| - </thead> |
83 |
| - <tbody> |
84 |
| - <% @summary[:users].each_with_index do |user, index| %> |
85 |
| - <% username = user.login %> |
86 |
| - <% row_class = if user.administrator? || user.teacher?(@organization) then "admin" else "student" end %> |
87 |
| - <tr class="<%= row_class %>"> |
88 |
| - <td><%= index + 1 %></td> |
89 |
| - <td> |
90 |
| - <% if current_user.id == user.id || can?(:teach, @course) %> |
91 |
| - <%= link_to username, participant_path(user) %> |
92 |
| - <% else %> |
93 |
| - <%= username %> |
| 38 | + <% @summary[:sheets].each do |sheet| %> |
| 39 | + <td> |
| 40 | + <%= "#{sheet[:total_awarded]}/#{sheet[:total_available]*nstudents}" %> |
| 41 | + </td> |
94 | 42 | <% end %>
|
95 |
| - </td> |
96 |
| - <% if @user_fields %> |
97 |
| - <% @user_fields.each do |field| %> |
98 |
| - <% field_record = user.user_field_values.find { |o| o.field_name == field.name } %> |
99 |
| - <td><%= field_record.value if field_record %></td> |
| 43 | + <% if show_total_column %> |
| 44 | + <td> |
| 45 | + <%= "#{@summary[:total_awarded]}/#{@summary[:total_available]*nstudents}" %> |
| 46 | + </td> |
100 | 47 | <% end %>
|
| 48 | + </tr> |
| 49 | + <tr> |
| 50 | + <th></th> |
| 51 | + <th> |
| 52 | + Student<br /> |
| 53 | + <% unless params[:sort_by].blank? %> |
| 54 | + [<%= link_to 'sort', organization_course_points_path(@organization, @course) %>] |
| 55 | + <% else %> |
| 56 | + [sort] |
| 57 | + <% end %> |
| 58 | + </th> |
| 59 | + <% if @user_fields %> |
| 60 | + <% @user_fields.each do |field| %> |
| 61 | + <th><%= field.label %></th> |
| 62 | + <% end %> |
| 63 | + <% end %> |
| 64 | + <% @summary[:sheets].map{|s| s[:name]}.each do |sheet| %> |
| 65 | + <th> |
| 66 | + <%= sheet %><br /> |
| 67 | + [<%= link_to 'open', organization_course_point_path(@organization, @course, sheet) %>] |
| 68 | + <br/> |
| 69 | + <% unless params[:sort_by] == "#{sheet}_points" %> |
| 70 | + [<%= link_to 'sort', organization_course_points_path(@organization, @course, :sort_by => "#{sheet}_points") %>] |
| 71 | + <% else %> |
| 72 | + [sort] |
| 73 | + <% end %> |
| 74 | + </th> |
| 75 | + <% end %> |
| 76 | + <% if show_total_column %> |
| 77 | + <th> |
| 78 | + Total<br /> |
| 79 | + <% unless params[:sort_by] == 'total_points' %> |
| 80 | + [<%= link_to 'sort', organization_course_points_path(@organization, @course, :sort_by => "total_points") %>] |
| 81 | + <% else %> |
| 82 | + [sort] |
| 83 | + <% end %> |
| 84 | + </th> |
| 85 | + <% end %> |
| 86 | + </tr> |
| 87 | + </thead> |
| 88 | + <tbody> |
| 89 | + <% @summary[:users].each_with_index do |user, index| %> |
| 90 | + <% username = user.login %> |
| 91 | + <% row_class = if user.administrator? || user.teacher?(@organization) then "admin" else "student" end %> |
| 92 | + <tr class="<%= row_class %>"> |
| 93 | + <td><%= index + 1 %></td> |
| 94 | + <td> |
| 95 | + <% if current_user.id == user.id || can?(:teach, @course) %> |
| 96 | + <%= link_to username, participant_path(user) %> |
| 97 | + <% else %> |
| 98 | + <%= username %> |
| 99 | + <% end %> |
| 100 | + </td> |
| 101 | + <% if @user_fields %> |
| 102 | + <% @user_fields.each do |field| %> |
| 103 | + <% field_record = user.user_field_values.find { |o| o.field_name == field.name } %> |
| 104 | + <td><%= field_record.value if field_record %></td> |
| 105 | + <% end %> |
| 106 | + <% end %> |
| 107 | + <% @summary[:sheets].each do |sheet| %> |
| 108 | + <% user_points_for_this_sheet = @summary[:awarded_for_user_and_sheet][username][sheet[:name]].to_i %> |
| 109 | + <td> |
| 110 | + <%= "#{user_points_for_this_sheet}/#{sheet[:total_available]}" %> |
| 111 | + </td> |
| 112 | + <% end %> |
| 113 | + <% if show_total_column %> |
| 114 | + <td><%= "#{@summary[:total_for_user][username].to_i}/#{@summary[:total_available]}" %></td> |
| 115 | + <% end %> |
| 116 | + </tr> |
101 | 117 | <% end %>
|
102 |
| - <% @summary[:sheets].each do |sheet| %> |
103 |
| - <% user_points_for_this_sheet = @summary[:awarded_for_user_and_sheet][username][sheet[:name]].to_i %> |
104 |
| - <td> |
105 |
| - <%= "#{user_points_for_this_sheet}/#{sheet[:total_available]}" %> |
106 |
| - </td> |
107 |
| - <% end %> |
108 |
| - <% if show_total_column %> |
109 |
| - <td><%= "#{@summary[:total_for_user][username].to_i}/#{@summary[:total_available]}" %></td> |
110 |
| - <% end %> |
111 |
| - </tr> |
112 |
| - <% end %> |
113 |
| - </tbody> |
114 |
| - </table> |
115 |
| -<% end %> |
| 118 | + </tbody> |
| 119 | + </table> |
| 120 | + <% end %> |
| 121 | + </div> |
| 122 | +</div> |
0 commit comments