monfront - add line select

As in #7 requested, it is now possible to select a row by clicking on
the row itself. This should make it much easier to select a larger
number of rows.
This commit is contained in:
Gibheer 2019-01-24 11:26:26 +01:00
parent e8e67f091a
commit 18e4ba6ae4

View File

@ -568,8 +568,6 @@ var (
#mainmenu a:hover, #mainmenu a:active { color: #eeeeee; } #mainmenu a:hover, #mainmenu a:active { color: #eeeeee; }
#mainmenu ul ul a { margin-left: 0.5em; } #mainmenu ul ul a { margin-left: 0.5em; }
#mainmenu form * { display: block; margin: 0.25em 0.5em; } #mainmenu form * { display: block; margin: 0.25em 0.5em; }
#mainmenu form input { }
#mainmenu form button { }
form section { form section {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -638,7 +636,26 @@ var (
</ul> </ul>
</nav> </nav>
{{ if .Error }}<div class="error">{{ .Error }}</div>{{ end }}`, {{ if .Error }}<div class="error">{{ .Error }}</div>{{ end }}`,
"footer": `</body></html>`, "footer": `<script>
function select_row(event) {
if (event.target.nodeName == 'INPUT') {
return;
}
for (i = 0; i < event.path.length; i++) {
if (event.path[i].nodeName != 'TR') {
continue;
}
e = event.path[i].children[0].children[0];
e.checked = !e.checked;
e.focus();
break;
}
}
els = document.getElementsByTagName('tr');
for (i = 0; i < els.length; i++) {
els[i].addEventListener('click', {handleEvent: select_row});
}</script></body></html>`,
"checklist": `{{ template "header" . }} "checklist": `{{ template "header" . }}
<form method="post" action="/action"> <form method="post" action="/action">
<section> <section>