Grey out illegal buttons in viewTest

This commit is contained in:
AndyGrant committed 2019-10-24 04:26:12 -04:00
1 parent 0090b64510
commit 41422d0b32
3 files changed
+60 -17

No files matched your search

+6 -1
View File
@@ -142,8 +142,13 @@ a:link, a:visited, a:hover, a:active {
background-color: #FA8E8E;
}
#content #actions .deadbutton {
background-color: #808080;
pointer-events: none;
}
#content #actions input {
width: 240px;
width: 260px;
}
#content #actions input[type=submit] {
+2 -1
View File
@@ -306,7 +306,8 @@ def viewTest(request, id):
# Build context dictionary for test template
test = Test.objects.get(id=id)
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)
# Unable to find test
+52 -15
View File
@@ -87,14 +87,47 @@
<div id="actions">
<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>
{% if test.finished %}
<a class="anchorbutton" id="restartbutton" href="/restartTest/{{test.id}}/">Restart</a>
{% else %}
<a class="anchorbutton" id="stopbutton" href="/stopTest/{{test.id}}/">Stop</a>
<a class="anchorbutton deadbutton">Approve</a>
{% 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>
<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>
<form method="POST" action="/editTest/{{test.id}}/">
@@ -103,7 +136,11 @@
<input value="{{test.priority}}" name="priority"></br>
<label>Throughput</label>
<input value="{{test.throughput}}" name="throughput"></br>
{% if profile.approver or profile.user.username is test.author %}
<input type="submit" name="submit" value="Modify">
{% else %}
<input class="deadbutton" type="submit" name="submit" value="Modify">
{% endif %}
</form>
</div>
<br>
@@ -121,17 +158,17 @@
<th>Time</th>
</tr>
{% for result in results %}
<tr>
<td>{{result.machine.owner}}</td>
<td>{{result.machine.osname}}</td>
<td>{{result.updated|date:'Y-m-d H:i'}}</td>
<td class="numeric">{{result.games}}</td>
<td class="numeric">{{result.wins}}</td>
<td class="numeric">{{result.losses}}</td>
<td class="numeric">{{result.draws}}</td>
<td class="numeric">{{result.crashes}}</td>
<td class="numeric">{{result.timeloss}}</td>
</tr>
<tr>
<td>{{result.machine.owner}}</td>
<td>{{result.machine.osname}}</td>
<td>{{result.updated|date:'Y-m-d H:i'}}</td>
<td class="numeric">{{result.games}}</td>
<td class="numeric">{{result.wins}}</td>
<td class="numeric">{{result.losses}}</td>
<td class="numeric">{{result.draws}}</td>
<td class="numeric">{{result.crashes}}</td>
<td class="numeric">{{result.timeloss}}</td>
</tr>
{% endfor %}
</table>
</div>