use more MooseX::Types and support actionattribute in Action vp to explicitly provide...
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / Mutable / Boolean.pm
1 package Reaction::UI::ViewPort::Field::Mutable::Boolean;
2
3 use Reaction::Class;
4
5 use namespace::clean -except => [ qw(meta) ];
6 extends 'Reaction::UI::ViewPort::Field::Boolean';
7
8 with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple';
9 sub adopt_value_string {
10   my ($self) = @_;
11   $self->value($self->value_string||0);
12 };
13 sub BUILD {
14   my($self) = @_;
15   $self->value(0) unless $self->_model_has_value;
16 };
17
18 # yeah, bool fields have to always be required
19 # otherwise we ever cant get false
20 # for reference, take a peek in Field::Role::Mutable::Simple's
21 # is_modified logic
22 sub value_is_required { 1 }
23
24 __PACKAGE__->meta->make_immutable;
25
26
27 1;