aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm
diff options
context:
space:
mode:
authormatthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-03 09:55:15 +0000
committermatthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-03 09:55:15 +0000
commit6a531d965cddbd184768ec04f65339b359652eb1 (patch)
tree1d9e596adf733f4a9676671e970cdadda7632f49 /lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm
parente44959e862c790ea3eeb7c671314cfd248946416 (diff)
downloadreaction-6a531d965cddbd184768ec04f65339b359652eb1.tar.gz
reaction-6a531d965cddbd184768ec04f65339b359652eb1.zip
datetime now handles optional using a wrap on value_string
Diffstat (limited to 'lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm')
-rw-r--r--lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm b/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm
index cb48dce..4d58745 100644
--- a/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm
+++ b/lib/Reaction/UI/ViewPort/Field/Role/Mutable.pm
@@ -16,17 +16,6 @@ role Mutable, which {
has needs_sync => (is => 'rw', isa => 'Int', default => 0);
has message => (is => 'rw', isa => 'Str');
- around value => sub {
- my $orig = shift;
- my $self = shift;
- if (@_ && !ref($_[0]) && defined($_[0]) && !length($_[0])) { # ''
- unless ($self->value_is_required) {
- return $self->clear_value;
- }
- }
- $self->$orig(@_);
- };
-
after clear_value => sub {
shift->needs_sync(1);
};
@@ -38,7 +27,7 @@ role Mutable, which {
implements sync_to_action => as {
my ($self) = @_;
- return unless $self->needs_sync && $self->has_value;
+ return unless $self->needs_sync;
my $attr = $self->attribute;
if ($self->has_value) {
@@ -56,10 +45,10 @@ role Mutable, which {
confess "No writer for attribute" unless defined($writer);
$self->model->$writer($value);
} else {
- my $predicate = $attr->get_predicate;
+ my $predicate = $attr->predicate;
confess "No predicate for attribute" unless defined($predicate);
if ($self->model->$predicate) {
- my $clearer = $attr->get_clearer;
+ my $clearer = $attr->clearer;
confess "${predicate} returned true but no clearer for attribute"
unless defined($clearer);
$self->model->$clearer;