use more MooseX::Types and support actionattribute in Action vp to explicitly provide...
[catagits/Reaction.git] / lib / Reaction / UI / ViewPort / Field / Mutable / Boolean.pm
CommitLineData
ddccc6a2 1package Reaction::UI::ViewPort::Field::Mutable::Boolean;
2
3use Reaction::Class;
4
81393881 5use namespace::clean -except => [ qw(meta) ];
6extends 'Reaction::UI::ViewPort::Field::Boolean';
62ffa273 7
81393881 8with 'Reaction::UI::ViewPort::Field::Role::Mutable::Simple';
9sub adopt_value_string {
10 my ($self) = @_;
3d336c55 11 $self->value($self->value_string||0);
81393881 12};
13sub BUILD {
14 my($self) = @_;
15 $self->value(0) unless $self->_model_has_value;
16};
3fad510b 17
7ccc8c72 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
22sub value_is_required { 1 }
23
81393881 24__PACKAGE__->meta->make_immutable;
3fad510b 25
ddccc6a2 26
271;