belongs_to rels and fields that do not map directly to columns.
- Fix Package names in POD for various files. this was causing some
weirdness in CPAN.
+ - All Reaction::UI::ViewPort::* now uses MooseX::Types
+ - Add 'action' attribute to Action viewport
+ - Adapt widget and layout to changes
+ - Add example of explicitly stating action to ComponentUI
0.002000 - 29 Apr 2008
- Update CheckUniques role to use around instead of overrides
requires 'File::Spec' => '3.29';
requires 'Moose' => '0.74';
requires 'MooseX::Types' => '0.10';
+requires 'MooseX::Types::URI' => '0.02';
requires 'MooseX::Types::Common' => '0.001000';
requires 'MooseX::Types::DateTime' => '0.03';
requires 'Path::Class::Dir';
return $collection->where({}, { prefetch => 'foo' });
}
+sub create :Chained('base') {
+ my $self = shift;
+ my ($c) = @_;
+ my $action_vp = $self->next::method(@_);
+ my $self_uri = $c->uri_for($self->action_for('create'));
+ $action_vp->action($self_uri);
+ return $action_vp;
+}
+
1;
use Reaction::Class;
+use MooseX::Types::URI qw/Uri/;
use MooseX::Types::Moose qw/Int Str/;
-use Reaction::Types::Core qw/NonEmptySimpleStr/;
+use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
use namespace::clean -except => [ qw(meta) ];
default => sub { 'post' }
);
+has action => ( is => 'rw', isa => Uri );
+
has changed => (
is => 'rw',
isa => Int,
package Reaction::UI::ViewPort::Action::Link;
use Reaction::Class;
+extends 'Reaction::UI::ViewPort';
use namespace::clean -except => [ qw(meta) ];
-extends 'Reaction::UI::ViewPort';
+use MooseX::Types::URI qw/Uri/;
+use MooseX::Types::Moose qw/Object CodeRef/;
-has uri => ( is => 'rw', lazy_build => 1);
+has uri => ( is => 'rw', isa => Uri, lazy_build => 1);
has label => (is => 'rw', required => 1);
-has target => (isa => 'Object', is => 'rw', required => 1);
-has action => (isa => 'CodeRef', is => 'rw', required => 1);
+has target => (isa => Object, is => 'rw', required => 1);
+has action => (isa => CodeRef, is => 'rw', required => 1);
sub BUILD {
my $self = shift;
use MooseX::Types::Moose qw/Str/;
with 'Reaction::UI::ViewPort::Action::Role::Close';
-has ok_label => (is => 'rw', isa => 'Str', lazy_build => 1);
+has ok_label => (is => 'rw', isa => Str, lazy_build => 1);
sub _build_ok_label { 'ok' }
use aliased 'Reaction::InterfaceModel::Collection' => 'IM_Collection';
use aliased 'Reaction::UI::ViewPort::Object';
+use MooseX::Types::Moose qw/Str HashRef/;
+
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort';
has collection => (is => 'ro', isa => IM_Collection, required => 1);
has current_collection => (is => 'rw', isa => IM_Collection, lazy_build => 1);
-has member_args => ( is => 'rw', isa => 'HashRef', lazy_build => 1);
-has member_class => ( is => 'ro', isa => 'Str', lazy_build => 1);
+has member_args => ( is => 'rw', isa => HashRef, lazy_build => 1);
+has member_class => ( is => 'ro', isa => Str, lazy_build => 1);
sub BUILD {
my ($self, $args) = @_;
use aliased 'Reaction::UI::ViewPort::Collection::Grid::Member::WithActions';
use namespace::clean -except => [ qw(meta) ];
+use MooseX::Types::Moose qw/ArrayRef HashRef Int/;
extends 'Reaction::UI::ViewPort::Collection';
-has field_order => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
-has excluded_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
-has included_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
-has computed_field_order => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+has field_order => ( is => 'ro', isa => ArrayRef, lazy_build => 1);
+has excluded_fields => ( is => 'ro', isa => ArrayRef, lazy_build => 1);
+has included_fields => ( is => 'ro', isa => ArrayRef, lazy_build => 1);
+has computed_field_order => (is => 'ro', isa => ArrayRef, lazy_build => 1);
has _raw_field_labels => (
is => 'rw',
- isa => 'HashRef',
+ isa => HashRef,
init_arg => 'field_labels',
default => sub { {} },
);
has field_labels => (
is => 'ro',
- isa => 'HashRef',
+ isa => HashRef,
lazy_build => 1,
init_arg => undef,
);
has member_action_count => (
is => 'rw',
- isa => 'Int',
+ isa => Int,
required => 1,
lazy => 1,
default => sub {
use Reaction::Role;
use namespace::clean -except => [ qw(meta) ];
-
-has enable_order_by => (is => 'rw', isa => 'ArrayRef');
-has coerce_order_by => (isa => 'HashRef', is => 'rw');
+use MooseX::Types::Moose qw/Int HashRef Str ArrayRef/;
+has enable_order_by => (is => 'rw', isa => ArrayRef);
+has coerce_order_by => (is => 'rw', isa => HashRef);
has order_by => (
- isa => 'Str',
+ isa => Str,
is => 'rw',
trigger_adopt('order_by'),
clearer => 'clear_order_by'
);
has order_by_desc => (
- isa => 'Int',
+ isa => Int,
is => 'rw',
trigger_adopt('order_by'),
lazy_build => 1
# XX This needs to be consumed after Ordered
use namespace::clean -except => [ qw(meta) ];
-
+use MooseX::Types::Moose qw/Int/;
#has paged_collection => (isa => Collection, is => 'rw', lazy_build => 1);
has pager => (isa => 'Data::Page', is => 'rw', lazy_build => 1);
-has page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'), clearer => 'clear_page');
-has per_page => (isa => 'Int', is => 'rw', lazy_build => 1, trigger_adopt('page'));
-has per_page_max => (isa => 'Int', is => 'rw', lazy_build => 1);
+has page => (isa => Int, is => 'rw', lazy_build => 1, trigger_adopt('page'), clearer => 'clear_page');
+has per_page => (isa => Int, is => 'rw', lazy_build => 1, trigger_adopt('page'));
+has per_page_max => (isa => Int, is => 'rw', lazy_build => 1);
sub _build_page { 1 };
sub _build_per_page { 10 };
sub _build_per_page_max { 100 };
use aliased 'Reaction::InterfaceModel::Object';
use aliased 'Reaction::Meta::InterfaceModel::Object::ParameterAttribute';
+use MooseX::Types::Moose qw/Str/;
+
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort';
has value => (is => 'rw', lazy_build => 1);
-has name => (is => 'rw', isa => 'Str', lazy_build => 1);
-has label => (is => 'rw', isa => 'Str', lazy_build => 1);
-has value_string => (is => 'rw', isa => 'Str', lazy_build => 1);
+has name => (is => 'rw', isa => Str, lazy_build => 1);
+has label => (is => 'rw', isa => Str, lazy_build => 1);
+has value_string => (is => 'rw', isa => Str, lazy_build => 1);
has model => (is => 'ro', isa => Object, required => 1);
has attribute => (is => 'ro', isa => ParameterAttribute, required => 1);
use Reaction::Class;
use Scalar::Util 'blessed';
-use aliased 'Reaction::UI::ViewPort::Field';
+
+extends 'Reaction::UI::ViewPort::Field';
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+use MooseX::Types::Moose qw/Str ArrayRef/;;
-has '+value' => (isa => 'ArrayRef');
+has '+value' => (isa => ArrayRef);
-has value_names => (isa => 'ArrayRef', is => 'ro', lazy_build => 1);
+has value_names => (isa => ArrayRef, is => 'ro', lazy_build => 1);
has value_map_method => (
- isa => 'Str', is => 'ro', required => 1, default => sub { 'display_name' },
+ isa => Str, is => 'ro', required => 1, default => sub { 'display_name' },
);
+
sub _build_value_names {
my $self = shift;
my $meth = $self->value_map_method;
my @names = map { blessed($_) ? $_->$meth : $_ } @{ $self->value };
return [ sort @names ];
-};
-sub _empty_value { [] };
+}
+
+sub _empty_value { [] }
+
__PACKAGE__->meta->make_immutable;
package Reaction::UI::ViewPort::Field::Boolean;
use Reaction::Class;
-use aliased 'Reaction::UI::ViewPort::Field';
+extends 'Reaction::UI::ViewPort::Field';
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+use MooseX::Types::Moose qw/Bool/;
-
-has '+value' => (isa => 'Bool');
+has '+value' => (isa => Bool);
override _empty_string_value => sub { 0 };
-__PACKAGE__->meta->make_immutable;
+__PACKAGE__->meta->make_immutable;
1;
use Reaction::Class;
use Scalar::Util 'blessed';
-use aliased 'Reaction::UI::ViewPort::Field::Array';
use namespace::clean -except => [ qw(meta) ];
-extends Array;
-
-
+extends 'Reaction::UI::ViewPort::Field::Array';
has value => (
is => 'rw', lazy_build => 1,
isa => 'Reaction::InterfaceModel::Collection'
);
+
sub _build_value_names {
my $self = shift;
my $meth = $self->value_map_method;
my @names = map { blessed($_) ? $_->$meth : $_ } $self->value->members;
return [ sort @names ];
-};
+}
__PACKAGE__->meta->make_immutable;
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort';
-has label => (is => 'ro', isa => 'Str');
-has name => (is => 'ro', isa => 'Str', required => 1);
-has fields => (is => 'ro', isa => 'ArrayRef', required => 1);
+use MooseX::Types::Moose qw/Str ArrayRef/;
+
+has label => (is => 'ro', isa => Str);
+has name => (is => 'ro', isa => Str, required => 1);
+has fields => (is => 'ro', isa => ArrayRef, required => 1);
__PACKAGE__->meta->make_immutable;
use Scalar::Util 'blessed';
use Reaction::Class;
use Reaction::Types::DateTime ();
-use aliased 'Reaction::UI::ViewPort::Field';
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+extends 'Reaction::UI::ViewPort::Field';
+use MooseX::Types::Moose qw/Str/;
has '+value' => (isa => Reaction::Types::DateTime::DateTime());
has value_string_default_format => (
- isa => 'Str', is => 'rw', required => 1, default => sub { "%F %H:%M:%S" }
+ isa => Str, is => 'rw', required => 1, default => sub { "%F %H:%M:%S" }
);
around _value_string_from_value => sub {
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort::Field';
-
+use MooseX::Types::Moose qw/CodeRef/;
has '+value' => (isa => Reaction::Types::File::File());
has uri => ( is => 'rw', lazy_build => 1);
-has action => (isa => 'CodeRef', is => 'rw', required => 1);
+has action => (isa => CodeRef, is => 'rw', required => 1);
+
sub _build_uri {
my $self = shift;
my $c = $self->ctx;
my ($c_name, $a_name, @rest) = @{ $self->action->($self->model, $c) };
$c->uri_for($c->controller($c_name)->action_for($a_name),@rest);
-};
+}
+
sub _value_string_from_value {
shift->value->stringify;
-};
-
+}
+
__PACKAGE__->meta->make_immutable;
package Reaction::UI::ViewPort::Field::Integer;
use Reaction::Class;
-use aliased 'Reaction::UI::ViewPort::Field';
-
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+use MooseX::Types::Moose qw/Int/;
+extends 'Reaction::UI::ViewPort::Field';
-has '+value' => (isa => 'Int');
-__PACKAGE__->meta->make_immutable;
+has '+value' => (isa => Int);
+__PACKAGE__->meta->make_immutable;
1;
};
use namespace::clean -except => [ qw(meta) ];
+use MooseX::Types::Moose qw/ArrayRef/;
extends 'Reaction::UI::ViewPort::Field';
with 'Reaction::UI::ViewPort::Field::Role::Mutable';
with 'Reaction::UI::ViewPort::Field::Role::Choices';
#MUST BE HERE, BELOW THE 'does', OR THE TRIGGER WILL NOT HAPPEN!
-has '+value' => (isa => 'ArrayRef');
+has '+value' => (isa => ArrayRef);
around value => sub {
my $orig = shift;
package Reaction::UI::ViewPort::Field::Mutable::HiddenArray;
use Reaction::Class;
-
use namespace::clean -except => [ qw(meta) ];
+use MooseX::Types::Moose qw/ArrayRef/;
+
extends 'Reaction::UI::ViewPort::Field';
with 'Reaction::UI::ViewPort::Field::Role::Mutable';
-has '+value' => (isa => 'ArrayRef');
+has '+value' => (isa => ArrayRef);
around value => sub {
my $orig = shift;
use Reaction::Class;
use namespace::clean -except => [ qw(meta) ];
+use MooseX::Types::Moose qw/Str/;
extends 'Reaction::UI::ViewPort::Field::Mutable::Password';
-has check_value => (is => 'rw', isa => 'Str', );
-has check_label => (is => 'rw', isa => 'Str', lazy_build => 1);
+has check_value => (is => 'rw', isa => Str, );
+has check_label => (is => 'rw', isa => Str, lazy_build => 1);
sub _build_check_label {
my $orig_label = shift->label;
package Reaction::UI::ViewPort::Field::Number;
use Reaction::Class;
-use aliased 'Reaction::UI::ViewPort::Field';
-
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+use MooseX::Types::Moose qw/Num/;
+extends 'Reaction::UI::ViewPort::Field';
-has '+value' => (isa => 'Num');
-__PACKAGE__->meta->make_immutable;
+has '+value' => (isa => Num);
+__PACKAGE__->meta->make_immutable;
1;
package Reaction::UI::ViewPort::Field::Password;
use Reaction::Class;
-
-use Reaction::Types::Core qw(SimpleStr);
-
use namespace::clean -except => [ qw(meta) ];
-extends 'Reaction::UI::ViewPort::Field::String';
-
+use MooseX::Types::Common::String qw(SimpleStr);
+extends 'Reaction::UI::ViewPort::Field::String';
has '+value' => (isa => SimpleStr);
#has '+layout' => (default => 'password');
use Reaction::Class;
use Scalar::Util 'blessed';
+use MooseX::Types::Moose qw/Str/;
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort::Field';
-
-
has value_map_method => (
- isa => 'Str', is => 'ro', required => 1, default => sub { 'display_name' },
+ isa => Str, is => 'ro', required => 1, default => sub { 'display_name' },
);
around _value_string_from_value => sub {
use Scalar::Util 'blessed';
use namespace::clean -except => [ qw(meta) ];
+use MooseX::Types::Moose qw/ArrayRef Str/;
-
-has valid_values => (isa => 'ArrayRef', is => 'ro', lazy_build => 1);
-has value_choices => (isa => 'ArrayRef', is => 'ro', lazy_build => 1);
+has valid_values => (isa => ArrayRef, is => 'ro', lazy_build => 1);
+has value_choices => (isa => ArrayRef, is => 'ro', lazy_build => 1);
has value_map_method => (
- isa => 'Str', is => 'ro', required => 1, default => sub { 'display_name' },
+ isa => Str, is => 'ro', required => 1, default => sub { 'display_name' },
);
sub str_to_ident {
my ($self, $str) = @_;
use aliased 'Reaction::InterfaceModel::Action';
use aliased 'Reaction::Meta::InterfaceModel::Action::ParameterAttribute';
+use MooseX::Types::Moose qw/Int Str/;
use namespace::clean -except => [ qw(meta) ];
is => 'rw', lazy_build => 1, trigger_adopt('value'),
clearer => 'clear_value',
);
-has needs_sync => (is => 'rw', isa => 'Int', default => 0);
+has needs_sync => (is => 'rw', isa => Int, default => 0); #should be bool?
-has message => (is => 'rw', isa => 'Str', clearer => 'clear_message');
+has message => (is => 'rw', isa => Str, clearer => 'clear_message');
-has is_modified => (
+has is_modified => ( #sould be bool?
is => 'ro', writer => '_set_modified',
required => 1, default => 1, init_arg => undef
);
package Reaction::UI::ViewPort::Field::String;
use Reaction::Class;
-use aliased 'Reaction::UI::ViewPort::Field';
-
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+use MooseX::Types::Moose qw/Str/;
+extends 'Reaction::UI::ViewPort::Field';
-has '+value' => (isa => 'Str');
-__PACKAGE__->meta->make_immutable;
+has '+value' => (isa => Str);
+__PACKAGE__->meta->make_immutable;
1;
package Reaction::UI::ViewPort::Field::Text;
use Reaction::Class;
-use aliased 'Reaction::UI::ViewPort::Field';
-
use namespace::clean -except => [ qw(meta) ];
-extends Field;
+use MooseX::Types::Moose qw/Str/;
+extends 'Reaction::UI::ViewPort::Field';
-has '+value' => (isa => 'Str');
-__PACKAGE__->meta->make_immutable;
+has '+value' => (isa => Str);
+__PACKAGE__->meta->make_immutable;
1;
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort';
-has uri => ( is => 'rw', isa => 'URI', required => 1);
-has width => ( is => 'rw', isa => 'Int');
-has height => ( is => 'rw', isa => 'Int');
+use MooseX::Types::URI qw/Uri/;
+use MooseX::Types::Moose qw/Int/;
+
+has uri => ( is => 'rw', isa => Uri, required => 1);
+has width => ( is => 'rw', isa => Int);
+has height => ( is => 'rw', isa => Int);
__PACKAGE__->meta->make_immutable;
use aliased 'Reaction::InterfaceModel::Object' => 'IM_Object';
+use MooseX::Types::Moose qw/ArrayRef HashRef/;
+
use namespace::clean -except => [ qw(meta) ];
extends 'Reaction::UI::ViewPort';
#everything is read only right now. Later I can make somethings read-write
#but first I need to figure out what depends on what so we can have decent triggers
has model => (is => 'ro', isa => IM_Object, required => 1);
-has fields => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+has fields => (is => 'ro', isa => ArrayRef, lazy_build => 1);
has field_args => (is => 'rw');
-has field_order => (is => 'ro', isa => 'ArrayRef');
+has field_order => (is => 'ro', isa => ArrayRef);
-has builder_cache => (is => 'ro', isa => 'HashRef', lazy_build => 1);
-has excluded_fields => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
-has included_fields => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
-has computed_field_order => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
+has builder_cache => (is => 'ro', isa => HashRef, lazy_build => 1);
+has excluded_fields => (is => 'ro', isa => ArrayRef, lazy_build => 1);
+has included_fields => (is => 'ro', isa => ArrayRef, lazy_build => 1);
+has computed_field_order => (is => 'ro', isa => ArrayRef, lazy_build => 1);
-has containers => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
-has container_layouts => ( is => 'rw', isa => 'ArrayRef' );
+has containers => ( is => 'ro', isa => ArrayRef, lazy_build => 1);
+has container_layouts => ( is => 'rw', isa => ArrayRef );
sub BUILD {
my ($self, $args) = @_;
package Reaction::UI::ViewPort::SiteLayout;
use Reaction::Class;
-use aliased 'Reaction::UI::ViewPort';
+extends 'Reaction::UI::ViewPort';
use namespace::clean -except => [ qw(meta) ];
-extends ViewPort;
-
-
-
-has 'title' => (isa => 'Str', is => 'rw', lazy_fail => 1);
-
-has 'static_base_uri' => (isa => 'Str', is => 'rw', lazy_fail => 1);
+use MooseX::Types::Moose qw/Str HashRef/;
+has 'title' => (isa => Str, is => 'rw', lazy_fail => 1);
+has 'static_base_uri' => (isa => Str, is => 'rw', lazy_fail => 1);
has 'meta_info' => (
- is => 'rw', isa => 'HashRef',
- required => '1', default => sub { {} }
+ is => 'rw',
+ isa => HashRef,
+ required => 1,
+ default => sub { {} }
);
__PACKAGE__->meta->make_immutable;
-
1;
use Reaction::Class;
use namespace::clean -except => [ qw(meta) ];
+use MooseX::Types::URI qw/Uri/;
extends 'Reaction::UI::ViewPort';
-has uri => ( is => 'rw', isa => 'URI', required => 1);
+has uri => ( is => 'rw', isa => Uri, required => 1);
has display => ( is => 'rw' );
__PACKAGE__->meta->make_immutable;
extends 'Reaction::UI::Widget::Object::Mutable';
after fragment widget {
- arg 'method' => $_{viewport}->method;
+ my $vp = $_{viewport};
+ arg 'method' => $vp->method;
+ arg 'form_id' => $vp->location;
+ arg 'action' => $vp->has_action ? $vp->action : '';
};
implements fragment message {
=for layout widget
<div class="action_form">
- <form action="" method="[% method %]" enctype="multipart/form-data">
+ <form action="[% action %]" id="[% form_id %]" method="[% method %]" enctype="multipart/form-data">
[% header %]
[% container_list %]
[% buttons %]