Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Abillity to collapse rubrics when grading #467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<jackson.version>2.4.4</jackson.version>
<jetty.version>9.2.10.v20150310</jetty.version>
<resteasy.version>3.0.10.Final</resteasy.version>
<freemarker.version>2.3.21</freemarker.version>
<freemarker.version>2.3.23</freemarker.version>
<slf4j.version>1.7.7</slf4j.version>
<httpclient.version>4.3.6</httpclient.version>
<h2.version>1.3.173</h2.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@
[#list assignment.getTasks() as task]
<tbody class="task" data-id="${task.id?c}">
<tr class="active">
<td colspan="2"><strong>${task.description}</strong></td>
<td colspan="2"><span><strong>${task.description}<p class="octicon octicon-chevron-down" data-toggle="collapse" data-target=".collapse-target-${task?index}"></p></strong></span></td>
<td><strong>${task.getTotalWeight()?c}</strong></td>
<td><strong id="lbl-total-task-${task.id?c}">0</strong></td>
</tr>
[#list task.getCharacteristics() as characteristic]
<tr data-id="${characteristic.id?c}" data-weight="${characteristic.weight?c}" class="characteristic">
<tr data-id="${characteristic.id?c}" data-weight="${characteristic.weight?c}" class="characteristic collapse-target-${task?index}">
<td>${characteristic.description}</td>
<td>
[#list characteristic.getLevels() as level]
Expand Down Expand Up @@ -170,6 +170,20 @@
$(computeTotals)
$('[type="radio"]').on('change', computeTotals)
$('[type="radio"]').on('change', persistMasteries)

var down = "octicon-chevron-down"
var right ="octicon-chevron-right"

$('[data-target*="collapse-target"]').click(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this query-selector is rather expensive. It might be better to instead add a class collapse-target and do document.querySelector('.collapse-target') and then put the actual value in data-target="${task?index}". You can then retrieve the index with tableRow.dataset.target

var tableRow = $(this);
if(tableRow.hasClass(down)) {
tableRow.removeClass(down).addClass(right)
} else {
tableRow.removeClass(right).addClass(down)
}

})

</script>

[/@macros.renderScripts]
Expand Down