Skip to content

Commit

Permalink
Adding searchbar for environments (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc authored Jun 21, 2022
1 parent d1dc260 commit 10b67ab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions conda-store-server/conda_store_server/server/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
{% block title %}Home{% endblock %}

{% block content %}

<form id="search-form">
<div class="input-group mt-3 mb-3">
<input id="search-text" type="text" class="form-control" placeholder="Search" aria-label="Search">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="submit">Search</button>
</div>
</div>
</form>

<h2>Environments</h2>
{% for environment in environments %}
<div class="card my-2">
Expand Down Expand Up @@ -37,5 +47,13 @@ <h5 class="card-title">
document.execCommand("copy");
document.body.removeChild(tempInput);
}

function searchHandler(event) {
event.preventDefault();
let search = document.querySelector("#search-text");
window.location.href = `?search=${search.value}`;
}
let form = document.querySelector("#search-form");
form.addEventListener("submit", searchHandler);
</script>
{% endblock %}

0 comments on commit 10b67ab

Please sign in to comment.