Add search functionality to public corpora page

This commit is contained in:
Patrick Jentsch 2022-12-07 14:12:30 +01:00
parent f056a15ba8
commit 65c907a990

View File

@ -9,12 +9,10 @@
<h1 id="title"><i class="nopaque-icons" style="font-size: inherit;">I</i>Corpora</h1> <h1 id="title"><i class="nopaque-icons" style="font-size: inherit;">I</i>Corpora</h1>
</div> </div>
<div class="white" style="padding: 0 15px; border-radius: 20px;"> <div class="white" style="padding: 0 15px; border-radius: 20px;">
<form>
<div class="input-field"> <div class="input-field">
<i class="material-icons prefix">search</i> <i class="material-icons prefix">search</i>
<input id="search" placeholder="Find public corpora" type="text"> <input id="public-corpora-search" placeholder="Find public corpora" type="text">
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
@ -38,7 +36,9 @@
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script> <script>
let publicCorporaSearchElement = document.querySelector('#public-corpora-search');
let corpusList = CorpusList.getInstance(document.querySelector('#corpora .corpus-list .list')); let corpusList = CorpusList.getInstance(document.querySelector('#corpora .corpus-list .list'));
publicCorporaSearchElement.addEventListener('keyup', function() {corpusList.listjs.search(this.value);});
corpusList._init({{ corpora|tojson }}); corpusList._init({{ corpora|tojson }});
</script> </script>
{% endblock scripts %} {% endblock scripts %}