Skip to content

Commit

Permalink
drop hidden "mark completed" form on /admin/responses
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Aug 26, 2021
1 parent 1880b89 commit f7f48f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
30 changes: 0 additions & 30 deletions static/bridgy.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,3 @@ function do_preview(site) {
req.open('post', '/publish/preview?' + params.toString());
req.send();
}

// used in /admin/responses
function maybeShowInputs(event) {
if (String.fromCharCode(event.charCode) == "x") {
for (const elem of document.getElementsByTagName("input")) {
elem.style.display = "inline";
}
}
}

// used in /admin/responses
function selectAll() {
checked = document.getElementById("all").checked;
for (const elem of document.getElementsByTagName("input")) {
elem.checked = checked;
}
}

// Polyfill String.startsWith() since it's only supported in Firefox right now.
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
enumerable: false,
configurable: false,
writable: false,
value: function (searchString, position) {
position = position || 0;
return this.indexOf(searchString, position) === position;
}
});
}
13 changes: 1 addition & 12 deletions templates/admin_responses.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
table { border-spacing: .5em; }
th, td { border: none; }
li { list-style: none; }
input { display: none; }
</style>
<script async type="text/javascript" src="/static/bridgy.js"></script>
</head>

<body onkeypress="maybeShowInputs(event)">
<body>
<h2>Active responses</h2>
<form method="post" action="/admin/mark_complete">
<table>
<tr>
<th>Source</th>
Expand All @@ -22,7 +19,6 @@ <h2>Active responses</h2>
<th>Last attempt</th>
<th>Created</th>
<th>Error URLs</th>
<th><input id="all" type="checkbox" onclick="selectAll()" /></th>
</tr>

{% for r in responses %}
Expand All @@ -45,15 +41,8 @@ <h2>Active responses</h2>
<td>{{ naturaltime(r.created) }}</td>

<td>{{ r.links|join('<br>')|safe }}</td>

<td class="hidden">
<input name="key" value="{{ r.key.urlsafe().decode() }}" type="checkbox" />
</td>
</tr>
{% endfor %}
</table>

<div style="text-align: right"><input type="submit" value="Mark complete" /></div>
</form>
</body>
</html>

0 comments on commit f7f48f8

Please sign in to comment.