Add highlight to report table

This commit is contained in:
aignatov-bio 2020-11-10 15:15:18 +01:00
parent a71e8ef9cf
commit 71ddf680b2
2 changed files with 8 additions and 0 deletions

View file

@ -63,9 +63,11 @@
$('input[name="select_all"]').change(function() { $('input[name="select_all"]').change(function() {
if($(this).is(':checked')) { if($(this).is(':checked')) {
$("[data-action='toggle']").prop('checked', true); $("[data-action='toggle']").prop('checked', true);
$('.report-row').addClass('selected');
addAllItems(); addAllItems();
} else { } else {
$("[data-action='toggle']").prop('checked', false); $("[data-action='toggle']").prop('checked', false);
$('.report-row').removeClass('selected');
removeAllItems(); removeAllItems();
} }
updateButtons(); updateButtons();
@ -99,9 +101,11 @@
$("[data-action='toggle']").change(function() { $("[data-action='toggle']").change(function() {
var id = $(this).attr('data-report-id'); var id = $(this).attr('data-report-id');
if($(this).is(':checked')) { if($(this).is(':checked')) {
$(this).closest('.report-row').addClass('selected');
CHECKED_REPORTS.push(id); CHECKED_REPORTS.push(id);
} else { } else {
var index = CHECKED_REPORTS.indexOf(id); var index = CHECKED_REPORTS.indexOf(id);
$(this).closest('.report-row').removeClass('selected');
if(index != -1) { if(index != -1) {
CHECKED_REPORTS.splice(index, 1); CHECKED_REPORTS.splice(index, 1);
} }

View file

@ -4,6 +4,10 @@
/* Index page */ /* Index page */
.report-table { .report-table {
margin-top: 20px; margin-top: 20px;
.report-row.selected {
background: $color-alto;
}
} }
/* New page navbar */ /* New page navbar */