Skip to content

Commit

Permalink
Add tests taken columns toggle (fixes #85)
Browse files Browse the repository at this point in the history
  • Loading branch information
sushain97 committed Feb 27, 2015
1 parent 0bd7ac6 commit cf759a1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
7 changes: 4 additions & 3 deletions war/html/pages/dataRegistrations.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ <h3>$level.getName() School <button type="button" class="reset btn btn-sm btn-da
<p>
The first number for each test indicates number of registrations and second the number of tests actually taken. <br>
Click a cell to edit its corresponding registration.
<button type="button" class="btn btn-sm pull-right" id="testsTaken">Show tests taken</button>
</p>
<div class="table-responsive">
<table class="table table-condensed table-hover regTable">
Expand All @@ -123,7 +124,7 @@ <h3>$level.getName() School <button type="button" class="reset btn btn-sm btn-da
<!-- <th>Payment</th> -->
<th><abbr title="Account">Acct.</abbr></th>
#foreach($test in $Test.getTests($level))
<th colspan="2" class="text-center"><abbr title="$test.getGrade()th $test.getSubject().getName()">$test</abbr></th>
<th colspan="2" class="text-center testsTakenColspan"><abbr title="$test.getGrade()th $test.getSubject().getName()">$test</abbr></th>
#end
<th>Cost</th>
</tr>
Expand Down Expand Up @@ -225,7 +226,7 @@ <h3>$level.getName() School <button type="button" class="reset btn btn-sm btn-da
#if($students) $students.size() #else 0 #end
</a>
</td>
<td class="uneditable">#if($reg.getProperty($test.toString().toUpperCase()))$reg.getProperty($test.toString().toUpperCase())#else 0 #end</td>
<td class="uneditable testsTaken">#if($reg.getProperty($test.toString().toUpperCase()))$reg.getProperty($test.toString().toUpperCase())#else 0 #end</td>
#end

#set($totalCost = $totalCost + $reg.getProperty("cost"))
Expand All @@ -240,7 +241,7 @@ <h3>$level.getName() School <button type="button" class="reset btn btn-sm btn-da
#if($classificationQuestion == 'no') #set($end = 6) #else #set($end = 7) #end
#foreach($i in [1..$end]) <td #if($i <= 3) class="hidden-print" #end></td> #end
#foreach($test in $Test.getTests($level))
<td colspan="2"><strong>$testTotals.get($test)</strong></td>
<td colspan="2" class="testsTakenColspan"><strong>$testTotals.get($test)</strong></td>
#end
<td><strong>&#36;$totalCost</strong></td>
</tr>
Expand Down
20 changes: 20 additions & 0 deletions war/js/pagescripts/data-registrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,26 @@ $(document).ready(function() {
var t = parseInt($(this).index()) + 1;
$('td:nth-child(' + t + '):not(tfoot td)', $(this).closest('table')).removeClass('highlighted');
});

$('.tablesorter-filter-row td:odd').slice(4).hide();
$('.testsTakenColspan').attr('colspan', 1);
$('.testsTaken').hide();

$('button#testsTaken').click(function() {
var parent = $(this).parents('.tab-pane');
if($(this).hasClass('active')) {
$('.tablesorter-filter-row td:odd', parent).slice(4).hide();
$('.testsTakenColspan', parent).attr('colspan', 1);
$('.testsTaken', parent).hide();
$(this).removeClass('active');
}
else {
$('.tablesorter-filter-row td:odd', parent).slice(4).show();
$('.testsTakenColspan', parent).attr('colspan', 2);
$('.testsTaken', parent).show();
$(this).addClass('active');
}
});
});

function sendAJAXReq(elem, value) {
Expand Down

0 comments on commit cf759a1

Please sign in to comment.