summaryrefslogtreecommitdiff
path: root/templates/search/search.html
blob: 8aab1ebf29a4c4d493b2f004986123816892e572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{% load url from future %}{% load i18n %}
<script type='text/javascript'>
var do_you_mean = "{% trans 'Do you mean: ' %}";
var end_do_you_mean = "{% trans '?' %}";
</script>
{% if query %}
{% include "search/search_js.html" %}
<div id='search-listing'>
  <ul>
{% for result in page.object_list %}
    <li>
        <img src='{{MEDIA_URL}}{{result.object.default_category.icon.image}}'/><a href="#" onclick="$('#main-map').chimere('showPopup', '{{result.object.full_id}}');return false;">{{ result.object }}</a>
    </li>
{% empty %}
    <li>{% trans "No results found." %}</li>
{% endfor %}
  </ul>
</div>
{% if page.has_previous or page.has_next %}
    <div id='search-nav'>
    <nav>
      <ul class="pager">
        {% if page.has_previous %}<li class="previous"><a href="#" onclick="haystack_search(this, {{ page.previous_page_number }});">&larr; {% trans "Previous" %}</a></li>{% endif %}
        {% if page.has_next %}<li class="next"><a href="#" onclick="haystack_search(this, {{ page.next_page_number }});">{% trans "More results..." %} &rarr;</a></li>{% endif %}
      </ul>
    </nav>
    </div>
{% endif %}

{% else %}
<form id='search-form' class='autocomplete-me'>
    <input type="text" id="id_q" name="q" autocomplete="off"/>
    <button name='haystack-search' id='haystack-search' type='button' class="btn btn-default"><span class='action-label'>{% trans "Search" %} </span><span class="glyphicon glyphicon-search"></span></button>
</form>
<div id='spelling'></div>
<div id='search-result'></div>
<script type='text/javascript'>
no_result_message = "{% trans 'No exact match.' %}";
$(function(){
    $('#haystack-search').click(
        function(evt){
            $("#main-map").chimere("razMap");
            haystack_search(evt);
            search_panel_open();
    });
    {% if autocomplete %}
    window.autocomplete = new Autocomplete({
        form_selector: '.autocomplete-me'
    });
    window.autocomplete.setup();{% endif %}
});
</script>
{% endif %}