diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-04-16 19:47:42 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-04-16 19:47:42 +0200 |
commit | 8b9008a94a3b3b626bbe916d6f461189938dab3c (patch) | |
tree | 363108527f435470aba9cf64c796986ab73be78d | |
parent | f4a3253ff50546dc210c67e0ecbb24e78cffb183 (diff) | |
download | Chimère-8b9008a94a3b3b626bbe916d6f461189938dab3c.tar.bz2 Chimère-8b9008a94a3b3b626bbe916d6f461189938dab3c.zip |
Allow disabling of autocomplete
-rw-r--r-- | chimere/settings.sample.py | 2 | ||||
-rw-r--r-- | chimere/static/chimere/css/styles.css | 1 | ||||
-rw-r--r-- | chimere/templates/search/search.html | 3 | ||||
-rw-r--r-- | chimere/views.py | 8 |
4 files changed, 11 insertions, 3 deletions
diff --git a/chimere/settings.sample.py b/chimere/settings.sample.py index 1ddef5f..adb76fe 100644 --- a/chimere/settings.sample.py +++ b/chimere/settings.sample.py @@ -126,6 +126,8 @@ HAYSTACK_CONNECTIONS = { 'URL': 'http://127.0.0.1:8080/solr' }, } +HAYSTACK_SEARCH_RESULTS_PER_PAGE = 12 +HAYSTACK_AUTOCOMPLETE = False CHIMERE_CSV_ENCODING = 'ISO-8859-1' diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index fd39b79..73b702f 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -803,6 +803,7 @@ table.inline-table td input[type=file]{ list-style-type:none; margin:0; padding:4px; + padding-bottom: 70px; } #search-listing ul li{ diff --git a/chimere/templates/search/search.html b/chimere/templates/search/search.html index 95d3937..b78cc1d 100644 --- a/chimere/templates/search/search.html +++ b/chimere/templates/search/search.html @@ -42,10 +42,11 @@ $(function(){ $("#main-map").chimere("razMap"); haystack_search(evt); }); + {% if autocomplete %} window.autocomplete = new Autocomplete({ form_selector: '.autocomplete-me' }); - window.autocomplete.setup(); + window.autocomplete.setup();{% endif %} }); </script> {% endif %} diff --git a/chimere/views.py b/chimere/views.py index 8b5af5a..0dd5cd5 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2014 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2008-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # # RSS : Copyright (C) 2010 Pierre Clarenc <pierre.crc_AT_gmailDOTcom>, # Samuel Renard <renard.samuel_AT_gmailDOTcom>, @@ -967,7 +967,11 @@ if hasattr(settings, 'CHIMERE_SEARCH_ENGINE') \ from haystack.views import SearchView as HaystackSearchView from haystack.query import SearchQuerySet class SearchView(HaystackSearchView): - pass + def extra_context(self, *args, **kwargs): + context = super(SearchView, self).extra_context(*args, **kwargs) + context["autocomplete"] = settings.HAYSTACK_AUTOCOMPLETE \ + if hasattr(settings, 'HAYSTACK_AUTOCOMPLETE') else False + return context def autocomplete(request): sqs = SearchQuerySet().autocomplete( content_auto=request.GET.get('q', ''))[:5] |