Commit a00c4dae authored by Jérome Perrin's avatar Jérome Perrin

ods_style: cleanup field_ods_macro/macros/cell_value

remove useless `field python: editable_fields.get(column_id, None)`
tal:defines, the macro always documented `field` as required and all
callers pass it.

document that `style_prefix` is required
parent 4a1d8177
......@@ -95,17 +95,17 @@
</table:table-row>
</tal:block>
<!-- Render a value for a field in a Listbox / MatrixBox. `value` must be defined,
<!--
Render a value for a field in a Listbox / MatrixBox.
`value` must be defined
`style_prefix` must be defined
`field` is optional and is only defined when we have an editable field for this column or cell.
-->
<tal:block metal:define-macro="cell_value">
<tal:block tal:define="is_list python:same_type(value, []) or same_type(value, ());
is_float python: isinstance(value, modules['six'].integer_types + (float,));">
is_float python: isinstance(value, modules['six'].integer_types + (float, ));">
<tal:block tal:condition="python: is_list">
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
tal:attributes="table:style-name python:is_float and 'figure' or 'text'">
<table:table-cell tal:attributes="table:style-name python:is_float and 'figure' or 'text'">
<tal:block tal:condition="python: field is None" tal:repeat="item value">
<text:p tal:content="item"/>
</tal:block>
......@@ -117,8 +117,7 @@
<tal:block tal:condition="python: value is not None and not is_list">
<tal:block tal:condition="is_float">
<tal:block tal:condition="python: isinstance(value, modules['six'].integer_types)">
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
tal:attributes="office:value value;
<table:table-cell tal:attributes="office:value value;
table:style-name string:${style_prefix}figure"
office:value-type="float"
table:style-name="figure">
......@@ -130,7 +129,6 @@
</table:table-cell>
</tal:block>
<tal:block tal:condition="python: isinstance(value, float)">
<tal:block tal:define="field python: editable_fields.get(column_id, None)">
<tal:block tal:condition="python: field is not None">
<tal:block tal:condition="python:field.meta_type in ['FloatField','IntegerField'] or (field.meta_type == 'ProxyField' and field.getRecursiveTemplateField().meta_type in ['FloatField','IntegerField'])">
<tal:block tal:define="precision python: (field.meta_type == 'FloatField' or (field.meta_type == 'ProxyField' and field.getRecursiveTemplateField().meta_type == 'FloatField')) and field.get_value('precision') or 0;
......@@ -166,10 +164,8 @@
</tal:block>
</tal:block>
</tal:block>
</tal:block>
<tal:block tal:condition="not: is_float">
<tal:block tal:condition="python: isinstance(value, DateTime)">
<tal:block tal:define="field python: editable_fields.get(column_id, None);">
<tal:block tal:condition="python: field is None">
<table:table-cell tal:attributes="office:date-value python: context.ERP5Site_formatDateForODF(value);
table:style-name string:${style_prefix}date;"
......@@ -206,10 +202,8 @@
</tal:block>
</tal:block>
</tal:block>
</tal:block>
<tal:block tal:condition="python:not isinstance(value, DateTime)">
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
tal:attributes="table:style-name string:${style_prefix}text"
<table:table-cell tal:attributes="table:style-name string:${style_prefix}text"
table:style-name="text">
<text:p tal:condition="python: field is None"
tal:content="python: value"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment