point to more search forms
This commit is contained in:
parent
228e39661b
commit
8bd377622d
|
@ -31,15 +31,15 @@
|
|||
|
||||
<div id="docs-results" class="advbox">
|
||||
<h2 id="b_doc_start">Documents</h2>
|
||||
<form method="post" tal:attributes="action string:${view/pfbdocform_url}#resultsbox">
|
||||
<form method="post" tal:attributes="action string:${view/docform_url}#resultsbox">
|
||||
<div tal:replace="structure view/document_pfb_search_form"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="events-results" class="advbox">
|
||||
<h2 id="b_event_start">Événements</h2>
|
||||
<form>
|
||||
...
|
||||
<form method="post" tal:attributes="action string:${view/eventform_url}#resultsbox">
|
||||
<div tal:replace="structure view/event_search_form"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
@ -122,7 +122,7 @@ function setup_sort_on(index, elem)
|
|||
$('#formfield-document-widgets-l_doctypes').each(setup_appearance);
|
||||
$('#formfield-document-widgets-l_topics').each(setup_appearance);
|
||||
$('#formfield-document-widgets-l_polgroups').each(setup_appearance);
|
||||
$('#formfield-document-widgets-sort_on').each(setup_sort_on);
|
||||
$('#formfield-document-widgets-sort_on').hide();
|
||||
$('div.advbox form').hide();
|
||||
$('div.advbox h2').click(function() { $(this).parent().find('form').toggle(); });
|
||||
});
|
||||
|
|
|
@ -744,7 +744,6 @@ class SearchView(BrowserView):
|
|||
data, errors = f.extractData()
|
||||
kw = {}
|
||||
|
||||
print data
|
||||
if not data.get('search_type_is_event'):
|
||||
return None
|
||||
|
||||
|
@ -765,13 +764,13 @@ class SearchView(BrowserView):
|
|||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
return catalog(**kw)
|
||||
|
||||
|
||||
def pfbdocform_url(self):
|
||||
def docform_url(self):
|
||||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
try:
|
||||
return catalog(
|
||||
portal_type='Folder',
|
||||
object_provides='tabellio.searchform.form.IFolderWithPfbDocuments',
|
||||
object_provides=('tabellio.searchform.form.IFolderWithPfbDocuments',
|
||||
'tabellio.searchform.form.IFolderWithDocuments'),
|
||||
limit=1)[0].getObject().absolute_url()
|
||||
except IndexError:
|
||||
return '#'
|
||||
|
@ -788,6 +787,9 @@ class SearchView(BrowserView):
|
|||
except IndexError:
|
||||
return '#'
|
||||
|
||||
def eventform_url(self):
|
||||
return self.portal_url() + '/eventsearch'
|
||||
|
||||
|
||||
class Reflex(BrowserView):
|
||||
def __call__(self):
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
<metal:main fill-slot="main">
|
||||
<tal:main-macro metal:define-macro="main">
|
||||
|
||||
<h1 class="documentFirstHeading">Page de résultats</h1>
|
||||
<h1 class="documentFirstHeading" tal:condition="python: request.form.get('SearchableText')">Page de résultats</h1>
|
||||
<h1 class="documentFirstHeading" tal:condition="python: not request.form.get('SearchableText')">Recherche</h1>
|
||||
|
||||
<a id="other-search" href="pfbadvsearch">Recherche avancée</a>
|
||||
|
||||
<div id="simplesearch"
|
||||
|
@ -33,6 +35,12 @@
|
|||
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="pfbsearch" tal:condition="python: not request.form.get('SearchableText')">
|
||||
<input name="SearchableText" type="text"
|
||||
tal:attributes="value python: request.form.get('SearchableText')"/>
|
||||
<input type="submit" class="submit-widget" value="Recherche"/>
|
||||
</form>
|
||||
|
||||
<div id="deputies-results" tal:condition="python:len(deputy_results)">
|
||||
<h2 id="b_deputy_start">Députés</h2>
|
||||
<div class="resultsinfobox">
|
||||
|
|
|
@ -17,13 +17,33 @@ class SimpleSearchView(BrowserView):
|
|||
batch_macros = ViewPageTemplateFile('batch_macros.pt')
|
||||
|
||||
def deputy_form_url(self):
|
||||
return '#'
|
||||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
try:
|
||||
return catalog(
|
||||
portal_type='Folder',
|
||||
object_provides=('tabellio.webviews.deputy.IDeputiesAndOthersFolderView',
|
||||
'tabellio.webviews.deputy.IPfbDeputiesFolderView',
|
||||
'tabellio.webviews.deputy.IFolderView'),
|
||||
limit=1)[0].getObject().absolute_url()
|
||||
except IndexError:
|
||||
return '#'
|
||||
|
||||
def docdos_form_url(self):
|
||||
return '#'
|
||||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
try:
|
||||
return catalog(
|
||||
portal_type='Folder',
|
||||
object_provides=('tabellio.searchform.form.IFolderWithPfbDocuments',
|
||||
'tabellio.searchform.form.IFolderWithDocuments'),
|
||||
limit=1)[0].getObject().absolute_url()
|
||||
except IndexError:
|
||||
return '#'
|
||||
|
||||
def portal_url(self):
|
||||
return getToolByName(self.context, 'portal_url').getPortalPath()
|
||||
|
||||
def event_form_url(self):
|
||||
return '#'
|
||||
return self.portal_url() + '/eventsearch'
|
||||
|
||||
def deputy_results(self):
|
||||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
|
|
Reference in New Issue