work in progress: layouts for the Lobo skin
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3998 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
cffadbdf14
commit
068eef9753
3 changed files with 106 additions and 42 deletions
|
@ -12,11 +12,13 @@
|
||||||
<tal:cell repeat="cell part/getChildren">
|
<tal:cell repeat="cell part/getChildren">
|
||||||
<div tal:attributes="class cell/cssClass;
|
<div tal:attributes="class cell/cssClass;
|
||||||
style cell/style">
|
style cell/style">
|
||||||
<a tal:attributes="href cell/url;
|
<a tal:attributes="href cell/targetUrl;
|
||||||
title cell/object/description">
|
title cell/description">
|
||||||
<metal:image use-macro="item/macros/image" />
|
<metal:image use-macro="item/macros/image" />
|
||||||
<b tal:content="cell/text" /><br />
|
<div class="legend">
|
||||||
<i tal:content="cell/object/description" />
|
<b tal:content="cell/title" /><br />
|
||||||
|
<i tal:content="cell/description" />
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</tal:cell>
|
</tal:cell>
|
||||||
|
@ -24,22 +26,34 @@
|
||||||
|
|
||||||
|
|
||||||
<metal:block define-macro="list1">
|
<metal:block define-macro="list1">
|
||||||
<div>List1</div>
|
<tal:cell repeat="cell part/getChildren">
|
||||||
|
<div tal:attributes="class python:cell.cssClass[0]">
|
||||||
|
<a tal:attributes="href cell/targetUrl;
|
||||||
|
title cell/description">
|
||||||
|
<metal:image use-macro="item/macros/image" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div tal:attributes="class python:cell.cssClass[1]">
|
||||||
|
<b tal:content="cell/title" /><br />
|
||||||
|
<i tal:content="cell/description" />
|
||||||
|
</div>
|
||||||
|
</tal:cell>
|
||||||
</metal:block>
|
</metal:block>
|
||||||
|
|
||||||
|
|
||||||
<metal:block define-macro="header1">
|
<metal:block define-macro="header1">
|
||||||
|
<div tal:define="cell part/getView">
|
||||||
<metal:headline use-macro="item/macros/headline" />
|
<metal:headline use-macro="item/macros/headline" />
|
||||||
<div tal:define="cell part/setupConcept">
|
|
||||||
<metal:image use-macro="item/macros/image" />
|
<metal:image use-macro="item/macros/image" />
|
||||||
<br />
|
<metal:text use-macro="item/macros/text" />
|
||||||
|
<br style="clear: both" />
|
||||||
</div>
|
</div>
|
||||||
</metal:block>
|
</metal:block>
|
||||||
|
|
||||||
|
|
||||||
<metal:block define-macro="header2">
|
<metal:block define-macro="header2">
|
||||||
<metal:headline use-macro="item/macros/headline" />
|
<metal:headline use-macro="item/macros/headline" />
|
||||||
<div tal:define="cell part/setupConcept">
|
<div tal:define="cell part/getView">
|
||||||
<metal:image use-macro="item/macros/image" />
|
<metal:image use-macro="item/macros/image" />
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -50,15 +64,22 @@
|
||||||
|
|
||||||
<metal:image define-macro="image">
|
<metal:image define-macro="image">
|
||||||
<img tal:condition="cell/img"
|
<img tal:condition="cell/img"
|
||||||
tal:attributes="src cell/img/src" />
|
tal:attributes="src cell/img/src;
|
||||||
|
class cell/img/cssClass" />
|
||||||
</metal:image>
|
</metal:image>
|
||||||
|
|
||||||
|
|
||||||
|
<metal:block define-macro="text">
|
||||||
|
<span tal:content="structure cell/renderedText" />
|
||||||
|
</metal:block>
|
||||||
|
|
||||||
|
|
||||||
<metal:block define-macro="headline">
|
<metal:block define-macro="headline">
|
||||||
<h1 tal:attributes="ondblclick item/openEditWindow"
|
<h1 tal:attributes="ondblclick cell/openEditWindow">
|
||||||
tal:content="item/title" />
|
<a tal:attributes="href cell/targetUrl"
|
||||||
<div tal:condition="item/description">
|
tal:content="cell/title" /></h1>
|
||||||
<i tal:content="item/description" /><br /> </div>
|
<div tal:condition="cell/description">
|
||||||
|
<i tal:content="cell/description" /><br /> </div>
|
||||||
</metal:block>
|
</metal:block>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,15 @@ from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
from zope.cachedescriptors.property import Lazy
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
|
||||||
from cybertools.typology.interfaces import IType
|
from cybertools.typology.interfaces import IType
|
||||||
from loops.browser.concept import ConceptView
|
from loops.browser.concept import ConceptView as BaseConceptView
|
||||||
|
from loops.browser.concept import ConceptRelationView as BaseConceptRelationView
|
||||||
from loops.common import adapted
|
from loops.common import adapted
|
||||||
|
|
||||||
|
|
||||||
standard_template = ViewPageTemplateFile('standard.pt')
|
standard_template = ViewPageTemplateFile('standard.pt')
|
||||||
|
|
||||||
|
|
||||||
class Base(ConceptView):
|
class Base(BaseConceptView):
|
||||||
|
|
||||||
template = standard_template
|
template = standard_template
|
||||||
templateName = 'lobo.standard'
|
templateName = 'lobo.standard'
|
||||||
|
@ -50,6 +51,54 @@ class Base(ConceptView):
|
||||||
return self.macros[self.macroName]
|
return self.macros[self.macroName]
|
||||||
|
|
||||||
|
|
||||||
|
class ConceptView(BaseConceptView):
|
||||||
|
|
||||||
|
def __init__(self, context, request, parent=None, idx=0):
|
||||||
|
super(ConceptView, self).__init__(context, request)
|
||||||
|
self.parentView = parent
|
||||||
|
self.idx = idx
|
||||||
|
|
||||||
|
# properties from base class: title, description, renderedDescription
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def renderedText(self):
|
||||||
|
for r in self.context.getResources([self.defaultPredicate]):
|
||||||
|
if r.contentType.startswith('text/'):
|
||||||
|
return self.renderText(r.data, r.contentType)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def targetUrl(self):
|
||||||
|
return self.nodeView.getUrlForTarget(self.context)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def cssClass(self):
|
||||||
|
pattern = self.parentView.gridPattern
|
||||||
|
if pattern:
|
||||||
|
return pattern[self.idx % len(pattern)]
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def style(self):
|
||||||
|
return 'height: %ipx' % self.parentView.height
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def img(self):
|
||||||
|
for r in self.context.getResources([self.defaultPredicate]):
|
||||||
|
if r.contentType.startswith('image/'):
|
||||||
|
src = ('%s/mediaasset.html?v=%s' %
|
||||||
|
(self.nodeView.getUrlForTarget(r),
|
||||||
|
self.parentView.imageSize))
|
||||||
|
return dict(src=src, cssClass=self.parentView.imageCssClass)
|
||||||
|
|
||||||
|
|
||||||
|
class ConceptRelationView(BaseConceptRelationView, ConceptView):
|
||||||
|
|
||||||
|
def __init__(self, relation, request, contextIsSecond=False,
|
||||||
|
parent=None, idx=0):
|
||||||
|
BaseConceptRelationView.__init__(self, relation, request, contextIsSecond)
|
||||||
|
self.parentView = parent
|
||||||
|
self.idx = idx
|
||||||
|
|
||||||
|
|
||||||
class Layout(Base):
|
class Layout(Base):
|
||||||
|
|
||||||
macroName = 'layout'
|
macroName = 'layout'
|
||||||
|
@ -71,36 +120,20 @@ class Layout(Base):
|
||||||
class BasePart(Base):
|
class BasePart(Base):
|
||||||
|
|
||||||
imageSize = 'small'
|
imageSize = 'small'
|
||||||
|
imageCssClass = ''
|
||||||
height = 260
|
height = 260
|
||||||
gridPattern = []
|
gridPattern = []
|
||||||
|
|
||||||
def getChildren(self):
|
def getChildren(self):
|
||||||
result = []
|
result = []
|
||||||
for idx, c in enumerate(self.context.getChildren([self.defaultPredicate])):
|
for idx, r in enumerate(
|
||||||
result.append(self.setupConcept(idx, c))
|
self.context.getChildRelations([self.defaultPredicate])):
|
||||||
|
result.append(ConceptRelationView(r, self.request,
|
||||||
|
contextIsSecond=True, parent=self, idx=idx))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def setupConcept(self, idx=0, obj=None):
|
def getView(self):
|
||||||
if obj is None:
|
return ConceptView(self.context, self.request, parent=self)
|
||||||
obj = self.context
|
|
||||||
text = obj.title
|
|
||||||
url = self.nodeView.getUrlForTarget(obj)
|
|
||||||
style = 'height: %ipx' % self.height
|
|
||||||
return dict(text=text, url=url, cssClass=self.getCssClass(idx, obj),
|
|
||||||
style=style, img=self.getImageData(idx, obj),
|
|
||||||
object=adapted(obj))
|
|
||||||
|
|
||||||
def getCssClass(self, idx, obj):
|
|
||||||
pattern = self.gridPattern
|
|
||||||
if pattern:
|
|
||||||
return pattern[idx % len(pattern)]
|
|
||||||
|
|
||||||
def getImageData(self, idx, concept):
|
|
||||||
for r in concept.getResources([self.defaultPredicate]):
|
|
||||||
if r.contentType.startswith('image/'):
|
|
||||||
src = ('%s/mediaasset.html?v=%s' %
|
|
||||||
(self.nodeView.getUrlForTarget(r), self.imageSize))
|
|
||||||
return dict(src=src)
|
|
||||||
|
|
||||||
|
|
||||||
class Grid3(BasePart):
|
class Grid3(BasePart):
|
||||||
|
@ -114,11 +147,15 @@ class Grid3(BasePart):
|
||||||
class List1(BasePart):
|
class List1(BasePart):
|
||||||
|
|
||||||
macroName = 'list1'
|
macroName = 'list1'
|
||||||
|
imageSize = 'small'
|
||||||
|
gridPattern = [['span-2', 'span-4 last']]
|
||||||
|
|
||||||
|
|
||||||
class Header1(BasePart):
|
class Header1(BasePart):
|
||||||
|
|
||||||
macroName = 'header1'
|
macroName = 'header1'
|
||||||
|
imageSize = 'small'
|
||||||
|
imageCssClass = 'flow-left'
|
||||||
|
|
||||||
|
|
||||||
class Header2(BasePart):
|
class Header2(BasePart):
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
a[href]:hover {
|
a[href]:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #803000;
|
color: #6060c0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
|
@ -335,12 +335,12 @@ div.menu-1, div.menu-2 {
|
||||||
|
|
||||||
.flow-left {
|
.flow-left {
|
||||||
float: left;
|
float: left;
|
||||||
padding: 0.4em 0.8em 0.8em 0;
|
padding: 0 20px 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flow-right {
|
.flow-right {
|
||||||
float: right;
|
float: right;
|
||||||
padding: 0.4em 0.8em 0.8em 0;
|
padding: 0 0 5px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.image {
|
div.image {
|
||||||
|
@ -411,6 +411,12 @@ img.notselected {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* lobo layout-specific classes */
|
||||||
|
|
||||||
|
.legend {
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
/* comments */
|
/* comments */
|
||||||
|
|
||||||
div.comment {
|
div.comment {
|
||||||
|
|
Loading…
Add table
Reference in a new issue