1 package Reaction::UI::ViewPort::Object::Mutable;
5 use aliased 'Reaction::UI::ViewPort::Object';
6 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Text';
7 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Array';
8 use aliased 'Reaction::UI::ViewPort::Field::Mutable::String';
9 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Number';
10 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Integer';
11 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Boolean';
12 use aliased 'Reaction::UI::ViewPort::Field::Mutable::Password';
13 use aliased 'Reaction::UI::ViewPort::Field::Mutable::DateTime';
14 use aliased 'Reaction::UI::ViewPort::Field::Mutable::ChooseOne';
15 use aliased 'Reaction::UI::ViewPort::Field::Mutable::ChooseMany';
16 use aliased 'Reaction::UI::ViewPort::Field::Mutable::File';
18 use namespace::clean -except => [ qw(meta) ];
21 #this her for now. mutable fields need an action to build correctly
24 isa => 'Reaction::InterfaceModel::Action',
28 sub _build_fields_for_type_Num {
29 my ($self, $attr, $args) = @_;
30 $self->_build_simple_field(attribute => $attr, class => Number, %$args);
33 sub _build_fields_for_type_Int {
34 my ($self, $attr, $args) = @_;
35 $self->_build_simple_field(attribute => $attr, class => Integer, %$args);
38 sub _build_fields_for_type_Bool {
39 my ($self, $attr, $args) = @_;
40 $self->_build_simple_field(attribute => $attr, class => Boolean, %$args);
43 sub _build_fields_for_type_Reaction_Types_Core_SimpleStr {
44 my ($self, $attr, $args) = @_;
45 $self->_build_simple_field(attribute => $attr, class => String, %$args);
48 sub _build_fields_for_type_Reaction_Types_File_File {
49 my ($self, $attr, $args) = @_;
50 $self->_build_simple_field(attribute => $attr, class => File, %$args);
53 sub _build_fields_for_type_Str {
54 my ($self, $attr, $args) = @_;
55 if ($attr->has_valid_values) { # There's probably a better way to do this
56 $self->_build_simple_field(attribute => $attr, class => ChooseOne, %$args);
58 $self->_build_simple_field(attribute => $attr, class => Text, %$args);
62 sub _build_fields_for_type_Reaction_Types_Core_Password {
63 my ($self, $attr, $args) = @_;
64 $self->_build_simple_field(attribute => $attr, class => Password, %$args);
67 sub _build_fields_for_type_Reaction_Types_DateTime_DateTime {
68 my ($self, $attr, $args) = @_;
69 $self->_build_simple_field(attribute => $attr, class => DateTime, %$args);
72 sub _build_fields_for_type_Enum {
73 my ($self, $attr, $args) = @_;
74 $self->_build_simple_field(attribute => $attr, class => ChooseOne, %$args);
77 #this needs to be fixed. somehow. beats the shit our of me. really.
78 #implements build_fields_for_type_Reaction_InterfaceModel_Object => as {
79 sub _build_fields_for_type_DBIx_Class_Row {
80 my ($self, $attr, $args) = @_;
81 $self->_build_simple_field(attribute => $attr, class => ChooseOne, %$args);
84 sub _build_fields_for_type_ArrayRef {
85 my ($self, $attr, $args) = @_;
86 if ($attr->has_valid_values) {
87 $self->_build_simple_field(attribute => $attr, class => ChooseMany, %$args);
89 $self->_build_simple_field
93 layout => 'field/mutable/hidden_array',
98 __PACKAGE__->meta->make_immutable;
106 Reaction::UI::ViewPort::Object::Mutable
112 This subclass of L<Reaction::UI::ViewPort::Object> is used for rendering a
113 collection of C<Reaction::UI::ViewPort::Field::Mutable::*> objects for user editing.
119 L<Reaction::InterfaceModel::Action>
123 =head2 _build_fields_for_type_Num
125 =head2 _build_fields_for_type_Int
127 =head2 _build_fields_for_type_Bool
129 =head2 _build_fields_for_type_Reaction_Types_Core_SimpleStr
131 =head2 _build_fields_for_type_Reaction_Types_File_File
133 =head2 _build_fields_for_type_Str
135 =head2 _build_fields_for_type_Reaction_Types_Core_Password
137 =head2 _build_fields_for_type_Reaction_Types_DateTime_DateTime
139 =head2 _build_fields_for_type_Enum
141 =head2 _build_fields_for_type_DBIx_Class_Row
143 =head2 _build_fields_for_type_ArrayRef
147 L<Reaction::UI::ViewPort::Object>
149 L<Reaction::UI::ViewPort>
151 L<Reaction::InterfaceModel::Action>
155 See L<Reaction::Class> for authors.
159 See L<Reaction::Class> for the license.