use special property 'favTitle' for favorites portlet
This commit is contained in:
parent
f9ba9d2115
commit
30c13d57d7
4 changed files with 19 additions and 7 deletions
|
@ -170,6 +170,10 @@ class AdapterBase(object):
|
||||||
def uid(self):
|
def uid(self):
|
||||||
return util.getUidForObject(self.context)
|
return util.getUidForObject(self.context)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def favTitle(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
def getChildren(self, predicates=None):
|
def getChildren(self, predicates=None):
|
||||||
for c in self.context.getChildren(predicates):
|
for c in self.context.getChildren(predicates):
|
||||||
yield adapted(c, self.languageInfo)
|
yield adapted(c, self.languageInfo)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -185,6 +185,10 @@ class Concept(Contained, Persistent):
|
||||||
def getLongTitle(self):
|
def getLongTitle(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
|
@property
|
||||||
|
def favTitle(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
# concept relations
|
# concept relations
|
||||||
|
|
||||||
def getClients(self, relationships=None):
|
def getClients(self, relationships=None):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A view (to be used by listings, portlets, ...) for favorites.
|
A view (to be used by listings, portlets, ...) for favorites.
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
|
@ -28,6 +26,7 @@ from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from cybertools.browser.configurator import ViewConfigurator, MacroViewProperty
|
from cybertools.browser.configurator import ViewConfigurator, MacroViewProperty
|
||||||
from loops.browser.node import NodeView
|
from loops.browser.node import NodeView
|
||||||
|
from loops.common import adapted
|
||||||
from loops.organize.party import getPersonForUser
|
from loops.organize.party import getPersonForUser
|
||||||
from loops.organize.personal.interfaces import IFavorites
|
from loops.organize.personal.interfaces import IFavorites
|
||||||
from loops import util
|
from loops import util
|
||||||
|
@ -61,10 +60,11 @@ class FavoriteView(NodeView):
|
||||||
for uid in self.favorites.list(self.person):
|
for uid in self.favorites.list(self.person):
|
||||||
obj = util.getObjectForUid(uid)
|
obj = util.getObjectForUid(uid)
|
||||||
if obj is not None:
|
if obj is not None:
|
||||||
|
adobj = adapted(obj)
|
||||||
yield dict(url=self.getUrlForTarget(obj),
|
yield dict(url=self.getUrlForTarget(obj),
|
||||||
uid=uid,
|
uid=uid,
|
||||||
title=obj.title,
|
title=adobj.favTitle,
|
||||||
description=obj.description,
|
description=adobj.description,
|
||||||
object=obj)
|
object=obj)
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -173,6 +173,10 @@ class Resource(Image, Contained):
|
||||||
def getConceptManager(self):
|
def getConceptManager(self):
|
||||||
return self.getLoopsRoot().getConceptManager()
|
return self.getLoopsRoot().getConceptManager()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def favTitle(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
def getAllParents(self, collectGrants=False, ignoreTypes=False):
|
def getAllParents(self, collectGrants=False, ignoreTypes=False):
|
||||||
result = Jeep()
|
result = Jeep()
|
||||||
for rel in self.getConceptRelations():
|
for rel in self.getConceptRelations():
|
||||||
|
|
Loading…
Add table
Reference in a new issue