[Bps-public-commit] rt-extension-formtools branch, master, updated. b9fc7c0eabe42ee44df130623c8130f74983034a

Ruslan Zakirov ruz at bestpractical.com
Thu Mar 31 10:44:53 EDT 2011


The branch, master has been updated
       via  b9fc7c0eabe42ee44df130623c8130f74983034a (commit)
      from  9ea9ec7b73e3b7467ebf9282dac451d00f65d36e (commit)

Summary of changes:
 html/FormTools/Field |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit b9fc7c0eabe42ee44df130623c8130f74983034a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Thu Mar 31 18:44:32 2011 +0400

    boolean rendering

diff --git a/html/FormTools/Field b/html/FormTools/Field
index 8d132e4..a17a82d 100644
--- a/html/FormTools/Field
+++ b/html/FormTools/Field
@@ -174,6 +174,18 @@ unless ( $default ) {
 %        }
 
 % }
+% } elsif ($render_as =~  /^boolean/i)  {
+%       my $id = $NamePrefix . $cf->Id;
+%       my $value = 'Yes';
+        <input type="checkbox" name="<% $id %>-Values"  value="<% $value %>"
+%  if ($default) {
+%       if (ref $default) {
+            <% (grep { $_ eq $value} @$default) ? 'CHECKED' : '' %>
+%       } else {
+            <% ($default eq $value) ? 'CHECKED' : '' %>
+%       }
+% }
+        >
 % } elsif ($render_as =~  /^date/i)  {
 <& /Elements/SelectDate, Name => $NamePrefix.$cf->Id."-Values", current => 0, 
                          ($default ? (Default => $default) : ()) &>

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list