Grey out illegal buttons in viewTest
This commit is contained in:
1 parent
0090b64510
commit
41422d0b32
3 files changed
+49
-6
No files matched your search
@@ -142,8 +142,13 @@ a:link, a:visited, a:hover, a:active {
|
|||||||
background-color: #FA8E8E;
|
background-color: #FA8E8E;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#content #actions .deadbutton {
|
||||||
|
background-color: #808080;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
#content #actions input {
|
#content #actions input {
|
||||||
width: 240px;
|
width: 260px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content #actions input[type=submit] {
|
#content #actions input[type=submit] {
|
||||||
|
|||||||
+2
-1
@@ -306,7 +306,8 @@ def viewTest(request, id):
|
|||||||
# Build context dictionary for test template
|
# Build context dictionary for test template
|
||||||
test = Test.objects.get(id=id)
|
test = Test.objects.get(id=id)
|
||||||
results = Result.objects.all().filter(test=test)
|
results = Result.objects.all().filter(test=test)
|
||||||
data = {'test' : test, 'results' : results}
|
profile = Profile.objects.get(user=request.user) if request.user.is_authenticated else None
|
||||||
|
data = {'test' : test, 'results' : results, 'profile' : profile}
|
||||||
return render(request, 'viewTest.html', data)
|
return render(request, 'viewTest.html', data)
|
||||||
|
|
||||||
# Unable to find test
|
# Unable to find test
|
||||||
|
|||||||
@@ -87,14 +87,47 @@
|
|||||||
<div id="actions">
|
<div id="actions">
|
||||||
|
|
||||||
<h2>Actions</h2>
|
<h2>Actions</h2>
|
||||||
|
|
||||||
|
<!-- Approve Button: For Admins, or Cross-approvers -->
|
||||||
|
{% if not test.approved and profile.approver and profile.user.username is not test.author %}
|
||||||
|
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
|
||||||
|
{% elif not test.approved and request.user.is_superuser %}
|
||||||
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
|
<a class="anchorbutton" id="approvebutton" href="/approveTest/{{test.id}}/">Approve</a>
|
||||||
{% if test.finished %}
|
|
||||||
<a class="anchorbutton" id="restartbutton" href="/restartTest/{{test.id}}/">Restart</a>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="anchorbutton" id="stopbutton" href="/stopTest/{{test.id}}/">Stop</a>
|
<a class="anchorbutton deadbutton">Approve</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Restart Button: For Approvers or Test Authors of finished tests -->
|
||||||
|
{% if test.finished and profile.approver %}
|
||||||
|
<a class="anchorbutton" id="stopbutton" href="/restartTest/{{test.id}}/">Restart</a>
|
||||||
|
{% elif test.finished and profile.user.username is test.author %}
|
||||||
|
<a class="anchorbutton" id="stopbutton" href="/restartTest/{{test.id}}/">Restart</a>
|
||||||
|
{% elif test.finished %}
|
||||||
|
<a class="anchorbutton deadbutton">Restart</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Stop Button: For Approvers or Test Authors of active tests -->
|
||||||
|
{% if not test.finished and profile.approver %}
|
||||||
|
<a class="anchorbutton" id="restartbutton" href="/stopTest/{{test.id}}/">Stop</a>
|
||||||
|
{% elif not test.finished and profile.user.username is test.author %}
|
||||||
|
<a class="anchorbutton" id="restartbutton" href="/stopTest/{{test.id}}/">Stop</a>
|
||||||
|
{% elif not test.finished %}
|
||||||
|
<a class="anchorbutton deadbutton">Stop</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Delete Button: For Approvers or Test Authors -->
|
||||||
|
{% if profile.approver or profile.user.username is test.author %}
|
||||||
<a class="anchorbutton" id="deletebutton" href="/deleteTest/{{test.id}}/">Delete</a>
|
<a class="anchorbutton" id="deletebutton" href="/deleteTest/{{test.id}}/">Delete</a>
|
||||||
<h4>{{test.dev.name}} vs {{test.base.name}} <a href="{{test|gitDiffLink}}">DIFF</a></h4>
|
{% else %}
|
||||||
|
<a class="anchorbutton deadbutton">Delete</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Dev vs Base [Git Diff Link] -->
|
||||||
|
<h4>{{test.dev.name}} vs {{test.base.name}}
|
||||||
|
<a href="{{test|gitDiffLink}}">DIFF</a>
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<!-- ELO, SPRT, LLR, Games -->
|
||||||
<pre>{{test|longStatBlock|linebreaksbr}}</pre>
|
<pre>{{test|longStatBlock|linebreaksbr}}</pre>
|
||||||
|
|
||||||
<form method="POST" action="/editTest/{{test.id}}/">
|
<form method="POST" action="/editTest/{{test.id}}/">
|
||||||
@@ -103,7 +136,11 @@
|
|||||||
<input value="{{test.priority}}" name="priority"></br>
|
<input value="{{test.priority}}" name="priority"></br>
|
||||||
<label>Throughput</label>
|
<label>Throughput</label>
|
||||||
<input value="{{test.throughput}}" name="throughput"></br>
|
<input value="{{test.throughput}}" name="throughput"></br>
|
||||||
|
{% if profile.approver or profile.user.username is test.author %}
|
||||||
<input type="submit" name="submit" value="Modify">
|
<input type="submit" name="submit" value="Modify">
|
||||||
|
{% else %}
|
||||||
|
<input class="deadbutton" type="submit" name="submit" value="Modify">
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
Reference in new issue
Block a user