[Checkins] SVN: z3c.formui/trunk/ Oh man, a feature I wanted to add since a long time:

Stephen Richter cvs-admin at zope.org
Thu Mar 15 20:22:45 UTC 2012


Log message for revision 124626:
  Oh man, a feature I wanted to add since a long time:
  
  - Feature: Mark a widget row with the "required" class when the widget is
    required. Similarly, when the widget has an error attached, add the "error"
    class to the widget row. That allows you to change the styles of the label
    and the widget if it is reuqired.
  
  Also, get ready for release.
  
  

Changed:
  U   z3c.formui/trunk/CHANGES.txt
  U   z3c.formui/trunk/setup.py
  U   z3c.formui/trunk/src/z3c/formui/README.txt
  U   z3c.formui/trunk/src/z3c/formui/div-form.pt
  U   z3c.formui/trunk/src/z3c/formui/table-form.pt

-=-
Modified: z3c.formui/trunk/CHANGES.txt
===================================================================
--- z3c.formui/trunk/CHANGES.txt	2012-03-15 20:06:58 UTC (rev 124625)
+++ z3c.formui/trunk/CHANGES.txt	2012-03-15 20:22:41 UTC (rev 124626)
@@ -2,17 +2,20 @@
 CHANGES
 =======
 
-2.2.2 (unreleased)
+2.3.0 (2012-03-15)
 ------------------
 
-- Nothing changed yet.
+- Feature: Mark a widget row with the "required" class when the widget is
+  required. Similarly, when the widget has an error attached, add the "error"
+  class to the widget row. That allows you to change the styles of the label
+  and the widget if it is reuqired.
 
-
 2.2.1 (2012-01-09)
 ------------------
 
 - No longer using deprecated ``zope.testing.doctest`` but built-in
   ``doctest`` instead.
+
 - Fixed tests so they do not break for `z3c.form` 2.5.0.
 
 

Modified: z3c.formui/trunk/setup.py
===================================================================
--- z3c.formui/trunk/setup.py	2012-03-15 20:06:58 UTC (rev 124625)
+++ z3c.formui/trunk/setup.py	2012-03-15 20:22:41 UTC (rev 124626)
@@ -23,7 +23,7 @@
 
 setup (
     name='z3c.formui',
-    version='2.2.2dev',
+    version='2.3.0',
     author = "Stephan Richter, Roger Ineichen and the Zope Community",
     author_email = "zope-dev at zope.org",
     description = "A set of initial UI components for z3c.form.",

Modified: z3c.formui/trunk/src/z3c/formui/README.txt
===================================================================
--- z3c.formui/trunk/src/z3c/formui/README.txt	2012-03-15 20:06:58 UTC (rev 124625)
+++ z3c.formui/trunk/src/z3c/formui/README.txt	2012-03-15 20:22:41 UTC (rev 124626)
@@ -150,7 +150,7 @@
         <span class="required">*</span> &ndash; required
       </div>
       <div>
-        <div id="form-widgets-name-row" class="row">
+        <div id="form-widgets-name-row" class="row required">
           <div class="label">
             <label for="form-widgets-name">
               <span>Name</span>
@@ -199,7 +199,7 @@
             &ndash; required
           </div>
           <div>
-            <div id="form-widgets-name-row" class="row">
+            <div id="form-widgets-name-row" class="row required">
               <div class="label">
                 <label for="form-widgets-name">
                   <span>Name</span>
@@ -274,7 +274,7 @@
           </div>
           <div>
           <table class="form-fields">
-                <tr class="row">
+                <tr class="row required">
                   <td class="label">
                     <label for="form-widgets-name">
                       <span>Name</span>
@@ -366,7 +366,7 @@
             &ndash; required
           </div>
           <div>
-            <div id="form-widgets-name-row" class="row">
+            <div id="form-widgets-name-row" class="row required">
               <div class="label">
                 <label for="form-widgets-name">
                   <span>Name</span>
@@ -430,7 +430,7 @@
           </div>
           <div>
           <table class="form-fields">
-                <tr class="row">
+                <tr class="row required">
                   <td class="label">
                     <label for="form-widgets-name">
                       <span>Name</span>
@@ -757,7 +757,7 @@
       &ndash; required
     </div>
     <div>
-      <div id="form-widgets-name-row" class="row">
+      <div id="form-widgets-name-row" class="row required">
         <div class="label">
           <label for="form-widgets-name">
             <span>Name</span>
@@ -806,7 +806,7 @@
     </div>
     <div>
       <table class="form-fields">
-        <tr class="row">
+        <tr class="row required">
           <td class="label">
             <label for="form-widgets-name">
               <span>Name</span>

Modified: z3c.formui/trunk/src/z3c/formui/div-form.pt
===================================================================
--- z3c.formui/trunk/src/z3c/formui/div-form.pt	2012-03-15 20:06:58 UTC (rev 124625)
+++ z3c.formui/trunk/src/z3c/formui/div-form.pt	2012-03-15 20:22:41 UTC (rev 124626)
@@ -50,7 +50,11 @@
       <metal:block define-macro="widget-rows">
         <tal:block repeat="widget view/widgets/values">
           <div id="" class="row"
-               tal:attributes="id string:${widget/id}-row"
+               tal:attributes="
+                   id string:${widget/id}-row;
+                   class python: 'row' + \
+                                 (widget.required and ' required' or '') + \
+                                 (widget.error and ' error' or '')"
                tal:condition="python:widget.mode != 'hidden'">
             <metal:block define-macro="widget-row">
               <div class="label">

Modified: z3c.formui/trunk/src/z3c/formui/table-form.pt
===================================================================
--- z3c.formui/trunk/src/z3c/formui/table-form.pt	2012-03-15 20:06:58 UTC (rev 124625)
+++ z3c.formui/trunk/src/z3c/formui/table-form.pt	2012-03-15 20:22:41 UTC (rev 124626)
@@ -58,6 +58,10 @@
         <tbody metal:define-slot="formbody" tal:omit-tag="">
           <tal:block omit-tag="" repeat="widget view/widgets/values">
             <tr metal:define-macro="formrow" class="row"
+                tal:attributes="
+                   class python: 'row' +
+                                 (widget.required and ' required' or '') + \
+                                 (widget.error and ' error' or '')"
                 tal:condition="python:widget.mode != 'hidden'">
               <td class="label" metal:define-macro="labelcell">
                 <label tal:attributes="for widget/id">



More information about the checkins mailing list