[Bps-public-commit] r17302 - Prophet/trunk/lib/Prophet/Server/ViewHelpers

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


Author: jesse
Date: Mon Dec 22 19:25:03 2008
New Revision: 17302

Modified:
   Prophet/trunk/lib/Prophet/Server/ViewHelpers/Widget.pm

Log:
 factor out autocompletion

Modified: Prophet/trunk/lib/Prophet/Server/ViewHelpers/Widget.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Server/ViewHelpers/Widget.pm	(original)
+++ Prophet/trunk/lib/Prophet/Server/ViewHelpers/Widget.pm	Mon Dec 22 19:25:03 2008
@@ -29,6 +29,10 @@
 
 has field => ( isa => 'Prophet::Web::Field', is => 'rw');
 
+has type => ( isa => 'Maybe[Str]', is => 'rw');
+
+has autocomplete => (isa => 'Bool', is => 'rw', default => 1);
+
 sub render {
     my $self = shift;
 
@@ -56,7 +60,8 @@
         record => $record,
         label  => $self->prop,
         class  => 'prop-'.$self->prop.' function-'.$self->function->name,
-        value  => $value
+        value  => $value,
+        type => $self->type
         
     ));
 
@@ -68,6 +73,15 @@
 
     outs_raw( $orig->render_input );
     outs_raw( $self->field->render );
+    if ($self->autocomplete) {
+        $self->_render_autocompleter();
+    }
+
+}
+
+sub _render_autocompleter {
+    my $self = shift;
+    my $record = $self->function->record();
         outs_raw('<script>$("#'.$self->field->id.'").autocomplete("/=/prophet/autocomplete",{ 
         selectFirst: true, autoFill: false, minChars: 0, delay: 0,
         extraParams: {



More information about the Bps-public-commit mailing list