[Checkins] SVN: plone.z3cform/trunk/ okay, I think I'm done tweaking slots now
David Glick
davidglick at onenw.org
Sun Mar 21 17:43:59 EDT 2010
Log message for revision 110103:
okay, I think I'm done tweaking slots now
Changed:
U plone.z3cform/trunk/README.txt
U plone.z3cform/trunk/plone/z3cform/templates/macros.pt
-=-
Modified: plone.z3cform/trunk/README.txt
===================================================================
--- plone.z3cform/trunk/README.txt 2010-03-21 16:33:21 UTC (rev 110102)
+++ plone.z3cform/trunk/README.txt 2010-03-21 21:43:59 UTC (rev 110103)
@@ -229,22 +229,25 @@
layout, error message display, and so on. It contains the following macros:
* ``form`` is a full page form, including the label (output as an ``<h3 />``),
- description, and all the elements of ``titlelessform``.
+ description, and all the elements of ``titlelessform``. It defines two
+ slots: ``title`` contains the label, and ``description`` contains the
+ description.
* ``titlelessform`` includes the form ``status`` at the top, the ``<form />``
element, and the contents of the ``fields`` and ``actions`` macros. It also
- defines three slots: ``formtop`` is just inside the opening ``<form>`` tag;
+ defines four slots: ``formtop`` is just inside the opening ``<form>`` tag;
``formbottom``` is just inside the closing ``</form>`` tag;
- ``beforeactions`` is just before the actions (form buttons) are output.
+ ``fields`` contains the ``fields`` macro; and ``actions`` contains the
+ ``actions`` macro.
* ``fields`` iterates over all widgets in the form and renders each, using the
- contents of the ``field`` macro.
+ contents of the ``field`` macro. It also defines one slot, ``field`` which
+ contains the ``field`` macro.
* ``field`` renders a single field. It expects the variable ``widget`` to be
defined in the TAL scope, referring to a z3c.form widget instance. It will
output an error message if there is a field validation error, a label,
a marker to say whether the field is required, the field description, and
- the widget itself (normally just an ``<input />`` element). It also defines
- two slots, ``fieldtop`` and ``fieldbottom``, which wrap the field.
-* ``actions`` renders all actions on the form. This normally results in a row
- of ``<input type="submit" ... />`` elements.
+ the widget itself (normally just an ``<input />`` element).
+* ``actions`` renders all actions (buttons) on the form. This normally results
+ in a row of ``<input type="submit" ... />`` elements.
Thus, to use the ``titlelessform`` macro, you could add something like the
following in a custom form template::
Modified: plone.z3cform/trunk/plone/z3cform/templates/macros.pt
===================================================================
--- plone.z3cform/trunk/plone/z3cform/templates/macros.pt 2010-03-21 16:33:21 UTC (rev 110102)
+++ plone.z3cform/trunk/plone/z3cform/templates/macros.pt 2010-03-21 21:43:59 UTC (rev 110103)
@@ -11,81 +11,87 @@
<div class="form" metal:define-macro="form">
- <h3 tal:condition="view/label | nothing">
- <span tal:replace="view/label">Form title</span>:</h3>
+ <metal:title-slot define-slot="title">
+ <h3 tal:condition="view/label | nothing">
+ <span tal:replace="view/label">Form title</span>:</h3>
+ </metal:title-slot>
- <div class="description"
- tal:condition="view/description | nothing"
- tal:content="structure view/description">Form description</div>
+ <metal:description-slot define-slot="description">
+ <div class="description"
+ tal:condition="view/description | nothing"
+ tal:content="structure view/description">Form description</div>
+ </metal:description-slot>
+
<metal:define define-macro="titlelessform">
<div class="portalMessage"
tal:condition="view/status" tal:content="view/status">
</div>
-
<form action="." method="post"
tal:attributes="action request/getURL; enctype view/enctype">
<metal:block define-slot="formtop" />
- <metal:define define-macro="fields">
+ <metal:fields-slot define-slot="fields">
+ <metal:define define-macro="fields">
- <tal:widgets repeat="widget view/widgets/values">
- <div class="row"
- tal:define="hidden python:widget.mode == 'hidden'"
- tal:omit-tag="hidden">
+ <tal:widgets repeat="widget view/widgets/values">
+ <div class="row"
+ tal:define="hidden python:widget.mode == 'hidden'"
+ tal:omit-tag="hidden">
- <metal:field-slot define-slot="field">
- <metal:field define-macro="field">
- <div class="field"
- tal:define="error widget/error"
- tal:attributes="class python:'field' + (error and ' error' or '')">
- <label for=""
- tal:attributes="for widget/id"
- tal:condition="not:hidden">
- <span i18n:translate=""
- tal:content="widget/label">label</span>
- </label>
+ <metal:field-slot define-slot="field">
+ <metal:field define-macro="field">
+ <div class="field"
+ tal:define="error widget/error"
+ tal:attributes="class python:'field' + (error and ' error' or '')">
+ <label for=""
+ tal:attributes="for widget/id"
+ tal:condition="not:hidden">
+ <span i18n:translate=""
+ tal:content="widget/label">label</span>
+ </label>
- <span class="fieldRequired" title="Required"
- tal:condition="python:widget.required and not hidden"
- i18n:translate="label_required"
- i18n:attributes="title title_required;">
- (Required)
- </span>
+ <span class="fieldRequired" title="Required"
+ tal:condition="python:widget.required and not hidden"
+ i18n:translate="label_required"
+ i18n:attributes="title title_required;">
+ (Required)
+ </span>
- <div class="formHelp"
- tal:define="description widget/field/description"
- i18n:translate=""
- tal:content="description"
- tal:condition="python:description and not hidden"
- >field description</div>
+ <div class="formHelp"
+ tal:define="description widget/field/description"
+ i18n:translate=""
+ tal:content="description"
+ tal:condition="python:description and not hidden"
+ >field description</div>
- <div tal:condition="error"
- tal:content="structure error/render">
- Error
- </div>
+ <div tal:condition="error"
+ tal:content="structure error/render">
+ Error
+ </div>
- <div class="widget">
- <input type="text" tal:replace="structure widget/render" />
+ <div class="widget">
+ <input type="text" tal:replace="structure widget/render" />
+ </div>
</div>
- </div>
- </metal:field>
- </metal:field-slot>
+ </metal:field>
+ </metal:field-slot>
- </div>
- </tal:widgets>
+ </div>
+ </tal:widgets>
- </metal:define>
+ </metal:define>
+ </metal:fields-slot>
- <metal:block define-slot="beforeactions" />
+ <metal:actions-slot define-slot="actions">
+ <metal:define define-macro="actions">
+ <div class="action" tal:repeat="action view/actions/values|nothing">
+ <input type="submit" tal:replace="structure action/render" />
+ </div>
+ </metal:define>
+ </metal:actions-slot>
- <metal:define define-macro="actions">
- <div class="action" tal:repeat="action view/actions/values|nothing">
- <input type="submit" tal:replace="structure action/render" />
- </div>
- </metal:define>
-
<metal:block define-slot="formbottom" />
</form>
More information about the checkins
mailing list