[gen] for Type.shownInfo and tool.resultColumns..., added the possibility to define the name, width and alignment of every column (=notion of 'column layout').

This commit is contained in:
Gaetan Delannay 2012-11-02 22:27:54 +01:00
parent 4a69a3beb2
commit f31cbc4d12
9 changed files with 95 additions and 72 deletions

View file

@ -174,21 +174,25 @@
<tal:comment replace="nothing">Show forward or backward reference(s)</tal:comment>
<table tal:attributes="class python:test(innerRef, '', 'list');
width python:test(innerRef, '100%', appyType['layouts']['view']['width']);">
<tal:widgets define="widgets python: objs[0].getAppyTypesFromNames(appyType['shownInfo'])">
<tal:infos define="columns python: objs[0].getColumnsSpecifiers(appyType['shownInfo'], dir)">
<tr tal:condition="appyType/showHeaders">
<th tal:repeat="widget widgets">
<th tal:repeat="column columns"
tal:attributes="width column/width; align column/align">
<tal:def define="widget column/field">
<span tal:content="python: _(widget['labelId'])"></span>
<metal:sortIcons use-macro="app/ui/widgets/ref/macros/sortIcons" />
<tal:sd define="className linkedPortalType">
<metal:details use-macro="context/ui/navigate/macros/showDetails"/>
</tal:sd>
</tal:def>
</th>
</tr>
<tal:row repeat="obj objs">
<tr valign="top" tal:define="odd repeat/obj/odd"
tal:attributes="class python:test(odd, 'even', 'odd')">
<td tal:repeat="widget widgets"
tal:attributes="width python: appyType['shownInfoWidths'][repeat['widget'].index]">
tal:attributes="class python:test(odd, 'even', 'odd')">
<td tal:repeat="column columns"
tal:attributes="width column/width; align column/align">
<tal:def define="widget column/field">
<tal:title condition="python: widget['name'] == 'title'">
<metal:showObjectTitle use-macro="app/ui/widgets/ref/macros/objectTitle"/>
<div name="subTitle" tal:content="structure obj/getSubTitle"
@ -204,10 +208,11 @@
<metal:field use-macro="app/ui/widgets/show/macros/field" />
</tal:field>
</tal:other>
</tal:def>
</td>
</tr>
</tal:row>
</tal:widgets>
</tal:infos>
</table>
</td></tr>
</table>

View file

@ -13,16 +13,19 @@
a.o. for master/slave relationships).
tagCss Some additional CSS class for the main tag
(ie, the CSS class for a slave).
Note: if layoutType is "cell", alignment and width are not taken into account:
we use the alignment of the column specification instead.
</tal:comment>
<metal:show define-macro="layout"
tal:define="contextMacro contextMacro| python: app.ui;
tagId tagId|python:'';
tagCss tagCss|python:'';
layoutCss layout/css_class;">
layoutCss layout/css_class;
isCell python: layoutType == 'cell'">
<table tal:attributes="cellpadding layout/cellpadding;
cellspacing layout/cellspacing;
width layout/width;
align python: tool.flipLanguageDirection(layout['align'], dir);
width python: not isCell and layout['width'] or '';
align python: not isCell and tool.flipLanguageDirection(layout['align'], dir) or '';
class python: tagCss and ('%s %s' % (tagCss, layoutCss)).strip() or layoutCss;
style layout/style;
id tagId;