Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Also use 'search' view for results to have correct links in batch nav…

…igation.
  • Loading branch information...
commit 06e88f4f622125d90a6eb218028c0b7edb291652 1 parent bb58fab
@buchi buchi authored
View
9 ftw/solr/browser/configure.zcml
@@ -24,19 +24,10 @@
<browser:page
for="*"
name="search"
- template="search.pt"
class=".search.SearchView"
permission="zope2.View"
layer="ftw.solr.interfaces.IFtwSolrLayer" />
- <browser:page
- name="search-results"
- class=".search.SearchView"
- permission="zope2.View"
- for="Products.CMFCore.interfaces.IFolderish"
- template="results.pt"
- layer="ftw.solr.interfaces.IFtwSolrLayer" />
-
<browser:resource
name="search.js"
file="search.js"
View
2  ftw/solr/browser/search.js
@@ -6,7 +6,7 @@ jQuery(function ($) {
var State = History.getState();
var qs = State.url.replace(/^.*\?/, '') + '&ajax=1';
var results_container = $('#search-results-wrapper');
- $.get('@@search-results', qs, function(data) {
+ $.get('@@search', qs, function(data) {
results_container.hide();
var $data = $(data);
$('#portal-searchfacets').html($data.find('#portal-searchfacets').html());
View
8 ftw/solr/browser/search.pt
@@ -47,11 +47,11 @@
value="Search"
i18n:attributes="value label_search;"/>
- <div tal:define="view nocall: context/@@search-facets | nothing"
- tal:condition="python: view"
- tal:replace="structure view/hiddenfields" />
+ <div tal:define="fview nocall: context/@@search-facets | nothing"
+ tal:condition="python: fview"
+ tal:replace="structure fview/hiddenfields" />
- <tal:results tal:replace="structure context/@@search-results" />
+ <tal:results tal:replace="structure view/render_results" />
<div class="visualClear"><!-- --></div>
</form>
View
14 ftw/solr/browser/search.py
@@ -14,6 +14,20 @@
class SearchView(browser.Search):
+ template = ViewPageTemplateFile('search.pt')
+ results_template = ViewPageTemplateFile('results.pt')
+
+ def __call__(self):
+ if 'ajax' in self.request.form:
+ del self.request.form['ajax']
+ # Disable theming for ajax requests
+ self.request.response.setHeader('X-Theme-Disabled', 'True')
+ return self.results_template()
+ return self.template()
+
+ def render_results(self):
+ return self.results_template()
+
def results(self, query=None, batch=True, b_size=10, b_start=0):
"""Get properly wrapped search results from the catalog.
'query' should be a dictionary of catalog parameters.
Please sign in to comment.
Something went wrong with that request. Please try again.