Permalink
Browse files

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

…igation.
  • Loading branch information...
1 parent bb58fab commit 06e88f4f622125d90a6eb218028c0b7edb291652 @buchi buchi committed Mar 21, 2012
Showing with 19 additions and 14 deletions.
  1. +0 −9 ftw/solr/browser/configure.zcml
  2. +1 −1 ftw/solr/browser/search.js
  3. +4 −4 ftw/solr/browser/search.pt
  4. +14 −0 ftw/solr/browser/search.py
@@ -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"
@@ -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());
@@ -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,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.

0 comments on commit 06e88f4

Please sign in to comment.