add "toggle all" to the html report (#1849)

This commit is contained in:
fuzzelhjb 2019-05-24 10:45:45 +02:00 committed by Daniel Marjamäki
parent cb7f925f5e
commit 2e93df13cf
1 changed files with 12 additions and 2 deletions

View File

@ -100,7 +100,7 @@ div.verbose div.content {
margin-top: 5px; margin-top: 5px;
padding-left: 5px; padding-left: 5px;
text-align: left; text-align: left;
width: 200px; width: 300px;
height: 75%; height: 75%;
position: fixed; position: fixed;
overflow: auto; overflow: auto;
@ -150,7 +150,7 @@ div.verbose div.content {
margin-left: 10px; margin-left: 10px;
padding: 0 10px 10px 10px; padding: 0 10px 10px 10px;
width: 80%; width: 80%;
padding-left: 200px; padding-left: 300px;
} }
.linenos { .linenos {
@ -226,6 +226,15 @@ HTML_HEAD = """
var box = document.getElementById(id); var box = document.getElementById(id);
set_class_display(id, box.checked ? '' : 'none'); set_class_display(id, box.checked ? '' : 'none');
} }
function toggle_all(){
var elts = document.getElementsByTagName("input");
for (var i = 1; i < elts.length; i++) {
var el = elts[i];
el.checked ? el.checked=false : el.checked=true;
toggle_class_visibility(el.id);
}
}
</script> </script>
</head> </head>
<body onload="init_expandables()"> <body onload="init_expandables()">
@ -568,6 +577,7 @@ if __name__ == '__main__':
output_file.write(HTML_HEAD.replace('id="menu" dir="rtl"', 'id="menu_index"', 1).replace("Defects:", "Defect summary;", 1) % (options.title, '', options.title, '', '')) output_file.write(HTML_HEAD.replace('id="menu" dir="rtl"', 'id="menu_index"', 1).replace("Defects:", "Defect summary;", 1) % (options.title, '', options.title, '', ''))
output_file.write(' <table>') output_file.write(' <table>')
output_file.write(' <tr><th>Show</th><th>#</th><th>Defect ID</th></tr>') output_file.write(' <tr><th>Show</th><th>#</th><th>Defect ID</th></tr>')
output_file.write('<label><input type="checkbox" onclick="toggle_all()" checked/> Toggle all</label>')
output_file.write(''.join(stat_html)) output_file.write(''.join(stat_html))
output_file.write(' <tr><td></td><td>' + str(stats_count) + '</td><td>total</td></tr>') output_file.write(' <tr><td></td><td>' + str(stats_count) + '</td><td>total</td></tr>')
output_file.write(' </table>') output_file.write(' </table>')