additional view convenience methods
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2835 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
f2eb384dd8
commit
e7460d6799
3 changed files with 22 additions and 4 deletions
|
@ -176,6 +176,14 @@ class BaseView(GenericView, I18NView):
|
||||||
def loopsRoot(self):
|
def loopsRoot(self):
|
||||||
return self.context.getLoopsRoot()
|
return self.context.getLoopsRoot()
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def conceptManager(self):
|
||||||
|
return self.loopsRoot.getConceptManager()
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def typePredicate(self):
|
||||||
|
return self.conceptManager.getTypePredicate()
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def url(self):
|
def url(self):
|
||||||
return absoluteURL(self.context, self.request)
|
return absoluteURL(self.context, self.request)
|
||||||
|
|
|
@ -119,6 +119,13 @@ class BlogView(ConceptView):
|
||||||
if k != 'blogpost'])
|
if k != 'blogpost'])
|
||||||
return sorted(rels, key=lambda r: (r.order, r.title.lower()))
|
return sorted(rels, key=lambda r: (r.order, r.title.lower()))
|
||||||
|
|
||||||
|
def isPersonalBlog(self):
|
||||||
|
tPerson = self.loopsRoot.getConceptManager()['person']
|
||||||
|
for p in self.context.getParents():
|
||||||
|
if p.conceptType == tPerson:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class BlogPostView(ConceptView):
|
class BlogPostView(ConceptView):
|
||||||
|
|
||||||
|
@ -134,6 +141,11 @@ class BlogPostView(ConceptView):
|
||||||
data['privateComment'] = u''
|
data['privateComment'] = u''
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def description(self):
|
||||||
|
return self.renderText(self.context.description, 'text/restructured')
|
||||||
|
|
||||||
|
|
||||||
def getActions(self, category='object', page=None, target=None):
|
def getActions(self, category='object', page=None, target=None):
|
||||||
actions = []
|
actions = []
|
||||||
if category == 'portlet' and self.editable:
|
if category == 'portlet' and self.editable:
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
<div class="description"
|
<div class="description"
|
||||||
tal:define="description data/description"
|
tal:define="description data/description"
|
||||||
tal:condition="description">
|
tal:condition="description">
|
||||||
<span tal:content="structure python:
|
<span tal:content="structure description">Description</span></div>
|
||||||
item.renderText(description, 'text/restructured')">Description</span></div>
|
|
||||||
<div class="text"
|
<div class="text"
|
||||||
tal:condition="nothing"
|
tal:condition="nothing"
|
||||||
xtal:condition="python: repeat['related'].index() < 3">
|
xtal:condition="python: repeat['related'].index() < 3">
|
||||||
|
@ -55,8 +54,7 @@
|
||||||
<div class="description"
|
<div class="description"
|
||||||
tal:define="description description|item/description"
|
tal:define="description description|item/description"
|
||||||
tal:condition="description">
|
tal:condition="description">
|
||||||
<span tal:content="structure python:
|
<span tal:content="structure description">Description</span>
|
||||||
item.renderText(description, 'text/restructured')">Description</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="text"
|
<div class="text"
|
||||||
tal:content="structure item/render">Here comes the text...</div>
|
tal:content="structure item/render">Here comes the text...</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue