r23082@martha (orig r922): groditi | 2008-10-11 19:45:47 -0400
groditi [Fri, 31 Oct 2008 22:05:07 +0000 (22:05 +0000)]
 some more doc patches

lib/Reaction/UI/ViewPort.pm
lib/Reaction/UI/ViewPort/Field.pm
lib/Reaction/UI/ViewPort/Field/Mutable/ChooseOne.pm

index 34c2fee..c5b1a58 100644 (file)
@@ -19,7 +19,7 @@ has focus_stack => (
 has _tangent_stacks => (
   isa => 'HashRef', is => 'ro', default => sub { {} }
 );
-has ctx => (isa => 'Catalyst', is => 'ro'); #, required => 1);
+has ctx => (isa => 'Catalyst', is => 'ro', weak_ref => 1); #, required => 1);
 
 sub _build_layout {
   '';
index 1555f99..ff89075 100644 (file)
@@ -32,9 +32,13 @@ sub _model_has_value {
   my $predicate = $self->attribute->get_predicate_method;
 
   if (!$predicate || $self->model->$predicate
-      #|| ($self->attribute->is_lazy
+      # || ($self->attribute->is_lazy
       #    && !$self->attribute->is_lazy_fail)
     ) {
+    # edenc -- uncommented the lazy checks above
+    # model->$predicate returns false if the value isn't set
+    # but has a lazy builder
+
     # either model attribute has a value now or can build it
     return 1;
   }
index dba1a6d..92a4f2e 100644 (file)
@@ -11,6 +11,10 @@ with 'Reaction::UI::ViewPort::Field::Role::Choices';
 sub adopt_value_string {
   my ($self) = @_;
   my $value = $self->value_string;
+  if(!defined($value) or !length $value) {
+    $self->clear_value;
+    return;
+  }
   $value = $self->str_to_ident($value) if (!ref $value);
   my $attribute = $self->attribute;
   my $checked = $attribute->check_valid_value($self->model, $value);