Skip to content

Business intelligence made simple

Removed jQuery from uploads page [skip ci]

Andrew Kanef89c9ad7c3c0
diff --git a/app/views/blazer/uploads/index.html.erb b/app/views/blazer/uploads/index.html.erb
index 96506f80..f6c16c7f 100644
--- a/app/views/blazer/uploads/index.html.erb
+++ b/app/views/blazer/uploads/index.html.erb
@@ -19,7 +19,7 @@
</div>
</div>
- <input id="search" type="text" placeholder="Start typing a table or person" style="width: 300px; display: inline-block;" class="search form-control" />
+ <input id="search" type="text" placeholder="Start typing a table or person" style="width: 300px; display: inline-block;" class="search form-control" autofocus />
</div>
<table id="uploads" class="table">
@@ -46,10 +46,10 @@
</table>
<%= javascript_tag nonce: true do %>
- $("#search").on("keyup", function() {
- var value = $(this).val().toLowerCase()
- $("#uploads tbody tr").filter( function() {
- $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
- })
- }).focus()
+ document.getElementById("search").addEventListener("input", function () {
+ const value = this.value.toLowerCase()
+ for (const upload of document.querySelectorAll("#uploads tbody tr")) {
+ toggle(upload, upload.textContent.toLowerCase().includes(value))
+ }
+ })
<% end %>