Skip to content
This repository has been archived by the owner on Dec 23, 2017. It is now read-only.

Feature/detail panel regression #696

Merged
merged 2 commits into from
Sep 16, 2015
Merged
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
9 changes: 5 additions & 4 deletions static/js/modules/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,21 @@ function modalRenderFactory(template, fetch) {
return function(api, data, response) {
var $table = $(api.table().node());
var $modal = $('#datatable-modal');
var $main = $table.closest('.panel__main')
var $main = $table.closest('.panel__main');
// Move the modal to the results div.
$modal.appendTo($main);
$table.find('tr').attr('tabindex', 0);

$table.on('click keypress', '.js-panel-toggle tr.' + MODAL_TRIGGER_CLASS, function(e) {
if (e.which === 13 || e.type === 'click') {
// Note: Use `currentTarget` to get parent row, since the target column
// may have been moved since the triggering event
var $row = $(e.currentTarget);
var $target = $(e.target);
if ($target.is('a')) {
return true;
}
if ( !$target.closest('td').hasClass('dataTables_empty') ) {
var $row = $target.closest('tr');
if (!$target.closest('td').hasClass('dataTables_empty')) {
var index = api.row($row).index();
$.when(fetch(response.results[index])).done(function(fetched) {
$modal.find('.js-panel-content').html(template(fetched));
Expand Down Expand Up @@ -333,7 +335,6 @@ function hidePanel(api, $modal) {
if ($(document).width() > 980) {
api.columns('.hide-panel').visible(true);
}

}

function barsAfterRender(template, api, data, response) {
Expand Down
14 changes: 7 additions & 7 deletions tests/selenium/test_itemized.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ def test_sort(self):
self.driver.get(self.url)

# Sort on date
check_sort(self.driver, 5, parse_date, reverse=True)
toggle_sort(self.driver, 5)
check_sort(self.driver, 5, parse_date, reverse=False)
check_sort(self.driver, 4, parse_date, reverse=True)
toggle_sort(self.driver, 4)
check_sort(self.driver, 4, parse_date, reverse=False)

# Sort on amount
toggle_sort(self.driver, 4)
check_sort(self.driver, 4, parse_amount, reverse=True)
toggle_sort(self.driver, 4)
check_sort(self.driver, 4, parse_amount, reverse=False)
toggle_sort(self.driver, 3)
check_sort(self.driver, 3, parse_amount, reverse=True)
toggle_sort(self.driver, 3)
check_sort(self.driver, 3, parse_amount, reverse=False)


class TestDisbursements(SearchPageTestCase):
Expand Down