add initial guided search page

This commit is contained in:
Frédéric Péters 2011-10-03 13:54:31 +02:00
parent de90107561
commit 67de80ff7c
3 changed files with 116 additions and 0 deletions

View File

@ -23,4 +23,11 @@
class=".simple.SimpleSearchView"
permission="zope2.View"/>
<browser:page
for="Products.CMFPlone.interfaces.IPloneSiteRoot"
name="guided-search"
class=".guided.GuidedSearchView"
template="guided-search.pt"
permission="zope2.View"/>
</configure>

View File

@ -0,0 +1,79 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
lang="en"
metal:use-macro="context/main_template/macros/master"
i18n:domain="tabellio.searchform">
<body>
<metal:main fill-slot="main">
<tal:main-macro metal:define-macro="main">
<div tal:replace="structure provider:plone.abovecontenttitle" />
<h1 class="documentFirstHeading" tal:content="context/title" />
<div tal:replace="structure provider:plone.belowcontenttitle" />
<div id="bottom-nav" class="category_buttons">
<div class="category">
<a href="#" class="summary url" tal:attributes="href view/deputies_url">
<div class="category_image">
<img width="210" height="83" src="404"/>
</div>
<div class="category_content">
<p>Députés</p>
</div>
<div class="category_image_effect">
</div>
</a>
</div>
<div class="category">
<a href="#" class="summary url">
<div class="category_image">
<img width="210" height="83" src="404"/>
</div>
<div class="category_content">
<p>Documents et publications</p>
</div>
<div class="category_image_effect">
</div>
</a>
</div>
<div class="category">
<a href="#" class="summary url">
<div class="category_image">
<img width="210" height="83" src="404"/>
</div>
<div class="category_content">
<p>Événements</p>
</div>
<div class="category_image_effect">
</div>
</a>
</div>
<div class="category">
<a href="#" class="summary url">
<div class="category_image">
<img width="210" height="83" src="404"/>
</div>
<div class="category_content">
<p>Divers</p>
</div>
<div class="category_image_effect">
</div>
</a>
</div>
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />
</tal:main-macro>
</metal:main>
</body>
</html>

View File

@ -0,0 +1,30 @@
from zope import component
from Products.Five import BrowserView
from Products.CMFCore.utils import getToolByName
from plone.registry.interfaces import IRegistry
from tabellio.config.interfaces import ITabellioSettings
class GuidedSearchView(BrowserView):
def deputies_url(self):
self.settings = component.getUtility(IRegistry).forInterface(ITabellioSettings, False)
self.portal = getToolByName(self.context, 'portal_url').getPortalObject()
return self.deputies_folder.absolute_url()
def get_folder_at_path(self, path):
current = self.portal
for part in path.split('/'):
if not part:
continue
current = getattr(current, part)
return current
_deputies_folder = None
def deputies_folder(self):
if self._deputies_folder:
return self._deputies_folder
path = self.settings.deputiesPath
self._deputies_folder = self.get_folder_at_path(path)
return self._deputies_folder
deputies_folder = property(deputies_folder)