Merge branch 'master' of ssh://git.cy55.de/home/git/loops into bbmaster
This commit is contained in:
commit
b536f8540d
3 changed files with 31 additions and 8 deletions
|
@ -201,7 +201,10 @@
|
|||
item.editable and 'dojo.dnd.Source' or ''">
|
||||
<tal:items repeat="related resources">
|
||||
<tal:item define="class python: repeat['related'].odd() and 'even' or 'odd';
|
||||
description related/description">
|
||||
description related/description;
|
||||
predicate related/predicateTitle;
|
||||
info python: ' | '.join(
|
||||
t for t in (description, predicate) if t)">
|
||||
<tr tal:attributes="class string:$class dojoDndItem dojoDndHandle;
|
||||
id related/uniqueId">
|
||||
<td tal:condition="item/showCheckboxes|nothing"
|
||||
|
@ -218,7 +221,7 @@
|
|||
<img tal:attributes="src icon/src" />
|
||||
</a>
|
||||
<a tal:attributes="href python: view.getUrlForTarget(related);
|
||||
title description">
|
||||
title info">
|
||||
<div tal:content="related/title">Resource Title</div>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
title cell/description">
|
||||
<div class="legend">
|
||||
<b tal:content="cell/title" /><br />
|
||||
<i tal:content="structure cell/renderedDescription" />
|
||||
<i tal:content="structure cell/textRepresentation" />
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -36,7 +36,7 @@
|
|||
<a tal:attributes="href cell/targetUrl">
|
||||
<b tal:content="cell/title" /></a><br />
|
||||
<tal:desc condition="cell/description">
|
||||
<span tal:content="structure cell/renderedDescription" /></tal:desc>
|
||||
<span tal:content="structure cell/textRepresentation" /></tal:desc>
|
||||
<br />
|
||||
</div>
|
||||
</tal:cell>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# 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
|
||||
|
@ -18,8 +18,6 @@
|
|||
|
||||
"""
|
||||
View classes for lobo (blueprint-based) layouts.
|
||||
|
||||
$Id$
|
||||
"""
|
||||
|
||||
from cgi import parse_qs
|
||||
|
@ -66,8 +64,20 @@ class ConceptView(BaseConceptView):
|
|||
|
||||
@Lazy
|
||||
def resources(self):
|
||||
return self.getResources()
|
||||
|
||||
@Lazy
|
||||
def representingResources(self):
|
||||
pred = self.representationPredicate
|
||||
if pred is None:
|
||||
return {}
|
||||
return self.getResources([pred])
|
||||
|
||||
def getResources(self, predicates=None):
|
||||
result = dict(texts=[], images=[], files=[])
|
||||
for r in self.context.getResources([self.defaultPredicate]):
|
||||
if predicates is None:
|
||||
predicates = [self.defaultPredicate]
|
||||
for r in self.context.getResources(predicates):
|
||||
if r.contentType.startswith('text/'):
|
||||
result['texts'].append(r)
|
||||
if r.contentType.startswith('image/'):
|
||||
|
@ -81,6 +91,10 @@ class ConceptView(BaseConceptView):
|
|||
for r in self.resources['images']:
|
||||
yield r
|
||||
|
||||
@Lazy
|
||||
def representationPredicate(self):
|
||||
return self.conceptManager.get('represents')
|
||||
|
||||
# properties from base class: title, description, renderedDescription
|
||||
|
||||
@Lazy
|
||||
|
@ -99,6 +113,12 @@ class ConceptView(BaseConceptView):
|
|||
return u''
|
||||
return self.renderDescription(self.textDescription)
|
||||
|
||||
@Lazy
|
||||
def textRepresentation(self):
|
||||
for r in self.representingResources.get('texts', []):
|
||||
return self.renderText(r.data, r.contentType)
|
||||
return self.renderedDescription
|
||||
|
||||
@Lazy
|
||||
def targetUrl(self):
|
||||
return self.nodeView.getUrlForTarget(self.context)
|
||||
|
|
Loading…
Add table
Reference in a new issue