Add restore button to test view page (#164)
This commit is contained in:
1 parent
c0bedf6fbc
commit
5d1ee29358
2 files changed
+11
-2
No files matched your search
+2
-1
@@ -440,7 +440,7 @@ def test(request, id, action=None):
|
|||||||
if not (test := Test.objects.filter(id=id).first()):
|
if not (test := Test.objects.filter(id=id).first()):
|
||||||
return django.http.HttpResponseRedirect('/index/')
|
return django.http.HttpResponseRedirect('/index/')
|
||||||
|
|
||||||
if action not in ['APPROVE', 'RESTART', 'STOP', 'DELETE', 'MODIFY']:
|
if action not in ['APPROVE', 'RESTART', 'STOP', 'DELETE', 'RESTORE', 'MODIFY']:
|
||||||
data = { 'test' : test, 'results': Result.objects.filter(test=test) }
|
data = { 'test' : test, 'results': Result.objects.filter(test=test) }
|
||||||
return render(request, 'test.html', data)
|
return render(request, 'test.html', data)
|
||||||
|
|
||||||
@@ -459,6 +459,7 @@ def test(request, id, action=None):
|
|||||||
if action == 'RESTART': test.finished = False; test.save()
|
if action == 'RESTART': test.finished = False; test.save()
|
||||||
if action == 'STOP' : test.finished = True; test.save()
|
if action == 'STOP' : test.finished = True; test.save()
|
||||||
if action == 'DELETE' : test.deleted = True; test.save()
|
if action == 'DELETE' : test.deleted = True; test.save()
|
||||||
|
if action == 'RESTORE': test.deleted = False; test.save()
|
||||||
|
|
||||||
if action == 'MODIFY':
|
if action == 'MODIFY':
|
||||||
test.priority = int(request.POST['priority'])
|
test.priority = int(request.POST['priority'])
|
||||||
|
|||||||
@@ -116,12 +116,20 @@
|
|||||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Stop</a>
|
<a class="w-25 mr-2 anchorbutton btn-disabled">Stop</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Delete Button: For Approvers or Test Authors -->
|
<!-- Delete/Restore Button: For Approvers or Test Authors -->
|
||||||
{% if profile.approver or profile.user.username == test.author %}
|
{% if profile.approver or profile.user.username == test.author %}
|
||||||
|
{% if test.deleted %}
|
||||||
|
<a class="w-25 mr-2 anchorbutton btn-preset" href="/test/{{test.id}}/RESTORE">Restore</a>
|
||||||
|
{% else %}
|
||||||
<a class="w-25 mr-2 anchorbutton btn-red" href="/test/{{test.id}}/DELETE">Delete</a>
|
<a class="w-25 mr-2 anchorbutton btn-red" href="/test/{{test.id}}/DELETE">Delete</a>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% if test.deleted %}
|
||||||
|
<a class="w-25 mr-2 anchorbutton btn-disabled">Restore</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="w-25 mr-2 anchorbutton btn-disabled">Delete</a>
|
<a class="w-25 mr-2 anchorbutton btn-disabled">Delete</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<!-- Copy Button: Copy the current results statblock -->
|
<!-- Copy Button: Copy the current results statblock -->
|
||||||
<a class="copy-button" onclick="copy_statblock()">
|
<a class="copy-button" onclick="copy_statblock()">
|
||||||
|
|||||||
Reference in new issue
Block a user