Title: [waffle-scm] [612] trunk/waffle-resources/src/main/resources/ftl/waffle: Added macros checkbox/radio/text to waffle/form.ftl.

Diff

Modified: trunk/examples/freemarker-example/src/main/java/org/codehaus/waffle/example/freemarker/persister/SimplePersonPersister.java (611 => 612)

--- trunk/examples/freemarker-example/src/main/java/org/codehaus/waffle/example/freemarker/persister/SimplePersonPersister.java	2008-04-14 11:45:12 UTC (rev 611)
+++ trunk/examples/freemarker-example/src/main/java/org/codehaus/waffle/example/freemarker/persister/SimplePersonPersister.java	2008-04-14 16:45:10 UTC (rev 612)
@@ -45,7 +45,6 @@
                 ((PersistablePerson)person).setId(++COUNT);
             }
             map.put(person.getId(), person);
-            System.out.println("Saved "+person);
         }
     }
 

Modified: trunk/examples/freemarker-example/src/main/webapp/people/editperson.htm (611 => 612)

--- trunk/examples/freemarker-example/src/main/webapp/people/editperson.htm	2008-04-14 11:45:12 UTC (rev 611)
+++ trunk/examples/freemarker-example/src/main/webapp/people/editperson.htm	2008-04-14 16:45:10 UTC (rev 612)
@@ -15,22 +15,22 @@
 
     <div class="fieldRow">
         <label for=""
-        <input type="text" name="person.id" id="person.id" value="${person.id}" readonly="true" disabled="true"/>
+        <@w.text "person.id" "${person.id}" "readonly='true' disabled='true'"/>
         <br style="clear:both"/>
     </div>
     <div class="fieldRow">
         <label for="" Name:</label>
-        <input type="text" name="person.firstName" id="person.firstName" value="${person.firstName}"/>
+        <@w.text "person.firstName" "${person.firstName}"/>
         <br style="clear:both"/>
     </div>
     <div class="fieldRow">
         <label for="" Name:</label>
-        <input type="text" name="person.lastName" id="person.lastName" value="${person.lastName}"/>
+        <@w.text "person.lastName" "${person.lastName}"/>
         <br style="clear:both"/>
     </div>
     <div class="fieldRow">
         <label for=""
-        <input type="text" name="person.email" id="person.email" value="${person.email}"/>
+        <@w.text "person.email" "${person.email}"/>
         <br style="clear:both"/>
     </div>
     <div class="fieldRow">

Modified: trunk/examples/freemarker-example/src/main/webapp/people/person.htm (611 => 612)

--- trunk/examples/freemarker-example/src/main/webapp/people/person.htm	2008-04-14 11:45:12 UTC (rev 611)
+++ trunk/examples/freemarker-example/src/main/webapp/people/person.htm	2008-04-14 16:45:10 UTC (rev 612)
@@ -40,7 +40,7 @@
                 <td>${person.email}</td>
                 <td>${person.dateOfBirth?string("dd-MM-yyyy")}</td>
                 <td><@w.asCSV person.getSkills() /> </p></td>
-                <td><input type="checkbox" name="selectedIds" id="selectedIds" value="${person.id}"/></td>
+                <td><@w.checkbox "selectedIds" "${person.id}" /></td>
             </tr>
         </#list>
     </table>

Modified: trunk/waffle-resources/src/main/resources/ftl/waffle/form.ftl (611 => 612)

--- trunk/waffle-resources/src/main/resources/ftl/waffle/form.ftl	2008-04-14 11:45:12 UTC (rev 611)
+++ trunk/waffle-resources/src/main/resources/ftl/waffle/form.ftl	2008-04-14 16:45:10 UTC (rev 612)
@@ -29,6 +29,39 @@
 </#macro>
 
 <#--
+ * Show a checkbox input element with a given value
+ *
+ * @param field the name of the field to bind the element to 
+ * @param value the value 
+ * @param attributes any additional attributes for the element (defaults to "")
+-->
+<#macro checkbox field value attributes="">
+    <input type="checkbox" id="${field}" name="${field}" value="${value}" ${attributes}/>    
+</#macro>
+
+<#--
+ * Show a radio input element with a given value
+ *
+ * @param field the name of the field to bind the element to 
+ * @param value the value 
+ * @param attributes any additional attributes for the element (defaults to "")
+-->
+<#macro radio field value attributes="">
+    <input type="radio" id="${field}" name="${field}" value="${value}" ${attributes}/>    
+</#macro>
+
+<#--
+ * Show a text input element with a given value
+ *
+ * @param field the name of the field to bind the element to 
+ * @param value the value
+ * @param attributes any additional attributes for the element (defaults to "")
+-->
+<#macro text field value attributes="">
+    <input type="text" id="${field}" name="${field}" value="${value}" ${attributes}/>
+</#macro>
+
+<#--
  * Show a select input element allowing a value to be chosen from a list of options.
  *
  * @param field the name of the field to bind the element to 


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to