[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:
parent
4a69a3beb2
commit
f31cbc4d12
9 changed files with 95 additions and 72 deletions
|
@ -92,8 +92,7 @@ img { border: 0; vertical-align: middle}
|
|||
.list { border: 1px solid grey; margin-bottom: 3px;}
|
||||
.list td, .list th { border: 1px solid grey;
|
||||
padding-left: 5px; padding-right: 5px; padding-top: 3px;}
|
||||
.list th { background-color: #d7dee4; font-style: italic; font-weight: normal;
|
||||
text-align: left }
|
||||
.list th { background-color: #d7dee4; font-style: italic; font-weight: normal }
|
||||
.grid th { font-style: italic; font-weight: normal;
|
||||
border-bottom: 2px solid grey; padding: 2px 2px }
|
||||
.grid td { padding-right: 5px }
|
||||
|
|
|
@ -61,19 +61,21 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
<table tal:define="fieldNames python: tool.getResultColumnsNames(className, refInfo);
|
||||
widgets python: objs[0].getAppyTypesFromNames(fieldNames);"
|
||||
class="list" width="100%">
|
||||
<table tal:define="columnLayouts python: tool.getResultColumnsLayouts(className, refInfo);
|
||||
columns python: objs[0].getColumnsSpecifiers(columnLayouts, dir)"
|
||||
class="list" width="100%">
|
||||
<tal:comment replace="nothing">Headers, with filters and sort arrows</tal:comment>
|
||||
<tr>
|
||||
<tal:header repeat="widget widgets">
|
||||
<th tal:define="sortable python: tool.isSortable(widget['name'], className, 'search');
|
||||
filterable widget/filterable|nothing;">
|
||||
<tal:header repeat="column columns">
|
||||
<th tal:define="widget column/field;
|
||||
sortable python: tool.isSortable(widget['name'], className, 'search');
|
||||
filterable widget/filterable|nothing"
|
||||
tal:attributes="width column/width; align column/align">
|
||||
<span tal:replace="structure python: tool.truncateText(_(widget['labelId']))"/>
|
||||
<metal:icons use-macro="context/ui/navigate/macros/sortAndFilter"/>
|
||||
<metal:details use-macro="context/ui/navigate/macros/showDetails"/>
|
||||
</th>
|
||||
</tal:header>
|
||||
</th>
|
||||
</tal:header>
|
||||
</tr>
|
||||
|
||||
<tal:comment replace="nothing">Results</tal:comment>
|
||||
|
@ -81,10 +83,12 @@
|
|||
<tr id="query_row" valign="top" tal:define="odd repeat/obj/odd"
|
||||
tal:attributes="class python:test(odd, 'even', 'odd')">
|
||||
|
||||
<tal:fields repeat="widget widgets">
|
||||
<tal:comment replace="nothing">Title</tal:comment>
|
||||
<td id="field_title"
|
||||
tal:condition="python: widget['name'] == 'title'">
|
||||
<tal:fields repeat="column columns">
|
||||
<td tal:define="widget column/field"
|
||||
tal:attributes="id python:'field_%s' % widget['name'];
|
||||
width column/width; align column/align">
|
||||
<tal:comment replace="nothing">Title</tal:comment>
|
||||
<tal:title condition="python: widget['name'] == 'title'">
|
||||
<tal:icons replace="structure obj/getIcons"/>
|
||||
<a tal:define="navInfo python:'search.%s.%s.%d.%d' % (className, searchName, repeat['obj'].number()+startNumber, totalNumber);"
|
||||
tal:content="obj/Title" tal:attributes="href python: obj.getUrl(nav=navInfo, page=obj.getDefaultViewPage())"></a>
|
||||
|
@ -103,19 +107,19 @@
|
|||
title python: _('object_delete');
|
||||
onClick python:'onDeleteObject(\'%s\')' % obj.UID()"/>
|
||||
</div>
|
||||
</td>
|
||||
</tal:title>
|
||||
|
||||
<tal:comment replace="nothing">Any other field</tal:comment>
|
||||
<td tal:condition="python: widget['name'] != 'title'"
|
||||
tal:attributes="id python:'field_%s' % widget['name']">
|
||||
<tal:comment replace="nothing">Any other field</tal:comment>
|
||||
<tal:other condition="python: widget['name'] != 'title'">
|
||||
<tal:field define="contextObj python:obj;
|
||||
layoutType python:'cell';
|
||||
innerRef python:True"
|
||||
condition="python: contextObj.showField(widget['name'], 'result')">
|
||||
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
|
||||
</tal:field>
|
||||
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
|
||||
</tal:field>
|
||||
</tal:other>
|
||||
</td>
|
||||
</tal:fields>
|
||||
</tal:fields>
|
||||
</tr>
|
||||
</tal:row>
|
||||
</table>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue