Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always show navigation on submission pages #5269

Merged
merged 14 commits into from
Jan 10, 2024
2 changes: 1 addition & 1 deletion app/assets/stylesheets/components/card.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

.card-outlined {
box-shadow: none;
border: 1px solid var(--d-outline);
border: 1px solid var(--d-divider);
}

.card-media {
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/models/submissions.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ iframe.file {

.score-details {
padding-bottom: 10px;
padding-top: 10px;
}

.submission-history {
Expand Down Expand Up @@ -538,3 +539,8 @@ iframe.file {
margin-right: 6px;
}
}

.scores.card .card-title.card-title-colored-container .btn {
margin-top: -12px;
margin-bottom: -12px;
}
26 changes: 9 additions & 17 deletions app/views/feedbacks/_score_link.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,18 @@
%>
<% total = policy(feedback.evaluation_exercise).show_total? %>
<% scores = policy_scope(feedback.scores) %>
<% if total && feedback.score_items.present? %>
<%= link_to "#score-details-#{feedback.id}",
class: 'toggleable-icon',
title: t("feedbacks.score_link.view_breakdown"), data: { 'bs-toggle': "collapse" } do %>
<%= t("feedbacks.score_link.score", score: format_score(feedback.score), max: format_score(feedback.maximum_score)) %>
<i class="collapsed-icon mdi mdi-chevron-down mdi-12"></i>
<i class="expanded-icon mdi mdi-chevron-up mdi-12"></i>
<% end %>
<% elsif scores.present? %>
<%= link_to "#score-details-#{feedback.id}",
class: 'toggleable-icon',
title: t("feedbacks.score_link.view_breakdown"), data: { 'bs-toggle': "collapse" } do %>
<%= t("feedbacks.score_link.present", count: scores.length) %>
<i class="collapsed-icon mdi mdi-chevron-down mdi-12"></i>
<i class="expanded-icon mdi mdi-chevron-up mdi-12"></i>
<% end %>
<% if (total && feedback.score_items.present?) || scores.present? %>
<span title="<%=t("feedbacks.score_link.view_breakdown")%>">
<% if total && feedback.score_items.present? %>
<%= t("feedbacks.score_link.score", score: format_score(feedback.score), max: format_score(feedback.maximum_score)) %>
<% else %>
<%= t("feedbacks.score_link.present", count: scores.length) %>
<% end %>
</span>
<% end %>
<%# Link to edit screen if needed %>
<% if policy(feedback).show? && scores.present? %>
<%= link_to feedback_path(feedback), class: "edit-score btn btn-icon", title: t("feedbacks.score_link.view_feedback") do %>
<%= link_to feedback_path(feedback), class: "edit-score btn btn-icon float-end", title: t("feedbacks.score_link.view_feedback") do %>
<i class="mdi mdi-pencil"></i>
<% end %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/feedbacks/_score_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<i class="mdi mdi-school mdi-18 colored-secondary" title="<%= t "score_items.table.visible-no" %>"></i>
<% end %>
</td>
<td><%= format_score feedback.score %> / <%= format_score feedback.maximum_score %></td>
<td class="text-end"><%= format_score feedback.score %> / <%= format_score feedback.maximum_score %></td>
</tr>
<% end %>
<% scores.each do |score| %>
Expand All @@ -23,7 +23,7 @@
<br>
<span class="text-muted small"><%= score.score_item.description %></span>
</td>
<td><%= format_score score.score %> / <%= format_score score.score_item.maximum %></td>
<td class="text-end"><%= format_score score.score %> / <%= format_score score.score_item.maximum %></td>
</tr>
<% end %>
</table>
Expand Down
63 changes: 30 additions & 33 deletions app/views/submissions/_description.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,43 @@
<span class="text-muted small" title="<%= l submission.created_at, format: :submission %>"><%= time_ago_in_words submission.created_at %> <%= t "submissions.show.ago" %></span>
</span>
</div>
<% if @feedbacks.blank? %>
<div class="col-md-6 submission-history">
<div class="timestamp-col">
<% @submissions_time_stamps.each do |t| %>
<span class="text-muted small submission-history-row <%= t.present? ? 'mt-1' : '' %>"><%= t %></span>
<br/>
<% end %>
</div>
<div>
<% @submissions.each_with_index do |s, i| %>
<span class="submission-history-row <%= @submissions_time_stamps[i].present? ? 'mt-1' : '' %> <%= s.id == submission.id ? 'current-submission' : '' %>">
<%= link_to "##{@submissions.length - i}", submission_path(s), class: 'submission-link' %>
<span class='status-icon' id="history-<%= s.id %>"><%= submission_status_icon(s, 12) %></span>
<span>
<%= Submission.human_enum_name(:status, s.status) %>
<% if s.summary.present? and s.summary.downcase != Submission.human_enum_name(:status, s.status).downcase %>
&middot; <span class='text-muted'><%= s.summary %></span>
<% end %>
</span>
</span>
<br/>
<% end %>
</div>
<div class="col-md-6 submission-history">
<div class="timestamp-col">
<% @submissions_time_stamps.each do |t| %>
<span class="text-muted small submission-history-row <%= t.present? ? 'mt-1' : '' %>"><%= t %></span>
<br/>
<% end %>
</div>
<% else %>
<div class="col-md-6">
<% @feedbacks.each do |feedback| %>
<span class="score">
<%= render 'feedbacks/score_link', feedback: feedback %>
<div>
<% @submissions.each_with_index do |s, i| %>
<span class="submission-history-row <%= @submissions_time_stamps[i].present? ? 'mt-1' : '' %> <%= s.id == submission.id ? 'current-submission' : '' %>">
<%= link_to "##{@submissions.length - i}", submission_path(s), class: 'submission-link' %>
<span class='status-icon' id="history-<%= s.id %>"><%= submission_status_icon(s, 12) %></span>
<span>
<%= Submission.human_enum_name(:status, s.status) %>
<% if s.summary.present? and s.summary.downcase != Submission.human_enum_name(:status, s.status).downcase %>
&middot; <span class='text-muted'><%= s.summary %></span>
<% end %>
</span>
</span>
<br/>
<% end %>
</div>
</div>
<% @feedbacks.each do |feedback| %>
<div class="col-md-12">
<div class="card-outlined card scores">
<div class="card-title card-title-colored-container">
<%= render 'feedbacks/score_link', feedback: feedback %>
</div>
<div class="card-supporting-text" id="<%= "score-details-#{feedback.id}" %>">
<%= render 'feedbacks/score_table', feedback: feedback %>
</div>
</div>
</div>
<% end %>
</div>
</div>
<% @feedbacks.each do |feedback | %>
<div class="collapse score-details" id="<%= "score-details-#{feedback.id}" %>">
<%= render 'feedbacks/score_table', feedback: feedback %>
</div>
<% end %>

<% unless submission.queued? or submission.running? %>
<%= submission.judge.renderer.new(submission, current_user).parse %>
Expand Down