use "Home Folder" as label for the currently connected user home folder (#4441)

This commit is contained in:
Frédéric Péters 2014-03-12 19:47:33 +01:00
parent 668baf5392
commit a11dded5f2
3 changed files with 12 additions and 2 deletions

View File

@ -4,6 +4,7 @@ from five import grok
from zope import component
from zope import schema
from zope.interface import Interface
from zope.i18n import translate
from zc.relation.interfaces import ICatalog
from zope.app.intid.interfaces import IIntIds
@ -84,6 +85,15 @@ class Folder(Container):
""" """
implements(IFolder)
def context_title(self):
current_user = api.user.get_current()
current_user_id = current_user.getId()
members_folder = getattr(api.portal.get(), 'Members')
if members_folder.get(current_user_id) == self:
return translate(_(u'Home Folder'), context=self.REQUEST)
else:
return self.title
def parent_folders(self):
parents = []
for id, item in self.contentItems():

View File

@ -200,7 +200,7 @@ class TitleColumn(column.TitleColumn):
grok.adapts(Interface, Interface, LinksTable)
def getLinkContent(self, item):
t = item.getObject().folder.to_object.Title()
t = item.getObject().folder.to_object.context_title()
if isinstance(t, str):
t = unicode(t, 'utf-8')
return t

View File

@ -9,7 +9,7 @@
<dd class="portletItem"
tal:define="oddrow repeat/item/odd;"
tal:attributes="class python:oddrow and 'portletItem even' or 'portletItem odd'">
<a tal:attributes="href item/absolute_url" tal:content="item/Title">parent</a>
<a tal:attributes="href item/absolute_url" tal:content="item/context_title">parent</a>
</dd>
</tal:items>