Skip to content

Commit

Permalink
Merge pull request #55 from mikaelGusse/master
Browse files Browse the repository at this point in the history
Improve comparison table view in exercise
  • Loading branch information
mikaelGusse authored Oct 24, 2024
2 parents dad9466 + c746d84 commit 30b26d6
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 11 deletions.
15 changes: 5 additions & 10 deletions review/templates/review/_comparisontable_unique.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
{% load review %}
<table class="comparison">
<tr>
{% for comparison in comparisons %}
<td>{% student_td course comparison %}</td>
{% if forloop.counter|divisibleby:10 %}
</tr><tr>
{% endif %}
{% endfor %}
</tr>
</table>
<grid class="comparison-grid">
{% for comparison in comparisons %}
<div class="grid-item" data-similarity={{comparison.similarity}}>{% student_td course comparison %}</div>
{% endfor %}
</grid>
2 changes: 1 addition & 1 deletion review/templates/review/exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h4>Comparison pairs with highest similarity</h4>
var similarity = js.parseJSON($('#similarity'));
js.buildHeat(similarity);
js.histogram($('div.histogram'), similarity, 600, 80);
js.applyHeat($('table.comparison'));
js.applyHeat($('grid.comparison-grid'));
});

document.addEventListener('DOMContentLoaded', function() {
Expand Down
45 changes: 45 additions & 0 deletions static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,51 @@ table.comparison td small { display:block; font-size:x-small; white-space:nowrap
table.comparison td.success { background-color:transparent !important; }
table.comparison .glyphicon { text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white; }

/* Comparison Grid */
.comparison-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
border: 1px solid grey;
max-width: 2000px;
}

.comparison-grid .grid-item {
border: 1px solid grey;
padding: 0.1em 0.3em;
line-height: 1em;
display: flex;
flex-direction: column;
}

.comparison-grid .grid-item a {
display: block;
color: inherit;
text-decoration: none;
}

.comparison-grid .grid-item a:hover,
.comparison-grid .grid-item.selected a {
background-color: #333;
color: white;
}

.comparison-grid .grid-item .similarity {
font-style: oblique;
}

.comparison-grid .grid-item small {
font-size: x-small;
white-space: break-word;
}

.comparison-grid .grid-item .success {
background-color: transparent !important;
}

.comparison-grid .glyphicon {
text-shadow: -1px 0 white, 0 1px white, 1px 0 white, 0 -1px white;
}

/* Course histograms */
ul.course-histograms {
list-style: none;
Expand Down

0 comments on commit 30b26d6

Please sign in to comment.