suppress top and current level in breadcrumbs; sorting: folders first

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2767 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-07-21 11:10:52 +00:00
parent 051565a155
commit 29a8361c28
3 changed files with 11 additions and 5 deletions

View file

@ -77,10 +77,12 @@ class ItemView(BaseView):
@property
def breadCrumbs(self):
for p in reversed(list(self.context.parents)):
parents = list(self.context.parents)
for p in reversed(parents[:-1]):
view = ItemView(p, self.request, self.parentView)
yield dict(url=view.url, title=view.title)
yield dict(url=self.url, title=self.title)
#if parents:
# yield dict(url=self.url, title=self.title)
class BSCWView(BaseView):

View file

@ -191,7 +191,7 @@ class ReadContainer(BSCWProxyBase, ReadContainer):
def values(self):
return sorted((self.get(k) for k in self),
key=lambda x: x.title.lower())
key=lambda x: (x.itemType != 'Folder', x.title.lower()))
def __len__(self):

View file

@ -118,8 +118,12 @@ The BSCW Repository View
'http://127.0.0.1/++resource++folder.png'
>>> list(items[0].breadCrumbs)
[{'url': 'http://127.0.0.1/bscw?id=bs_4', 'title': 'public'},
{'url': 'http://127.0.0.1/bscw?id=bs_5', 'title': 'Introduction'}]
[]
The top and the current level are not shown, otherwise we would get:
[{'url': 'http://127.0.0.1/bscw?id=bs_4', 'title': 'public'},
{'url': 'http://127.0.0.1/bscw?id=bs_5', 'title': 'Introduction'}]
Fin de partie