-- cgit v1.2.3-54-g00ecf From d738d11fb21607bb66617ac95a455be8c9fa9e62 Mon Sep 17 00:00:00 2001 From: wreis Date: Mon, 27 Jul 2009 18:34:34 +0000 Subject: Object consumes Action and Collection consumes Pager and Action, so Member::WithActions go away --- lib/ComponentUI/UI/ViewPort/Baz/ListView/Member.pm | 4 +- lib/Reaction/Manual/ActionPrototypes.pod | 2 +- lib/Reaction/UI/ViewPort/Collection.pm | 6 +- lib/Reaction/UI/ViewPort/Collection/Grid.pm | 4 +- .../ViewPort/Collection/Grid/Member/WithActions.pm | 13 --- lib/Reaction/UI/ViewPort/ListView.pm | 3 - lib/Reaction/UI/ViewPort/Object.pm | 2 + lib/Reaction/UI/Widget/Collection/Grid/Member.pm | 2 +- .../Widget/Collection/Grid/Member/WithActions.pm | 105 --------------------- lib/Reaction/UI/Widget/Object.pm | 18 ++++ .../layout/collection/grid/member/with_actions.tt | 12 --- share/skin/base/layout/object.tt | 9 ++ .../layout/collection/grid/member/with_actions.tt | 12 --- share/skin/default/layout/object.tt | 4 + 14 files changed, 43 insertions(+), 153 deletions(-) delete mode 100644 lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm delete mode 100644 lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm delete mode 100644 share/skin/base/layout/collection/grid/member/with_actions.tt delete mode 100644 share/skin/default/layout/collection/grid/member/with_actions.tt diff --git a/lib/ComponentUI/UI/ViewPort/Baz/ListView/Member.pm b/lib/ComponentUI/UI/ViewPort/Baz/ListView/Member.pm index 26740ce..ca534aa 100644 --- a/lib/ComponentUI/UI/ViewPort/Baz/ListView/Member.pm +++ b/lib/ComponentUI/UI/ViewPort/Baz/ListView/Member.pm @@ -4,10 +4,10 @@ use Reaction::Class; use namespace::clean -except => [ qw(meta) ]; use aliased 'Reaction::UI::ViewPort::Field::String::Fragment'; -extends 'Reaction::UI::ViewPort::Collection::Grid::Member::WithActions'; +extends 'Reaction::UI::ViewPort::Collection::Grid::Member'; sub _build_layout { - 'collection/grid/member/with_actions'; + 'collection/grid/member'; } sub _build_fields_for_name_description { diff --git a/lib/Reaction/Manual/ActionPrototypes.pod b/lib/Reaction/Manual/ActionPrototypes.pod index abf3a2d..388dc4c 100644 --- a/lib/Reaction/Manual/ActionPrototypes.pod +++ b/lib/Reaction/Manual/ActionPrototypes.pod @@ -42,7 +42,7 @@ By default, enable C, C, C, C, actions. know how many actions to expect to lay out the UI properly. =item Default to member-class -L +L =back diff --git a/lib/Reaction/UI/ViewPort/Collection.pm b/lib/Reaction/UI/ViewPort/Collection.pm index a3cb0af..d64ab42 100644 --- a/lib/Reaction/UI/ViewPort/Collection.pm +++ b/lib/Reaction/UI/ViewPort/Collection.pm @@ -10,6 +10,9 @@ use MooseX::Types::Moose qw/Str HashRef/; use namespace::clean -except => [ qw(meta) ]; extends 'Reaction::UI::ViewPort'; +with 'Reaction::UI::ViewPort::Collection::Role::Pager'; +with 'Reaction::UI::ViewPort::Role::Actions'; + has members => (is => 'rw', isa => 'ArrayRef', lazy_build => 1); has collection => (is => 'ro', isa => IM_Collection, required => 1); @@ -120,8 +123,7 @@ constructor as items are instantiated. The class to use when instantiating items to represent the member items. See: L, -L, -L, +L. =head1 INTERNAL METHODS diff --git a/lib/Reaction/UI/ViewPort/Collection/Grid.pm b/lib/Reaction/UI/ViewPort/Collection/Grid.pm index 1cf3fd9..eb10d3d 100644 --- a/lib/Reaction/UI/ViewPort/Collection/Grid.pm +++ b/lib/Reaction/UI/ViewPort/Collection/Grid.pm @@ -3,7 +3,7 @@ package Reaction::UI::ViewPort::Collection::Grid; use Reaction::Class; use aliased 'Reaction::InterfaceModel::Collection' => 'IM_Collection'; -use aliased 'Reaction::UI::ViewPort::Collection::Grid::Member::WithActions'; +use aliased 'Reaction::UI::ViewPort::Collection::Grid::Member'; use namespace::clean -except => [ qw(meta) ]; use MooseX::Types::Moose qw/ArrayRef HashRef Int/; @@ -44,7 +44,7 @@ has member_action_count => ( ); #################################### -sub _build_member_class { WithActions }; +sub _build_member_class { Member }; sub _build_field_labels { my $self = shift; diff --git a/lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm b/lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm deleted file mode 100644 index ea3d832..0000000 --- a/lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm +++ /dev/null @@ -1,13 +0,0 @@ -package Reaction::UI::ViewPort::Collection::Grid::Member::WithActions; - -use Reaction::Class; - -use namespace::clean -except => [ qw(meta) ]; -extends 'Reaction::UI::ViewPort::Collection::Grid::Member'; - -with 'Reaction::UI::ViewPort::Role::Actions'; - -__PACKAGE__->meta->make_immutable; - - -1; diff --git a/lib/Reaction/UI/ViewPort/ListView.pm b/lib/Reaction/UI/ViewPort/ListView.pm index d1778bd..d2574bb 100644 --- a/lib/Reaction/UI/ViewPort/ListView.pm +++ b/lib/Reaction/UI/ViewPort/ListView.pm @@ -5,10 +5,7 @@ use namespace::clean -except => [ qw(meta) ]; extends 'Reaction::UI::ViewPort::Collection::Grid'; with 'Reaction::UI::ViewPort::Collection::Role::Order'; -with 'Reaction::UI::ViewPort::Collection::Role::Pager'; -with 'Reaction::UI::ViewPort::Role::Actions'; __PACKAGE__->meta->make_immutable; - 1; diff --git a/lib/Reaction/UI/ViewPort/Object.pm b/lib/Reaction/UI/ViewPort/Object.pm index 9a8738e..37dfdc5 100644 --- a/lib/Reaction/UI/ViewPort/Object.pm +++ b/lib/Reaction/UI/ViewPort/Object.pm @@ -21,6 +21,8 @@ use MooseX::Types::Moose qw/ArrayRef HashRef/; use namespace::clean -except => [ qw(meta) ]; extends 'Reaction::UI::ViewPort'; +with 'Reaction::UI::ViewPort::Role::Actions'; + #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); diff --git a/lib/Reaction/UI/Widget/Collection/Grid/Member.pm b/lib/Reaction/UI/Widget/Collection/Grid/Member.pm index 24168a6..3a47aa0 100644 --- a/lib/Reaction/UI/Widget/Collection/Grid/Member.pm +++ b/lib/Reaction/UI/Widget/Collection/Grid/Member.pm @@ -73,7 +73,7 @@ Renders the next C fragment surrounded by a C element. =item * L -=item * L +=item * L =back diff --git a/lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm b/lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm deleted file mode 100644 index f9ed586..0000000 --- a/lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm +++ /dev/null @@ -1,105 +0,0 @@ -package Reaction::UI::Widget::Collection::Grid::Member::WithActions; - -use Reaction::UI::WidgetClass; - -use namespace::clean -except => [ qw(meta) ]; -extends 'Reaction::UI::Widget::Collection::Grid::Member'; - -implements fragment actions { - render action => over $_{viewport}->actions; -}; - -implements fragment action { - render 'viewport'; -}; - -__PACKAGE__->meta->make_immutable; - -1; - -__END__; - -=head1 NAME - -Reaction::UI::Widget::Collection::Grid::Member::WithActions - Grid members with actions - -=head1 DESCRIPTION - -This is a subclass of L additionally -providing actions per member. - -=head1 FRAGMENTS - -=head2 actions - -Renders the C fragment with every item in the viewports C. - -=head2 action - -Renders the C fragment provided by L, thus -rendering the current viewport stored in the C<_> topic argument provided -by the C fragment. - -=head1 LAYOUT SETS - -=head2 base - - share/skin/base/layout/collection/grid/member/with_actions.tt - -This layout set extends the C layout set in the parent -skin. - -The following layouts are provided: - -=over 4 - -=item field_list - -First renders the original C fragment, then the C fragment. - -=item action - -Simply renders the next C fragment in line. - -=back - -=head2 default - - share/skin/default/layout/collection/grid/member/with_actions.tt - -This layout skin extends the C layout set in the parent -skin. - -The following layouts are provided: - -=over 4 - -=item field_list - -The same as in the C skin. - -=item action - -Renders the original C fragment surrounded by a C element. - -=back - -=head1 SEE ALSO - -=over 4 - -=item * L - -=item * L - -=back - -=head1 AUTHORS - -See L for authors. - -=head1 LICENSE - -See L for the license. - -=cut diff --git a/lib/Reaction/UI/Widget/Object.pm b/lib/Reaction/UI/Widget/Object.pm index de83e25..8674e44 100644 --- a/lib/Reaction/UI/Widget/Object.pm +++ b/lib/Reaction/UI/Widget/Object.pm @@ -21,6 +21,14 @@ implements fragment field { render 'viewport'; }; +implements fragment actions { + render action => over $_{viewport}->actions; +}; + +implements fragment action { + render 'viewport'; +}; + __PACKAGE__->meta->make_immutable; 1; @@ -44,6 +52,16 @@ method return values. Renders the C viewport passed by C. +=head2 actions + +Renders the C fragment with every item in the viewports C. + +=head2 action + +Renders the C fragment provided by L, thus +rendering the current viewport stored in the C<_> topic argument provided +by the C fragment. + =head1 DEPRECATED FRAGMENTS =head2 field_list diff --git a/share/skin/base/layout/collection/grid/member/with_actions.tt b/share/skin/base/layout/collection/grid/member/with_actions.tt deleted file mode 100644 index e7ba750..0000000 --- a/share/skin/base/layout/collection/grid/member/with_actions.tt +++ /dev/null @@ -1,12 +0,0 @@ -=extends collection/grid/member - -=for layout field_list - -[% call_next %] -[% actions %] - -=for layout action - -[% call_next %] - -=cut diff --git a/share/skin/base/layout/object.tt b/share/skin/base/layout/object.tt index 8a5074a..2a7f37e 100644 --- a/share/skin/base/layout/object.tt +++ b/share/skin/base/layout/object.tt @@ -6,5 +6,14 @@ [% call_next %] +=for layout field_list + +[% call_next %] +[% actions %] + +=for layout action + +[% call_next %] + =cut diff --git a/share/skin/default/layout/collection/grid/member/with_actions.tt b/share/skin/default/layout/collection/grid/member/with_actions.tt deleted file mode 100644 index a0bca88..0000000 --- a/share/skin/default/layout/collection/grid/member/with_actions.tt +++ /dev/null @@ -1,12 +0,0 @@ -=extends collection/grid/member - -=for layout field_list - -[% call_next %] -[% actions %] - -=for layout action - -[% call_next %] - -=cut diff --git a/share/skin/default/layout/object.tt b/share/skin/default/layout/object.tt index 0f32321..8413f23 100644 --- a/share/skin/default/layout/object.tt +++ b/share/skin/default/layout/object.tt @@ -4,4 +4,8 @@ [% call_next %]
+=for layout action + +[% call_next %] + =cut -- cgit v1.2.3-54-g00ecf From dfed49732b9c4594f104d4fc074c421fc8e7df4c Mon Sep 17 00:00:00 2001 From: wreis Date: Wed, 29 Jul 2009 11:45:36 +0000 Subject: fixes for templates --- share/skin/base/layout/collection/grid/member.tt | 5 +++++ share/skin/base/layout/object.tt | 5 ----- share/skin/default/layout/collection/grid/member.tt | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/share/skin/base/layout/collection/grid/member.tt b/share/skin/base/layout/collection/grid/member.tt index 377f97c..a73a2a7 100644 --- a/share/skin/base/layout/collection/grid/member.tt +++ b/share/skin/base/layout/collection/grid/member.tt @@ -2,6 +2,11 @@ [% field_list %] +=for layout field_list + +[% call_next %] +[% actions %] + =for layout field [% call_next %] diff --git a/share/skin/base/layout/object.tt b/share/skin/base/layout/object.tt index 2a7f37e..0ef9438 100644 --- a/share/skin/base/layout/object.tt +++ b/share/skin/base/layout/object.tt @@ -11,9 +11,4 @@ [% call_next %] [% actions %] -=for layout action - -[% call_next %] - =cut - diff --git a/share/skin/default/layout/collection/grid/member.tt b/share/skin/default/layout/collection/grid/member.tt index f0583d7..13e29c3 100644 --- a/share/skin/default/layout/collection/grid/member.tt +++ b/share/skin/default/layout/collection/grid/member.tt @@ -10,4 +10,8 @@ [% call_next %] +=for layout action + +[% call_next %] + =cut -- cgit v1.2.3-54-g00ecf From 372fcc324af7c081194fe09ae72d4607d6a370ac Mon Sep 17 00:00:00 2001 From: wreis Date: Fri, 31 Jul 2009 12:02:17 +0000 Subject: fixes for base collection widget+template --- lib/Reaction/UI/Widget/Collection.pm | 9 ++++++++- lib/Reaction/UI/Widget/ListView.pm | 8 -------- share/skin/base/layout/collection.tt | 10 ++++++++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/Reaction/UI/Widget/Collection.pm b/lib/Reaction/UI/Widget/Collection.pm index e991c4c..b24ba45 100644 --- a/lib/Reaction/UI/Widget/Collection.pm +++ b/lib/Reaction/UI/Widget/Collection.pm @@ -4,7 +4,6 @@ use Reaction::UI::WidgetClass; use namespace::clean -except => [ qw(meta) ]; - implements fragment members { render member => over $_{viewport}->members; }; @@ -13,6 +12,14 @@ implements fragment member { render 'viewport'; }; +implements fragment actions { + render action => over $_{viewport}->actions; +}; + +implements fragment action { + render 'viewport'; +}; + __PACKAGE__->meta->make_immutable; diff --git a/lib/Reaction/UI/Widget/ListView.pm b/lib/Reaction/UI/Widget/ListView.pm index 2fa13f8..300cd6e 100644 --- a/lib/Reaction/UI/Widget/ListView.pm +++ b/lib/Reaction/UI/Widget/ListView.pm @@ -16,14 +16,6 @@ implements fragment pager_fragment { } }; -implements fragment actions { - render action => over $_{viewport}->actions; -}; - -implements fragment action { - render 'viewport'; -}; - implements fragment maybe_sortable_header_cell { my $vp = $_{viewport}; if( $_{viewport}->can_order_by($_) ){ diff --git a/share/skin/base/layout/collection.tt b/share/skin/base/layout/collection.tt index 3923838..6becfb1 100644 --- a/share/skin/base/layout/collection.tt +++ b/share/skin/base/layout/collection.tt @@ -1,7 +1,17 @@ =for layout widget +[% header %] +[% body %] +[% footer %] + +=for layout body +
[% members %]
+=for layout footer + +[% actions %] + =cut -- cgit v1.2.3-54-g00ecf From 463e51d0379bb139a9d5de856756b21655e6a259 Mon Sep 17 00:00:00 2001 From: wreis Date: Fri, 31 Jul 2009 12:04:55 +0000 Subject: factoring out for field args from Collection::Grid --- lib/Reaction/UI/ViewPort/Collection/Grid.pm | 76 +--------------- lib/Reaction/UI/ViewPort/Role/FieldArgs.pm | 133 ++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+), 75 deletions(-) create mode 100644 lib/Reaction/UI/ViewPort/Role/FieldArgs.pm diff --git a/lib/Reaction/UI/ViewPort/Collection/Grid.pm b/lib/Reaction/UI/ViewPort/Collection/Grid.pm index eb10d3d..d24b96e 100644 --- a/lib/Reaction/UI/ViewPort/Collection/Grid.pm +++ b/lib/Reaction/UI/ViewPort/Collection/Grid.pm @@ -9,24 +9,7 @@ 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 _raw_field_labels => ( - is => 'rw', - isa => HashRef, - init_arg => 'field_labels', - default => sub { {} }, -); - -has field_labels => ( - is => 'ro', - isa => HashRef, - lazy_build => 1, - init_arg => undef, -); +with 'Reaction::UI::ViewPort::Role::FieldArgs'; has member_action_count => ( is => 'rw', @@ -43,65 +26,8 @@ has member_action_count => ( }, ); -#################################### sub _build_member_class { Member }; -sub _build_field_labels { - my $self = shift; - my %labels = %{$self->_raw_field_labels}; - for my $field ( @{$self->computed_field_order}) { - next if defined $labels{$field}; - $labels{$field} = join(' ', map{ ucfirst } split('_', $field)); - } - return \%labels; -} - -sub _build_field_order { []; } - -sub _build_excluded_fields { []; } - -sub _build_included_fields { [] } - -#this is a total clusterfuck and it sucks we should just eliminate it and have -# the grid members not render ArrayRef or Collection fields -sub _build_computed_field_order { - my ($self) = @_; - my %excluded = map { $_ => undef } @{ $self->excluded_fields }; - my %included = map { $_ => undef } @{ $self->included_fields }; - #treat _$field_name as private and exclude fields with no reader - my @names = grep { $_ !~ /^_/ && (!%included || exists( $included{$_}) ) - && !exists($excluded{$_})} map { $_->name } - grep { - !($_->has_type_constraint && - ($_->type_constraint->is_a_type_of('ArrayRef') || - eval {$_->type_constraint->name->isa('Reaction::InterfaceModel::Collection')} || - eval { $_->_isa_metadata->isa('Reaction::InterfaceModel::Collection') } - ) - ) } - grep { defined $_->get_read_method } - $self->current_collection->member_type->parameter_attributes; - - return $self->sort_by_spec($self->field_order, \@names); -} - -around _build_members => sub { - my $orig = shift; - my $self = shift; - $self->member_args->{computed_field_order} ||= $self->computed_field_order; - $self->member_args->{computed_action_order} ||= []; - my $members = $self->$orig(@_); - - # cache everything yo - for my $member (@$members){ - $member->clear_computed_action_order; - my $order = $member->computed_action_order; - @{ $self->member_args->{computed_action_order} } = @$order; - last; - } - - return $members; -}; - __PACKAGE__->meta->make_immutable; diff --git a/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm b/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm new file mode 100644 index 0000000..bff31c2 --- /dev/null +++ b/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm @@ -0,0 +1,133 @@ +package Reaction::UI::ViewPort::Role::FieldArgs; + +use Reaction::Role; +use namespace::clean -except => [ qw(meta) ]; + +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', + init_arg => 'field_labels', + default => sub { {} }, +); + +has field_labels => ( + is => 'ro', + isa => 'HashRef', + lazy_build => 1, + init_arg => undef, +); + +sub _build_field_labels { + my $self = shift; + my %labels = %{$self->_raw_field_labels}; + for my $field ( @{$self->computed_field_order}) { + next if defined $labels{$field}; + $labels{$field} = join(' ', map{ ucfirst } split('_', $field)); + } + return \%labels; +} + +sub _build_field_order { [] } + +sub _build_excluded_fields { [] } + +sub _build_included_fields { [] } + +#this is a total clusterfuck and it sucks we should just eliminate it and have +# the grid members not render ArrayRef or Collection fields +sub _build_computed_field_order { + my ($self) = @_; + my %excluded = map { $_ => undef } @{ $self->excluded_fields }; + my %included = map { $_ => undef } @{ $self->included_fields }; + #treat _$field_name as private and exclude fields with no reader + my @names = grep { $_ !~ /^_/ && (!%included || exists( $included{$_}) ) + && !exists($excluded{$_})} map { $_->name } + grep { + !($_->has_type_constraint && + ($_->type_constraint->is_a_type_of('ArrayRef') || + eval {$_->type_constraint->name->isa('Reaction::InterfaceModel::Collection')} || + eval { $_->_isa_metadata->isa('Reaction::InterfaceModel::Collection') } + ) + ) } + grep { defined $_->get_read_method } + $self->current_collection->member_type->parameter_attributes; + + return $self->sort_by_spec($self->field_order, \@names); +} + +around _build_members => sub { + my $orig = shift; + my $self = shift; + $self->member_args->{computed_field_order} ||= $self->computed_field_order; + $self->member_args->{computed_action_order} ||= []; + my $members = $self->$orig(@_); + + # cache everything yo + for my $member (@$members){ + $member->clear_computed_action_order; + my $order = $member->computed_action_order; + @{ $self->member_args->{computed_action_order} } = @$order; + last; + } + + return $members; +}; + +1; + +__END__; + +=head1 NAME + +Reaction::UI::ViewPort::Role::FieldOptions + +=head1 DESCRIPTION + +=head1 ATTRIBUTES + +=head2 field_order + +=head2 excluded_fields + +List of field names to exclude. + +=head2 included_fields + +List of field names to include. If both C and +C are specified the result is those fields which +are in C and not in C. + +=head2 included_fields + +List of field names to include. If both C and +C are specified the result is those fields which +are in C and not in C. + +=head2 field_labels + +=head2 computed_field_order + +=head1 INTERNAL METHODS + +These methods, although stable, are subject to change without notice. These are meant +to be used only by developers. End users should refrain from using these methods to +avoid potential breakages. + +=head1 SEE ALSO + +L + +=head1 AUTHORS + +See L for authors. + +=head1 LICENSE + +See L for the license. + +=cut -- cgit v1.2.3-54-g00ecf From fff7579c4333dc543b987f447b454772a8abe28f Mon Sep 17 00:00:00 2001 From: wreis Date: Fri, 31 Jul 2009 12:06:05 +0000 Subject: working example on ComponentUI --- lib/ComponentUI/Controller/TestModel/Bar.pm | 3 ++ share/skin/componentui/layout/bar/collection.tt | 51 +++++++++++++++++++++++++ share/skin/componentui/layout/bar/member.tt | 21 ++++++++++ 3 files changed, 75 insertions(+) create mode 100644 share/skin/componentui/layout/bar/collection.tt create mode 100644 share/skin/componentui/layout/bar/member.tt diff --git a/lib/ComponentUI/Controller/TestModel/Bar.pm b/lib/ComponentUI/Controller/TestModel/Bar.pm index 4859b7d..c649d78 100644 --- a/lib/ComponentUI/Controller/TestModel/Bar.pm +++ b/lib/ComponentUI/Controller/TestModel/Bar.pm @@ -12,6 +12,9 @@ __PACKAGE__->config( ViewPort => { enable_order_by => [qw/name foo published_at/], coerce_order_by => { foo => ['foo.last_name', 'foo.first_name'] }, + layout => 'bar/collection', + member_class => 'Reaction::UI::ViewPort::Object', + Member => { layout => 'bar/member' } } } }, diff --git a/share/skin/componentui/layout/bar/collection.tt b/share/skin/componentui/layout/bar/collection.tt new file mode 100644 index 0000000..9c8f5bd --- /dev/null +++ b/share/skin/componentui/layout/bar/collection.tt @@ -0,0 +1,51 @@ +=widget ListView + +=extends collection + +=for layout header + +[% pager_fragment %] + +=for layout footer + +[% pager_fragment %] + +[% actions %] + +=for layout actions + +
    + [% call_next %] +
+ +=for layout action + +
  • [% call_next %]
  • + +=for layout pager + +
      + [% first_page %] + [% previous_page %] + [% page_list %] + [% next_page %] + [% last_page %] +
    + +=for layout numbered_page_this_page + +
  • [% page_number %]
  • + +=for layout numbered_page + +
  • [% page_number %]
  • + +=for layout named_page + +
  • [% page_name %]
  • + +=for layout named_page_no_page + +
  • [% page_name %]
  • + +=cut diff --git a/share/skin/componentui/layout/bar/member.tt b/share/skin/componentui/layout/bar/member.tt new file mode 100644 index 0000000..6d18c95 --- /dev/null +++ b/share/skin/componentui/layout/bar/member.tt @@ -0,0 +1,21 @@ +=widget Collection::Grid::Member::WithActions + +=for layout widget + +
    +
    + [% actions %] +
    + [% field_list %] +

    + +=for layout field +[% call_next %]
    + +=for layout action + + + [% call_next %] + + +=cut -- cgit v1.2.3-54-g00ecf From c504eee41d69902130770b70602b522607324160 Mon Sep 17 00:00:00 2001 From: wreis Date: Fri, 31 Jul 2009 14:18:27 +0000 Subject: fixes for object and bar/member --- share/skin/base/layout/object.tt | 4 ---- share/skin/componentui/layout/bar/member.tt | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/share/skin/base/layout/object.tt b/share/skin/base/layout/object.tt index 0ef9438..39df771 100644 --- a/share/skin/base/layout/object.tt +++ b/share/skin/base/layout/object.tt @@ -4,10 +4,6 @@ =for layout container -[% call_next %] - -=for layout field_list - [% call_next %] [% actions %] diff --git a/share/skin/componentui/layout/bar/member.tt b/share/skin/componentui/layout/bar/member.tt index 6d18c95..63d01da 100644 --- a/share/skin/componentui/layout/bar/member.tt +++ b/share/skin/componentui/layout/bar/member.tt @@ -1,4 +1,4 @@ -=widget Collection::Grid::Member::WithActions +=widget Collection::Grid::Member =for layout widget -- cgit v1.2.3-54-g00ecf From 07a9ef7dbcbcd2b0202b4d529602e95039a62944 Mon Sep 17 00:00:00 2001 From: wreis Date: Sat, 1 Aug 2009 02:16:25 +0000 Subject: updated FieldArgs role after merge --- lib/Reaction/UI/ViewPort/Role/Actions.pm | 13 +++++-------- lib/Reaction/UI/ViewPort/Role/FieldArgs.pm | 9 --------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm index 32c7bbb..eb8ad76 100644 --- a/lib/Reaction/UI/ViewPort/Role/Actions.pm +++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm @@ -5,12 +5,6 @@ use Reaction::UI::ViewPort::URI; use namespace::clean -except => [ qw(meta) ]; -has actions => ( - is => 'ro', - isa => 'ArrayRef', - lazy_build => 1 -); - has action_order => ( is => 'ro', isa => 'ArrayRef' @@ -50,14 +44,17 @@ sub _build_computed_action_order { return $ordered; } -sub _build_actions { +sub actions { my ($self) = @_; my (@act, $i); my $ctx = $self->ctx; my $loc = $self->location; my $target = $self->model; + my $valid_actions = $self->has_action_filter ? + $self->action_filter->($self->computed_action_order, $self->model) + : $self->computed_action_order; - foreach my $proto_name ( @{ $self->computed_action_order } ) { + foreach my $proto_name ( @$valid_actions ) { my $proto = $self->action_prototypes->{$proto_name}; my $uri = $proto->{uri} or confess('uri is required in prototype action'); my $label = exists $proto->{label} ? $proto->{label} : $proto_name; diff --git a/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm b/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm index bff31c2..0a2aa51 100644 --- a/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm +++ b/lib/Reaction/UI/ViewPort/Role/FieldArgs.pm @@ -64,17 +64,8 @@ around _build_members => sub { my $orig = shift; my $self = shift; $self->member_args->{computed_field_order} ||= $self->computed_field_order; - $self->member_args->{computed_action_order} ||= []; my $members = $self->$orig(@_); - # cache everything yo - for my $member (@$members){ - $member->clear_computed_action_order; - my $order = $member->computed_action_order; - @{ $self->member_args->{computed_action_order} } = @$order; - last; - } - return $members; }; -- cgit v1.2.3-54-g00ecf From 2f4c7285eeda79854ef6fc2ebbd878e89d1d19e3 Mon Sep 17 00:00:00 2001 From: wreis Date: Sat, 1 Aug 2009 20:02:21 +0000 Subject: reverted Role::Actions, it shouldnt ever be done --- lib/Reaction/UI/ViewPort/Role/Actions.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/Reaction/UI/ViewPort/Role/Actions.pm b/lib/Reaction/UI/ViewPort/Role/Actions.pm index eb8ad76..32c7bbb 100644 --- a/lib/Reaction/UI/ViewPort/Role/Actions.pm +++ b/lib/Reaction/UI/ViewPort/Role/Actions.pm @@ -5,6 +5,12 @@ use Reaction::UI::ViewPort::URI; use namespace::clean -except => [ qw(meta) ]; +has actions => ( + is => 'ro', + isa => 'ArrayRef', + lazy_build => 1 +); + has action_order => ( is => 'ro', isa => 'ArrayRef' @@ -44,17 +50,14 @@ sub _build_computed_action_order { return $ordered; } -sub actions { +sub _build_actions { my ($self) = @_; my (@act, $i); my $ctx = $self->ctx; my $loc = $self->location; my $target = $self->model; - my $valid_actions = $self->has_action_filter ? - $self->action_filter->($self->computed_action_order, $self->model) - : $self->computed_action_order; - foreach my $proto_name ( @$valid_actions ) { + foreach my $proto_name ( @{ $self->computed_action_order } ) { my $proto = $self->action_prototypes->{$proto_name}; my $uri = $proto->{uri} or confess('uri is required in prototype action'); my $label = exists $proto->{label} ? $proto->{label} : $proto_name; -- cgit v1.2.3-54-g00ecf From bab6c062a14c634c86144c4dc7031e795230d97b Mon Sep 17 00:00:00 2001 From: wreis Date: Fri, 7 Aug 2009 12:23:52 +0000 Subject: backcompact stuff --- lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm | 10 ++++++++++ lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm | 10 ++++++++++ share/skin/base/layout/collection/grid/member/with_actions.tt | 3 +++ .../skin/default/layout/collection/grid/member/with_actions.tt | 3 +++ 4 files changed, 26 insertions(+) create mode 100644 lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm create mode 100644 lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm create mode 100644 share/skin/base/layout/collection/grid/member/with_actions.tt create mode 100644 share/skin/default/layout/collection/grid/member/with_actions.tt diff --git a/lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm b/lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm new file mode 100644 index 0000000..2a19058 --- /dev/null +++ b/lib/Reaction/UI/ViewPort/Collection/Grid/Member/WithActions.pm @@ -0,0 +1,10 @@ +package Reaction::UI::ViewPort::Collection::Grid::Member::WithActions; + +use Reaction::Class; +use namespace::clean -except => [qw(meta)]; + +extends 'Reaction::UI::ViewPort::Collection::Grid::Member'; + +#TO BE REMOVED + +1; diff --git a/lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm b/lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm new file mode 100644 index 0000000..a83aead --- /dev/null +++ b/lib/Reaction/UI/Widget/Collection/Grid/Member/WithActions.pm @@ -0,0 +1,10 @@ +package Reaction::UI::Widget::Collection::Grid::Member::WithActions; + +use Reaction::UI::WidgetClass; +use namespace::clean -except => [qw(meta)]; + +extends 'Reaction::UI::Widget::Collection::Grid::Member'; + +#TO BE REMOVED + +1; diff --git a/share/skin/base/layout/collection/grid/member/with_actions.tt b/share/skin/base/layout/collection/grid/member/with_actions.tt new file mode 100644 index 0000000..8a7f3d4 --- /dev/null +++ b/share/skin/base/layout/collection/grid/member/with_actions.tt @@ -0,0 +1,3 @@ +=extends collection/grid/member + +=cut diff --git a/share/skin/default/layout/collection/grid/member/with_actions.tt b/share/skin/default/layout/collection/grid/member/with_actions.tt new file mode 100644 index 0000000..05ec19f --- /dev/null +++ b/share/skin/default/layout/collection/grid/member/with_actions.tt @@ -0,0 +1,3 @@ +=extends NEXT + +=cut -- cgit v1.2.3-54-g00ecf