provide h0 layout part (without image); allow for image display in navigatin menu

This commit is contained in:
Helmut Merz 2011-10-13 09:59:23 +02:00
parent 39d75e67ce
commit 7c1f7af4a4
5 changed files with 44 additions and 15 deletions

View file

@ -350,7 +350,12 @@ class ConceptView(BaseView):
#IOptions(adapted(pr.predicate))('hide_parents_for', [])):
IOptions(pr.predicate)('hide_parents_for', [])):
return True
hideRoles = IOptions(adapted(pr.first.conceptType))('hide_for', None)
hideRoles = None
options = component.queryAdapter(adapted(pr.first), IOptions)
if options is not None:
hideRoles = options('hide_for', None)
if not hideRoles:
hideRoles = IOptions(adapted(pr.first.conceptType))('hide_for', None)
if hideRoles is not None:
principal = self.request.principal
if (IUnauthenticatedPrincipal.providedBy(principal) and
@ -398,10 +403,16 @@ class ConceptView(BaseView):
if fv.check(r.first):
yield ResourceRelationView(r, self.request, contextIsSecond=True)
@Lazy
def resourcesList(self):
from loops.browser.resource import ResourceRelationView
return [ResourceRelationView(r, self.request, contextIsSecond=True)
for r in self.context.getResourceRelations()]
@Lazy
def resourcesByType(self):
result = dict(texts=[], images=[], files=[])
for rv in self.resources():
for rv in self.resourcesList:
r = rv.context
if r.contentType.startswith('text/'):
result['texts'].append(r)

View file

@ -39,6 +39,14 @@
factory="loops.browser.lobo.standard.List2"
permission="zope.View" />
<zope:adapter
name="lobo_h0"
for="loops.interfaces.IConcept
loops.browser.skin.Lobo"
provides="zope.interface.Interface"
factory="loops.browser.lobo.standard.Header0"
permission="zope.View" />
<zope:adapter
name="lobo_h1"
for="loops.interfaces.IConcept

View file

@ -46,18 +46,20 @@
<metal:block define-macro="header">
<div tal:define="cell part/getView">
<metal:headline use-macro="item/macros/headline" />
<div tal:define="showImageLink python:True"
tal:attributes="class python:part.cssClass[0]">
<metal:image use-macro="item/macros/image" />
<span tal:condition="cell/img/showInfo|nothing">
<a tal:define="url string:${cell/img/url}/meta_info.html"
tal:attributes="href url;
onclick string:objectDialog('', '$url');;
return false">
<img tal:attributes="src
string:${controller/resourceBase}/cybertools.icons/info.png" />
</a></span>
</div>
<tal:image condition="part/showImage">
<div tal:define="showImageLink python:True"
tal:attributes="class python:part.cssClass[0]">
<metal:image use-macro="item/macros/image" />
<span tal:condition="cell/img/showInfo|nothing">
<a tal:define="url string:${cell/img/url}/meta_info.html"
tal:attributes="href url;
onclick string:objectDialog('', '$url');;
return false">
<img tal:attributes="src
string:${controller/resourceBase}/cybertools.icons/info.png" />
</a></span>
</div>
</tal:image>
<div tal:attributes="class python:part.cssClass[1]">
<span tal:content="structure cell/renderedTextDescription" />
</div>

View file

@ -157,6 +157,7 @@ class BasePart(Base):
imageCssClass = ''
height = 260
gridPattern = []
showImage = True
def getChildren(self):
subtypeNames = (self.params.get('subtypes') or [''])[0].split(',')
@ -206,6 +207,13 @@ class List2(BasePart):
gridPattern = [['span-4 clear', 'span-2 last']]
class Header0(BasePart):
macroName = 'header'
cssClass = ['span-6 last', 'clear']
showImage = False
class Header1(BasePart):
macroName = 'header'

View file

@ -443,7 +443,7 @@ img.notselected {
/* lobo layout-specific classes */
.legend {
margin-top: 3px;
margin-top: 1px;
}
/* comments */