Add a new "big blocks" view for folders

http://plone.org/documentation/kb/applying-a-custom-view-to-a-specific-folder
This commit is contained in:
Frédéric Péters 2011-06-26 11:05:05 +02:00
parent 81586a99c5
commit 29124955ea
7 changed files with 102 additions and 4 deletions

View File

@ -25,7 +25,7 @@ setup(name='themis.looks',
zip_safe=False,
install_requires=[
'setuptools',
# -*- Extra requirements: -*-
'plone.app.contentmenu'
],
entry_points="""
# -*- Entry points: -*-

View File

@ -12,4 +12,6 @@ themis.looks.egg-info/paster_plugins.txt
themis.looks.egg-info/requires.txt
themis.looks.egg-info/top_level.txt
themis/looks/__init__.py
themis/looks/tests.py
themis/looks/interfaces.py
themis/looks/tests.py
themis/looks/views.py

View File

@ -1 +1,2 @@
setuptools
setuptools
plone.app.contentmenu

View File

@ -0,0 +1,55 @@
<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="plone">
<body>
<metal:content-core fill-slot="content-core">
<metal:block use-macro="context/folder_listing/macros/content-core">
<!-- we don't want the dl -->
<metal:entries fill-slot="entries">
<metal:block use-macro="context/folder_listing/macros/entries">
<metal:entry fill-slot="entry">
<div class="photoAlbumEntry photoAlbumFolder"
tal:define="item_object item/getObject;">
<a href="#"
tal:condition="exists:item_object/image_thumb"
tal:attributes="href python:test(item_type in use_view_action, item_url+'/view', item_url)">
<img src="" alt=""
tal:replace="structure python: path('nocall:item_object/tag')(scale='thumb', css_class='tileImage')" />
</a>
<h2 class="tileHeadline"
metal:define-macro="listitem">
<a href="#"
class="summary url"
tal:attributes="href item_url"
tal:content="item_title_or_id">
Item Title
</a>
</h2>
<p class="tileBody" tal:condition="item_description">
<span class="description" tal:content="item_description">
description
</span>
</p>
<div class="visualClear"><!-- --></div>
</div>
</metal:entry>
</metal:block>
</metal:entries>
</metal:block>
</metal:content-core>
</body>
</html>

View File

@ -2,10 +2,34 @@
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="themis.looks">
<five:registerPackage package="." initialize=".initialize" />
<!-- -*- extra stuff goes here -*- -->
<include package="plone.app.contentmenu" />
<browser:page
for=".interfaces.IBigBlocksFolderView"
name="folder_listing"
class=".views.BigBlocksFolderView"
permission="zope2.View"
/>
<browser:page
for=".interfaces.IBigBlocksFolderView"
name="bigblocks_folder"
class=".views.BigBlocksFolderView"
permission="zope2.View"
/>
<browser:menuItem
for=".interfaces.IBigBlocksFolderView"
menu="plone_displayviews"
title="Big blocks view"
action="@@folder_listing"
description="Big blocks view"
/>
</configure>

View File

@ -0,0 +1,8 @@
from zope.interface import Interface
from plone.theme.interfaces import IDefaultPloneLayer
class IThemeSpecific(IDefaultPloneLayer):
"""Marker interface that defines a Zope browser layer."""
class IBigBlocksFolderView(Interface):
"""Marker interface identifying Big Blocks Folder View."""

8
themis/looks/views.py Normal file
View File

@ -0,0 +1,8 @@
from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
class BigBlocksFolderView(BrowserView):
template = ViewPageTemplateFile('bigblocks_folder_view.pt')
def __call__(self):
return self.template()