Some improvements to SPSA's CSS/HTML/JS (#173)
Move the copy_text function to /static Record the original order of inputs for SPSA Display SPSA data in the original order ( if it exists ) Format ints as ints instead of floats for Start/Min/Max Swap the Curr/Start column to clearly show the initial triplet Right align all of the SPSA stuff Change the copy button on Tunes to be the original SPSA Input
This commit is contained in:
1 parent
81c5c9bfbc
commit
7c3f4a7203
5 files changed
+87
-77
No files matched your search
@@ -1,44 +1,13 @@
|
||||
{% extends "OpenBench/base.html" %}
|
||||
|
||||
{% load mytags %}
|
||||
{% load static %}
|
||||
|
||||
{% block style %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script>
|
||||
|
||||
function copy_statblock() {
|
||||
|
||||
var text = document.getElementById("long-statblock").innerHTML;
|
||||
text = text.replace(/<br>/g, "\n");
|
||||
text += "\n" + window.location.href;
|
||||
|
||||
// navigator.clipboard.writeText(text); // Optimal solution
|
||||
|
||||
// Suboptimal, HTTP solution
|
||||
|
||||
var area = document.createElement("textarea");
|
||||
area.value = text;
|
||||
document.body.append(area);
|
||||
|
||||
area.focus();
|
||||
area.select();
|
||||
|
||||
try {
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(area);
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
document.body.removeChild(area);
|
||||
console.error("Unable to copy to Clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script src="{% static 'copy_text.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@@ -132,7 +101,7 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Copy Button: Copy the current results statblock -->
|
||||
<a class="copy-button" onclick="copy_statblock()">
|
||||
<a class="copy-button" onclick="copy_text('long-statblock', true)">
|
||||
<i class="fa-regular fa-clone copy-button"></i>
|
||||
</a>
|
||||
|
||||
|
||||
@@ -1,44 +1,13 @@
|
||||
{% extends "OpenBench/base.html" %}
|
||||
|
||||
{% load mytags %}
|
||||
{% load static %}
|
||||
|
||||
{% block style %}
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script>
|
||||
|
||||
function copy_statblock() {
|
||||
|
||||
var text = document.getElementById("long-statblock").innerHTML;
|
||||
text = text.replace(/<br>/g, "\n");
|
||||
text += "\n" + window.location.href;
|
||||
|
||||
// navigator.clipboard.writeText(text); // Optimal solution
|
||||
|
||||
// Suboptimal, HTTP solution
|
||||
|
||||
var area = document.createElement("textarea");
|
||||
area.value = text;
|
||||
document.body.append(area);
|
||||
|
||||
area.focus();
|
||||
area.select();
|
||||
|
||||
try {
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(area);
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
document.body.removeChild(area);
|
||||
console.error("Unable to copy to Clipboard");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script src="{% static 'copy_text.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
@@ -122,8 +91,9 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<!-- Copy Button: Copy the current results statblock -->
|
||||
<a class="copy-button" onclick="copy_statblock()">
|
||||
<!-- Copies Raw SPSA Input from a hidden element -->
|
||||
<pre id="spsa-input" style="display: none">{{test|spsa_original_input}}</pre>
|
||||
<a class="copy-button" onclick="copy_text('spsa-input', false)">
|
||||
<i class="fa-regular fa-clone copy-button"></i>
|
||||
</a>
|
||||
|
||||
@@ -152,6 +122,7 @@
|
||||
<label>Thread Limit</label>
|
||||
<input value="{{test.thread_limit|default:'None'}}" name="thread_limit">
|
||||
</div>
|
||||
|
||||
<!-- Edit Button: For Approvers or Test Authors -->
|
||||
{% if profile.approver or profile.user.username == test.author %}
|
||||
<input class="anchorbutton btn-blue w-100" type="submit" name="submit" value="Modify">
|
||||
@@ -167,8 +138,8 @@
|
||||
<table class="stripes wrappable">
|
||||
<tr class="table-header">
|
||||
<th> Name </th>
|
||||
<th> Start </th>
|
||||
<th> Curr </th>
|
||||
<th> Start </th>
|
||||
<th> Min </th>
|
||||
<th> Max </th>
|
||||
<th> C </th>
|
||||
@@ -180,7 +151,11 @@
|
||||
{% for row in test|spsa_param_digest %}
|
||||
<tr>
|
||||
{% for element in row %}
|
||||
<td> {{ element }} </td>
|
||||
{% if not forloop.first %}
|
||||
<td class='numeric'> {{ element }} </td>
|
||||
{% else %}
|
||||
<td> {{ element }} </td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<tr>
|
||||
{% endfor %}
|
||||
|
||||
Reference in new issue
Block a user