add deputy search form, directing to the deputy filter form
This commit is contained in:
parent
51dca56f4a
commit
4498a81e96
|
@ -24,8 +24,8 @@
|
|||
|
||||
<div id="deputies-results" class="advbox">
|
||||
<h2 id="b_deputy_start">Députés</h2>
|
||||
<form>
|
||||
...
|
||||
<form method="post" tal:attributes="action string:${view/deputiesform_url}">
|
||||
<div tal:replace="structure view/deputy_search_form"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -440,6 +440,28 @@ class DocumentPfbSearchForm(form.Form):
|
|||
return
|
||||
|
||||
|
||||
class IDeputySearch(interface.Interface):
|
||||
search_type_is_deputy = schema.TextLine(title=u'Search Type', default=u'1', required=False)
|
||||
|
||||
name = schema.TextLine(title=_(u'Name'), required=False)
|
||||
polgroup = schema.Choice(title=_(u'Political Group'),
|
||||
required=False, source=possible_polgroups)
|
||||
|
||||
|
||||
class DeputySearchForm(form.Form):
|
||||
prefix = 'deputy'
|
||||
fields = field.Fields(IDeputySearch)
|
||||
ignoreContext = True
|
||||
template = ViewPageTemplateFile('form_templates/view_deputy_search.pt')
|
||||
|
||||
def updateWidgets(self):
|
||||
super(DeputySearchForm, self).updateWidgets()
|
||||
self.widgets['search_type_is_deputy'].mode = z3c.form.interfaces.HIDDEN_MODE
|
||||
|
||||
@button.buttonAndHandler(_(u'Submit'))
|
||||
def handleApply(self, action):
|
||||
pass
|
||||
|
||||
class IGlobalSearchForm(interface.Interface):
|
||||
search_type_is_document = schema.TextLine(title=u'Search Type', required=False)
|
||||
search_type_is_dossier = schema.TextLine(title=u'Search Type', required=False)
|
||||
|
@ -638,6 +660,11 @@ class SearchView(BrowserView):
|
|||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
return catalog(**kw)
|
||||
|
||||
def deputy_search_form(self):
|
||||
f = DeputySearchForm(self.context, self.request)
|
||||
f.update()
|
||||
return f.render()
|
||||
|
||||
def document_pfb_search_form(self):
|
||||
f = DocumentPfbSearchForm(self.context, self.request)
|
||||
f.update()
|
||||
|
@ -677,6 +704,18 @@ class SearchView(BrowserView):
|
|||
except IndexError:
|
||||
return '#'
|
||||
|
||||
def deputiesform_url(self):
|
||||
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 '#'
|
||||
|
||||
|
||||
class Reflex(BrowserView):
|
||||
def __call__(self):
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:tal="http://xml.zope.org/namespaces/tal">
|
||||
<body>
|
||||
<metal:use use-macro="context/@@ploneform-macros/fields" />
|
||||
<metal:use use-macro="context/@@ploneform-macros/actions" />
|
||||
</body>
|
||||
</html>
|
Reference in New Issue