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

[hotfix] Made grades section scrollable, deleted unnecessary headings in speedgrader #1596

Merged
merged 5 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/assets/javascripts/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ $(document).ready(function () {

retrieveSharedComments();
resizeCodeTable();
resizeGradeList();
});

/* On Window Resize */
$(window).on('resize', function () {
resizeCodeTable();
resizeGradeList();
});

// retrieve shared comments
Expand Down Expand Up @@ -222,7 +224,7 @@ function fillAnnotationBox() {
}
}
// Reloads the grades part upon update
$('.problemGrades').load(document.URL + ' .problemGrades')
$('.problemGrades').load(document.URL + ' .problemGrades');
}

// Sets up the keybindings
Expand Down
28 changes: 5 additions & 23 deletions app/assets/stylesheets/annotations.css
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,9 @@
display: flex;
flex-flow: column;
height: 100%;
overflow-y: scroll;
overflow-y: auto;
}
.annotationSummary{
border: solid 2px #0882af;
margin-bottom: 15px;
color: #4f4f4f;
}
Expand All @@ -531,7 +530,6 @@
box-shadow: none;
border: none;
margin: 10px 0;
max-height: 350px;
}

.annotationSummary .collapsible-header{
Expand Down Expand Up @@ -593,26 +591,8 @@
margin-bottom:0 !important;
}

.problemGrades{
overflow: auto;
}
.problemGrades h1{
margin: 0px;
background-color: #ebebeb;
padding: 8px;
border-right: none;
border-left: none;
font-weight: normal !important;
font-size: 1em !important;
color: #909090;
white-space: nowrap;
overflow: hidden;
padding-left: 10px;
padding-right: 15px;
text-align: left;
}
.problemGrades ul{
margin: 5px 10px;
.problemGrades {
overflow-y: auto;
}

.collection{
Expand Down Expand Up @@ -698,6 +678,7 @@
#symbol-tree-container {
max-height: 100%;
overflow: auto;
padding: 5px;
}

#symbol-tree-box ul {
Expand All @@ -709,6 +690,7 @@
#symbol-tree-box ul li {
cursor: pointer;
display: flex;
align-items: center;
}

#symbol-tree-box ul li:hover {
Expand Down
1 change: 0 additions & 1 deletion app/views/submissions/_annotation_pane.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<div id="annotationPane">
<div class="annotationSummary">
<h1>Annotations</h1>
<ul class="collapsible expandable">
<% @problemSummaries.each do |problem, descriptTuples| %>
<li id="li-problem-<%= problem %>">
Expand Down
1 change: 0 additions & 1 deletion app/views/submissions/_code_symbol_tree.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<div id="symbol-tree-container">
<% unless (@is_pdf || @ctag_obj.nil?) %>
<div id="symbol-tree-box">
<h5>Symbol Tree</h5>
<ul>
<% @ctag_obj.each do |fdef| %>
<li onclick="scrollToLine(<%=fdef['line']%>)">
Expand Down
17 changes: 14 additions & 3 deletions app/views/submissions/_golden-layout.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
});
}

function resizeGradeList() {
// set problemGrades div height so that overflow properties apply
if (!$('.problemGrades')) return;

// update problemGrades div height to match the height of
// the golden layout component it's contained in
const parentHeight = $('.problemGrades')[0]?.parentElement?.style.height;
$('.problemGrades')[0].style.height = parentHeight;
}

// Check if file tree & symbol tree are necessary in the layout
var fileComponents = [];
var hasFileTree = false;
Expand Down Expand Up @@ -136,13 +146,14 @@
});

myLayout.on( 'stateChanged', function(){
var state = JSON.stringify( myLayout.toConfig() );
localStorage.setItem( 'savedState', state );
var state = JSON.stringify( myLayout.toConfig() );
localStorage.setItem( 'savedState', state );
resizeGradeList();
});

// Dynamically resize golden layout on client window resize
$(window).resize(function () {
myLayout.updateSize(document.body.clientWidth - $.position.scrollbarWidth(), myLayout.height);
myLayout.updateSize();
});

function resetLayout() {
Expand Down
37 changes: 17 additions & 20 deletions app/views/submissions/_grades.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<div class="problemGrades">
<h1>Grades</h1>
<div class="collection">
<% p_scores = @submission.problems_to_scores %>
<% @assessment.problems.each_with_index do |p,i| %>
<% p_score = p_scores[p.id] %>
<div class="problem-grade-item collection-item">
<div class="problem_name"> <%= p.name.capitalize %>: </div>
<div class="problem_score">
<% if @cud.instructor? or @cud.course_assistant? %>
<b class="student_score" data-problem-id="<%= p.id %>" data-submission-id="<%= @submission.id %>"> <%= p_score && p_score.score ? p_score.score : raw("&ndash;") %> </b>
<div class="problemGrades collection">
<% p_scores = @submission.problems_to_scores %>
<% @assessment.problems.each_with_index do |p,i| %>
<% p_score = p_scores[p.id] %>
<div class="problem-grade-item collection-item">
<div class="problem_name"> <%= p.name.capitalize %>: </div>
<div class="problem_score">
<% if @cud.instructor? or @cud.course_assistant? %>
<b class="student_score" data-problem-id="<%= p.id %>" data-submission-id="<%= @submission.id %>"> <%= p_score && p_score.score ? p_score.score : raw("&ndash;") %> </b>
<% else %>
<% if p_score && p_score.released %>
<b class="student_score"> <%= p_score.score %> </b>
<% else %>
<% if p_score && p_score.released %>
<b class="student_score"> <%= p_score.score %> </b>
<% else %>
<b> &ndash; </b>
<% end %>
<b> &ndash; </b>
<% end %>
<b> / <%= p.max_score %></b>
</div>
<% end %>
<b> / <%= p.max_score %></b>
</div>
<% end %>
</div>
</div>
<% end %>
</div>