Skip to content

Commit 2d05126

Browse files
author
Irene
committed
Remove ul in header, add stripes, fix scalability
1 parent e7d370d commit 2d05126

File tree

5 files changed

+175
-176
lines changed

5 files changed

+175
-176
lines changed

app/assets/stylesheets/_breadcrumb.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
$breadcrumb-grey: #e9ecef;
2+
13
.breadcumb-nav {
2-
background-color: #e9ecef;
4+
background-color: $breadcrumb-grey;
35
border-radius: 0.25rem;
46
display: flex;
57
align-items: center;

app/assets/stylesheets/main.scss

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* Submissions status*/
22
@import "_footer";
3+
@import "_breadcrumb";
34

45
.error,
56
.failure,
@@ -146,16 +147,11 @@ div.stack-trace {
146147
font-family: monospace;
147148
}
148149

149-
.scrollable-container {
150+
.scrollable {
150151
width: 95vw;
151152
height: 70vh;
152153
align-self: left;
153-
}
154-
155-
.scrollable {
156154
overflow: auto;
157-
max-height: 100%;
158-
max-width: 100%;
159155
}
160156

161157
div.feedback-question {
@@ -180,11 +176,15 @@ table {
180176

181177
table > * > tr > td {
182178
padding: 6px 14px 6px 14px;
179+
text-align: center;
183180
}
184181

185182
table > * > tr > th {
186183
padding: 6px 4px 6px 4px;
187184
border: 0;
185+
text-align: center;
186+
max-width: 5rem;
187+
word-wrap: break-word;
188188
}
189189

190190
tr.table-totals > td {
@@ -194,7 +194,7 @@ tr.table-totals > td {
194194
/* Points tables */
195195

196196
table.points {
197-
width: auto;
197+
min-width: 100%;
198198
}
199199

200200
table.points tr.admin * {
@@ -205,6 +205,10 @@ table.points > * > tr > td {
205205
text-align: center;
206206
}
207207

208+
table.points > tbody tr:nth-child(odd) {
209+
background-color: lighten($breadcrumb-grey, 4%);
210+
}
211+
208212
/* Code reviews */
209213

210214
.code-review {

app/assets/stylesheets/points.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
.course-point-header {
22
display: flex;
3-
flex-direction: column;
3+
justify-content: space-around;
4+
align-content: center;
45
align-items: center;
56
}
67

78
.point-cell {
89
border: 1px solid black;
9-
text-align: center;
1010
}
1111

1212
.points-container {
1313
align-self: center;
1414
}
15-

app/views/points/index.html.erb

Lines changed: 92 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -12,111 +12,109 @@
1212
show_total_column = @summary[:sheets].size > 1
1313
%>
1414

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>
26-
<% end %>
27-
<% if show_total_column %>
28-
<th>Total</th>
15+
<%= content_tag('div', :class => if @bare_layout then nil else 'scrollable' end) do %>
16+
<% @user_fields_length = @user_fields ? @user_fields.length : 0 %>
17+
<% @exercises_length = @summary[:sheets] ? @summary[:sheets].length : 0 %>
18+
<table class="points" >
19+
<thead>
20+
<tr>
21+
<th></th>
22+
<th colspan="<%= (@user_fields ? @user_fields.length : 0) + 1 %>">Number of students</th>
23+
<% if !@summary[:sheets].empty? %>
24+
<th colspan="<%= @summary[:sheets].count %>">Total points/possible</th>
25+
<% end %>
26+
<% if show_total_column %>
27+
<th>Total</th>
28+
<% end %>
29+
</tr>
30+
<tr class="table-totals">
31+
<td>-</td>
32+
<% nstudents = @summary[:users].length %>
33+
<td><%= nstudents %></td>
34+
<% if @user_fields %>
35+
<td colspan="<%= @user_fields.length %>"></td>
36+
<% end %>
37+
<% @summary[:sheets].each do |sheet| %>
38+
<td>
39+
<%= "#{sheet[:total_awarded]}/#{sheet[:total_available]*nstudents}" %>
40+
</td>
41+
<% end %>
42+
<% if show_total_column %>
43+
<td>
44+
<%= "#{@summary[:total_awarded]}/#{@summary[:total_available]*nstudents}" %>
45+
</td>
46+
<% end %>
47+
</tr>
48+
<tr>
49+
<th></th>
50+
<th>
51+
Student<br />
52+
<% unless params[:sort_by].blank? %>
53+
[<%= link_to 'sort', organization_course_points_path(@organization, @course) %>]
54+
<% else %>
55+
[sort]
2956
<% end %>
30-
</tr>
31-
<tr class="table-totals">
32-
<td>-</td>
33-
<% nstudents = @summary[:users].length %>
34-
<td><%= nstudents %></td>
57+
</th>
3558
<% if @user_fields %>
36-
<td colspan="<%= @user_fields.length %>"></td>
37-
<% end %>
38-
<% @summary[:sheets].each do |sheet| %>
39-
<td>
40-
<%= "#{sheet[:total_awarded]}/#{sheet[:total_available]*nstudents}" %>
41-
</td>
42-
<% end %>
43-
<% if show_total_column %>
44-
<td>
45-
<%= "#{@summary[:total_awarded]}/#{@summary[:total_available]*nstudents}" %>
46-
</td>
59+
<% @user_fields.each do |field| %>
60+
<th><%= field.label %></th>
61+
<% end %>
4762
<% end %>
48-
</tr>
49-
<tr>
50-
<th></th>
63+
<% @summary[:sheets].map{|s| s[:name]}.each do |sheet| %>
64+
<th>
65+
<%= sheet %><br />
66+
[<%= link_to 'open', organization_course_point_path(@organization, @course, sheet) %>]
67+
<br/>
68+
<% unless params[:sort_by] == "#{sheet}_points" %>
69+
[<%= link_to 'sort', organization_course_points_path(@organization, @course, :sort_by => "#{sheet}_points") %>]
70+
<% else %>
71+
[sort]
72+
<% end %>
73+
</th>
74+
<% end %>
75+
<% if show_total_column %>
5176
<th>
52-
Student<br />
53-
<% unless params[:sort_by].blank? %>
54-
[<%= link_to 'sort', organization_course_points_path(@organization, @course) %>]
77+
Total<br />
78+
<% unless params[:sort_by] == 'total_points' %>
79+
[<%= link_to 'sort', organization_course_points_path(@organization, @course, :sort_by => "total_points") %>]
5580
<% else %>
5681
[sort]
5782
<% end %>
5883
</th>
59-
<% if @user_fields %>
60-
<% @user_fields.each do |field| %>
61-
<th><%= field.label %></th>
62-
<% end %>
84+
<% end %>
85+
</tr>
86+
</thead>
87+
<tbody>
88+
<% @summary[:users].each_with_index do |user, index| %>
89+
<% username = user.login %>
90+
<% row_class = if user.administrator? || user.teacher?(@organization) then "admin" else "student" end %>
91+
<tr class="<%= row_class %>">
92+
<td><%= index + 1 %></td>
93+
<td>
94+
<% if current_user.id == user.id || can?(:teach, @course) %>
95+
<%= link_to username, participant_path(user) %>
96+
<% else %>
97+
<%= username %>
98+
<% end %>
99+
</td>
100+
<% if @user_fields %>
101+
<% @user_fields.each do |field| %>
102+
<% field_record = user.user_field_values.find { |o| o.field_name == field.name } %>
103+
<td><%= field_record.value if field_record %></td>
63104
<% 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>
105+
<% end %>
106+
<% @summary[:sheets].each do |sheet| %>
107+
<% user_points_for_this_sheet = @summary[:awarded_for_user_and_sheet][username][sheet[:name]].to_i %>
108+
<td>
109+
<%= "#{user_points_for_this_sheet}/#{sheet[:total_available]}" %>
110+
</td>
75111
<% end %>
76112
<% 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>
113+
<td><%= "#{@summary[:total_for_user][username].to_i}/#{@summary[:total_available]}" %></td>
85114
<% end %>
86115
</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>
117-
<% end %>
118-
</tbody>
119-
</table>
120-
<% end %>
121-
</div>
116+
<% end %>
117+
</tbody>
118+
</table>
119+
<% end %>
122120
</div>

0 commit comments

Comments
 (0)