Commit 89b77f02 authored by felix.herrmann's avatar felix.herrmann
Browse files

feat(search): add initial search template with filter by countries

parent ac04ecc4
......@@ -34,3 +34,13 @@ function tagTypeahead(tagType, urlString){
limit: 10 /* Specify max number of suggestions to be displayed */
});
};
$("#search-top").keyup(function() {
$("#search-middle").val( this.value );
$("#queryfield").val( this.value );
});
$("#search-middle").keyup(function() {
$("#search-top").val( this.value );
$("#queryfield").val( this.value );
});
\ No newline at end of file
{% load static i18n %}
{% if object_list %}
<h2>{% trans "Researchers" %}</h2>
{% for object in object_list %}
{% if search_type %}
{% include 'ddusers/_user_detail_card.html' with object=object image_url=objectimage.url dsid=ds.uuid cardtype=search_type %}
{% else %}
{% include 'ddusers/_user_detail_card.html' with object=object image_url=objectimage.url %}
{% endif %}
{% endfor %}
{% else %}
{% trans "Nothing found" %}
{% endif %}
{% extends request.is_intercooler|yesno:"blank.html,base.html" %}
{% load static i18n core_tags %}
{% block content %}
{% block ic-content %}
<div class="row">
<div class="col-md-8">
<h2>{% trans "Search" %}</h2>
{# big search field #}
<div class="input-group mb-3">
<input id="search-middle" class="form-control"{% if query %}value={{ query }}{% else %}placeholder="Search"{% endif %} name="q" aria-label="Search">
<div class="input-group-append">
<button class="input-group-text" type="button" ic-action="click" ic-action-target="#searchsubmit"><i class="fas fa-search"></i></button>
</div>
</div>
{% if object_list %}
{% for object in object_list %}
{% if search_type %}
{% include 'ddusers/_user_detail_card.html' with object=object image_url=objectimage.url dsid=ds.uuid cardtype=search_type %}
{% else %}
{% include 'ddusers/_user_detail_card.html' with object=object image_url=objectimage.url %}
{% endif %}
{% endfor %}
{% else %}
{% trans "Nothing found" %}
{% endif %}
</div>
{# filters #}
<div class="col-md-4">
<form action="{% url 'ddusers:search' %}">
{# hidden queryfield #}
<input id="queryfield" hidden {% if query %}value={{ query }}{% else %}placeholder="Search"{% endif %} name="q">
<input id="searchsubmit" type="submit" hidden />
<h2>{% trans "Filters" %}</h2>
{# countries #}
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-center">
All countries
<div class="form-check">
<input class="form-check-input position-static" name="countries" type="checkbox" value="all" aria-label="{% trans "All countries" %}">
</div>
</li>
{% for country in countries_all %}
<li class="list-group-item d-flex justify-content-between align-items-center">
{{ country }}
<div class="form-check">
<input class="form-check-input position-static" name="countries" type="checkbox" value="{{ country.slug }}" aria-label="{% trans country.name %}"{% if country.slug in countries %} checked{% endif %}>
</div>
</li>
{% endfor %}
</ul>
</form>
</div>
</div>
{% endblock ic-content %}
{% endblock content %}
......@@ -8,8 +8,12 @@
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<input class="w-25 form-control mx-auto" type="text" placeholder="Search" name="q" ic-get-from="{% url 'ddusers:search' %}" ic-target="#content" aria-label="Search">
<div class="input-group w-25 mx-auto">
<input id="search-top" class="form-control" type="text" {% if query %}value={{ query }}{% else %}placeholder="Search"{% endif %} name="q" aria-label="Search">
<div class="input-group-append">
<button class="input-group-text" type="button" ic-get-from="{% url 'ddusers:search' %}" ic-include="#search-top" ic-push-url="true" ic-push-params="q" ic-target="#content"><i class="fas fa-search"></i></button>
</div>
</div>
<ul class="navbar-nav ml-auto">
{% if request.user.is_authenticated %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment