Skip to content

Commit

Permalink
Listing view supports singleton object, for example, news item, atdoc…
Browse files Browse the repository at this point in the history
…ument.
  • Loading branch information
ivanteoh committed Dec 3, 2012
1 parent cde2750 commit b258f44
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
15 changes: 14 additions & 1 deletion src/collective/listingviews/browser/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,25 @@ def retrieve_context_item(self):
return []

def retrieve_listing_items(self):
raise Exception("Not implemented")
return []

@property
def number_of_items(self):
return 0

@property
def listing_style_class(self):
style_class = ""
if self.view_setting:
style_class = getattr(self.view_setting, 'css_class', '')
if style_class is None:
style_class = ""
return style_class

@property
def listing_view_batch_size(self):
return 0

@property
def is_container(self):
"""
Expand Down
9 changes: 0 additions & 9 deletions src/collective/listingviews/browser/views/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ def listing_fields(self):
fields = []
return fields

@property
def listing_style_class(self):
style_class = ""
if self.view_setting:
style_class = getattr(self.view_setting, 'css_class', '')
if style_class is None:
style_class = ""
return style_class

@property
def listing_view_batch_size(self):
batch_size = 0
Expand Down
6 changes: 5 additions & 1 deletion src/collective/listingviews/browser/views/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
class=".collection.BasicCollectionListingInformationRetriever"
permission="zope2.View"
zcml:condition="installed plone.app.collection"/>

<browser:page
for="*"
name="listing_view_adapter"
class=".base.BaseListingInformationRetriever"
permission="zope2.View" />

</configure>
10 changes: 10 additions & 0 deletions src/collective/listingviews/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ def number_of_items(self):
Total items of the current list
"""

def listing_style_class(self):
"""
Listing view css class
"""

def listing_view_batch_size(self):
"""
Batch size
"""

def set_listing_view(self, view_name):
"""
Set id of the view to one of the available views stored in the registry.
Expand Down

0 comments on commit b258f44

Please sign in to comment.