[Bps-public-commit] r17299 - Prophet/trunk/lib/Prophet/Web

jesse at bestpractical.com jesse at bestpractical.com
Mon Dec 22 19:22:16 EST 2008


Author: jesse
Date: Mon Dec 22 19:22:15 2008
New Revision: 17299

Modified:
   Prophet/trunk/lib/Prophet/Web/Field.pm

Log:
Added textarea support for webui

Modified: Prophet/trunk/lib/Prophet/Web/Field.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Web/Field.pm	(original)
+++ Prophet/trunk/lib/Prophet/Web/Field.pm	Mon Dec 22 19:22:15 2008
@@ -9,7 +9,9 @@
 has id    => ( isa => 'Maybe[Str]', is => 'rw' );
 has class => ( isa => 'Maybe[Str]', is => 'rw' );
 has value => ( isa => 'Maybe[Str]', is => 'rw' );
-has type => ( isa => 'Str', is => 'rw', default => 'text');
+has type => ( isa => 'Maybe[Str]', is => 'rw', default => 'text');
+
+
 
 sub _render_attr {
     my $self = shift;
@@ -43,7 +45,7 @@
     my $self = shift;
 
     my $output = <<EOF;
-<label @{[$self->render_name]}>@{[$self->label]}</label>
+<label @{[$self->render_name]} @{[$self->render_class]}>@{[$self->label]}</label>
 @{[$self->render_input]}
 
 
@@ -52,11 +54,23 @@
     return $output;
 
 }
+
 sub render_input {
     my $self = shift;
+    
+    if ($self->type eq 'textarea') {
+
+return <<EOF;
+<textarea @{[$self->render_name]} @{[$self->render_id]} @{[$self->render_class]} >@{[$self->render_value]}</textarea>
+EOF
+    } else {
+
 return <<EOF;
 <input type="@{[$self->type]}" @{[$self->render_name]} @{[$self->render_id]} @{[$self->render_class]} @{[$self->render_value]} />
 EOF
+
+    }
+
 }
 
 



More information about the Bps-public-commit mailing list