mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 18:39:32 +00:00
Generalise test onclick handler
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user