1
0
mirror of https://github.com/matt-fidd/stratos.git synced 2026-01-01 20:39:28 +00:00

Generalise test onclick handler

This commit is contained in:
2022-03-03 02:06:16 +00:00
parent b3942491d2
commit e98f8c5026
2 changed files with 7 additions and 10 deletions

View File

@@ -4,3 +4,10 @@
<td>{{ subject }}</td>
<td>{{ date }}</td>
</tr>
<script>
document.querySelector('.tests tbody tr[data-id="{{id}}"]').addEventListener('click', (e) => {
const test = e.path[1];
window.location.href = `/admin/test/${test.getAttribute('data-id')}`;
});
</script>

View File

@@ -24,13 +24,3 @@
</div>
</div>
</section>
<script>
const tests = document.querySelectorAll('.tests tbody tr');
tests.forEach(t => {
t.addEventListener('click', () => {
window.location.href =
`/admin/test/${t.getAttribute('data-id')}`;
});
});
</script>