mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 22:59:28 +00:00
Added edit markup to testResult partial
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<div class='testPage__testResultWrapper'>
|
<div class='testPage__testResultWrapper' data-id='{{ result.id }}'>
|
||||||
<div>
|
<div>
|
||||||
{{#eq userType 'account'}}
|
{{#eq userType 'account'}}
|
||||||
<div>
|
<div>
|
||||||
@@ -28,4 +28,36 @@
|
|||||||
<span>{{result.percentage}}%</span>
|
<span>{{result.percentage}}%</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if edit}}
|
||||||
|
<div class='testPage__testResult__edit'>
|
||||||
|
{{>button style='full' colour='primary' addClasses='resultEdit' content='Edit result'}}
|
||||||
|
|
||||||
|
<form style='display: none;' method='post' action='{{linkRoot}}/{{result.id}}/edit' >
|
||||||
|
<input type='number' name='mark' id='mark' min=0 max={{result.test.template.maxMark}} placeholder='{{result.mark}}' />
|
||||||
|
<input type='submit' value='Submit new mark' />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if edit}}
|
||||||
|
<script>
|
||||||
|
document.querySelector('.testPage__testResultWrapper[data-id="{{result.id}}"] a.resultEdit').addEventListener('click', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const form = e.path[1].childNodes[3];
|
||||||
|
const link = e.path[0];
|
||||||
|
|
||||||
|
link.innerText =
|
||||||
|
(form.style.display === 'none')
|
||||||
|
? 'Hide edit box'
|
||||||
|
: 'Edit result';
|
||||||
|
|
||||||
|
form.style.display =
|
||||||
|
(form.style.display === 'none')
|
||||||
|
? 'grid'
|
||||||
|
: 'none';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{{/if}}
|
||||||
|
|||||||
Reference in New Issue
Block a user