hook search targets to their sections

This commit is contained in:
Frédéric Péters 2011-11-17 11:53:49 +01:00
parent a7bb9519f1
commit 053b635872
2 changed files with 21 additions and 18 deletions

View File

@ -22,7 +22,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
<tal:block tal:define="p batch/previous | nothing">
<a href="" id="results-nav-prev" tal:condition="p"
tal:attributes="href python: '%s?%s' % (url , mq( batchlinkparams, {batch.b_start_str:p.first} ))">
tal:attributes="href python: '%s?%s#%s' % (url , mq( batchlinkparams, {batch.b_start_str:p.first} ), batch.b_start_str)">
&laquo;
<span i18n:translate="batch_previous_x_items" tal:omit-tag="">
Previous
@ -42,7 +42,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
<tal:block tal:define="n batch/next | nothing">
<a href="" id="results-nav-next" tal:condition="n"
tal:attributes="href python: '%s?%s' % (url , mq( batchlinkparams, {batch.b_start_str:n.first} ))">
tal:attributes="href python: '%s?%s#%s' % (url , mq( batchlinkparams, {batch.b_start_str:n.first} ), batch.b_start_str)">
<span i18n:translate="batch_next_x_items" tal:omit-tag="">
Next
<span i18n:name="number" tal:omit-tag="" tal:content="n/length">n</span>
@ -67,7 +67,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
</tal:comment>
<span tal:condition="python: 1 not in batch.navlist">
<a href=""
tal:attributes="href python: '%s?%s' % (url, batch.pageurl(batchlinkparams,1));">1</a>
tal:attributes="href python: '%s?%s#%s' % (url, batch.pageurl(batchlinkparams,1), batch.b_start_str);">1</a>
<span tal:condition="python: 2 not in (batch.prevlist or batch.leapback)"
tal:omit-tag="">
&hellip;
@ -84,7 +84,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
tal:define="page python:linklist[0];
query python:linklist[1];"
tal:content="page"
tal:attributes="href python: '%s?%s' % (url,query)" >
tal:attributes="href python: '%s?%s#%s' % (url,query, batch.b_start_str)" >
</a>
&hellip;
</span>
@ -99,7 +99,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
tal:define="page python:linklist[0];
query python:linklist[1];"
tal:content="page"
tal:attributes="href python: '%s?%s' % (url,query)" >
tal:attributes="href python: '%s?%s#%s' % (url,query, batch.b_start_str)" >
</a>
</span>
@ -119,7 +119,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
tal:define="page python:linklist[0];
query python:linklist[1];"
tal:content="page"
tal:attributes="href python: '%s?%s' % (url,query)" >
tal:attributes="href python: '%s?%s#%s' % (url,query, batch.b_start_str)" >
</a>
</span>
@ -134,7 +134,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
tal:define="page python:linklist[0];
query python:linklist[1];"
tal:content="page"
tal:attributes="href python: '%s?%s' % (url,query)" >
tal:attributes="href python: '%s?%s#%s' % (url,query,batch.b_start_str)" >
</a>
</span>
@ -147,7 +147,7 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
&hellip;
</span>
<a href=""
tal:attributes="href python: '%s?%s' % (url,batch.pageurl(batchlinkparams,batch.numpages));"
tal:attributes="href python: '%s?%s#%s' % (url,batch.pageurl(batchlinkparams,batch.numpages), batch.b_start_str);"
tal:content="batch/numpages">3457</a>
</span>
@ -163,6 +163,5 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
<a tal:attributes="href python: 'feed?%s' % batch.pageurl(batchlinkparams,1);">Abonnez-vous au flux de cette recherche</a>
</div>
</body>
</html>

View File

@ -19,11 +19,15 @@
doc_results view/doc_results;
event_results view/event_results;
b_size python:5; b_size request/b_size | b_size;
b_start python:0;b_start request/b_start | b_start;
deputy_batch python:Batch(list(deputy_results), b_size, int(b_start), orphan=1);
page_batch python:Batch(list(page_results), b_size, int(b_start), orphan=1);
doc_batch python:Batch(list(doc_results), b_size, int(b_start), orphan=1);
event_batch python:Batch(list(event_results), b_size, int(b_start), orphan=1);
b_start python:0;
b_deputy_start python:0;b_deputy_start request/b_deputy_start | b_start;
b_page_start python:0;b_page_start request/b_page_start | b_start;
b_doc_start python:0;b_doc_start request/b_doc_start | b_start;
b_event_start python:0;b_event_start request/b_event_start | b_start;
deputy_batch python:Batch(list(deputy_results), b_size, int(b_deputy_start), orphan=1, b_start_str='b_deputy_start');
page_batch python:Batch(list(page_results), b_size, int(b_page_start), orphan=1, b_start_str='b_page_start');
doc_batch python:Batch(list(doc_results), b_size, int(b_doc_start), orphan=1, b_start_str='b_doc_start');
event_batch python:Batch(list(event_results), b_size, int(b_event_start), orphan=1, b_start_str='b_event_start');
">
<form method="get" action="search2">
<input name="SearchableText" type="text"
@ -32,7 +36,7 @@
</form>
<div id="deputies-results" tal:condition="python:len(deputy_results)">
<h2>Députés</h2>
<h2 id="b_deputy_start">Députés</h2>
<div class="resultsinfobox">
<span>Nombre de résultats : <span tal:replace="python:len(deputy_results)"/></span>
<a class="button" tal:attributes="href view/deputy_form_url">Filtre avancé</a>
@ -66,7 +70,7 @@
</div>
<div id="docs-results" tal:condition="python:len(doc_results)">
<h2>Documents et dossiers</h2>
<h2 id="b_doc_start">Documents et dossiers</h2>
<div class="resultsinfobox">
<span>Nombre de résultats : <span tal:replace="python:len(doc_results)"/></span>
<a class="button" tal:attributes="href view/docdos_form_url">Filtre avancé</a>
@ -90,7 +94,7 @@
</div>
<div id="events-results" tal:condition="python:len(event_results)">
<h2>Événements</h2>
<h2 id="b_event_start">Événements</h2>
<div class="resultsinfobox">
<span>Nombre de résultats : <span tal:replace="python:len(event_results)"/></span>
<a class="button" tal:attributes="href view/event_form_url">Filtre avancé</a>
@ -113,7 +117,7 @@
</div>
<div id="pages-results" tal:condition="python:len(page_results)">
<h2>Ailleurs sur le site</h2>
<h2 id="b_page_start">Ailleurs sur le site</h2>
<div class="resultsinfobox">
<span>Nombre de résultats : <span tal:replace="python:len(page_results)"/></span>
</div>