« lib/Reaction/UI/Controller/Role/RedirectTo.pm
↑ Summary
lib/Reaction/InterfaceModel/Reflector/DBIC.pm »
| 1 | package Reaction::UI::ViewPort::SearchableListViewContainer; | ||||||||||||
| 2 | 4 | ▶ | use Reaction::Class; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | #use aliased 'Reaction::InterfaceModel::Search::Spec', 'SearchSpec'; | ||||||||||||
| 5 | 4 | ▶ | use aliased 'Reaction::InterfaceModel::Action::Search::UpdateSpec', 'UpdateSearchSpec'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 4 | ▶ | use aliased 'Reaction::UI::ViewPort::ListViewWithSearch'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 4 | ▶ | use aliased 'Reaction::UI::ViewPort::Action' => 'ActionVP'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | ▶ | use aliased 'Reaction::UI::ViewPort'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 4 | ▶ | use aliased 'Reaction::UI::ViewPort::Collection::Role::Pager', 'PagerRole'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 4 | ▶ | use Method::Signatures::Simple; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | 4 | ▶ | use namespace::clean -except => 'meta'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | 4 | extends 'Reaction::UI::ViewPort'; | |||||||||||
| 16 | |||||||||||||
| 17 | 4 | has 'listview' => ( | |||||||||||
| 18 | isa => ViewPort, | ||||||||||||
| 19 | is => 'ro', | ||||||||||||
| 20 | required => 1, | ||||||||||||
| 21 | ); | ||||||||||||
| 22 | |||||||||||||
| 23 | 4 | has 'search_form' => (isa => ViewPort, is => 'ro', required => 1); | |||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | override BUILDARGS => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=11 SCAR=48.8
| |||||||||||||
| 26 | 0 | my $args = super; | |||||||||||
| 27 | 0 | my $spec_event_id = $args->{location}.':search-spec'; | |||||||||||
| 28 | my $spec_class = $args->{spec_class} | ||||||||||||
| 29 | 0 | ▶ | or confess "Argument spec_class is required"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 30 | 0 | ▶ | my $listview_class = $args->{'listview_class'} || ListViewWithSearch; | ||||||||||
|
Condition0%0/2
$args->{'listview_class'} || 'Reaction::UI::ViewPort::ListViewWithSearch'
MC/DC0%0/1
$args->{'listview_class'} || 'Reaction::UI::ViewPort::ListViewWithSearch'
$args->{'listview_class'}
Truth table0%0/2
A
A= $args->{'listview_class'}
| |||||||||||||
| 31 | 0 | ▶ | my $search_form_class = $args->{'search_form_class'} || ActionVP; | ||||||||||
|
Condition0%0/2
$args->{'search_form_class'} || 'Reaction::UI::ViewPort::Action'
MC/DC0%0/1
$args->{'search_form_class'} || 'Reaction::UI::ViewPort::Action'
$args->{'search_form_class'}
Truth table0%0/2
A
A= $args->{'search_form_class'}
| |||||||||||||
| 32 | my $action_class = $args->{action_class} | ||||||||||||
| 33 | 0 | ▶ | or confess "Argument action_class is required"; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 34 | # TODO: how do we autodiscover spec classes? | ||||||||||||
| 35 | # $spec_class =~ s/^::/${\SearchSpec}::/; | ||||||||||||
| 36 | 0 | Class::MOP::load_class($spec_class); | |||||||||||
| 37 | 0 | my $spec = do { | |||||||||||
| 38 | 0 | ▶ | if (my $string = $args->{ctx}->req->query_params->{$spec_event_id}) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 39 | 0 | ▶ | $spec_class->from_string($string, $args->{spec}||{}); | ||||||||||
|
Condition0%0/2
$args->{'spec'} || {}
MC/DC0%0/1
$args->{'spec'} || {}
$args->{'spec'}
Truth table0%0/2
A
A= $args->{'spec'}
| |||||||||||||
| 40 | } else { | ||||||||||||
| 41 | 0 | ▶ | $spec_class->new($args->{spec}||{}); | ||||||||||
|
Condition0%0/2
$args->{'spec'} || {}
MC/DC0%0/1
$args->{'spec'} || {}
$args->{'spec'}
Truth table0%0/2
A
A= $args->{'spec'}
| |||||||||||||
| 42 | } | ||||||||||||
| 43 | }; | ||||||||||||
| 44 | 0 | my $listview_location = $args->{location}.'-listview'; | |||||||||||
| 45 | my $listview = $args->{listview} = $listview_class->new( | ||||||||||||
| 46 | %$args, | ||||||||||||
| 47 | 0 | ▶ | layout => $args->{'listview_layout'} || 'list_view', | ||||||||||
|
Condition0%0/2
$args->{'listview_layout'} || 'list_view'
MC/DC0%0/1
$args->{'listview_layout'} || 'list_view'
$args->{'listview_layout'}
Truth table0%0/2
A
A= $args->{'listview_layout'}
| |||||||||||||
| 48 | search_spec => $spec, | ||||||||||||
| 49 | location => $listview_location, | ||||||||||||
| 50 | ); | ||||||||||||
| 51 | $args->{search_form} = $search_form_class->new( | ||||||||||||
| 52 | model => $action_class->new( | ||||||||||||
| 53 | target_model => $spec, | ||||||||||||
| 54 | 0 | ▶ | %{$args->{search_model}||{}} | ||||||||||
|
Condition0%0/2
$args->{'search_model'} || {}
MC/DC0%0/1
$args->{'search_model'} || {}
$args->{'search_model'}
Truth table0%0/2
A
A= $args->{'search_model'}
| |||||||||||||
| 55 | ), | ||||||||||||
| 56 | location => $args->{location}.'-search_form', | ||||||||||||
| 57 | apply_label => 'search', | ||||||||||||
| 58 | ctx => $args->{ctx}, | ||||||||||||
| 59 | 0 | ▶ | on_apply_callback => sub { | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 60 | 0 | my ($vp, $spec) = @_; | |||||||||||
| 61 | 0 | my $req = $vp->ctx->req; | |||||||||||
| 62 | 0 | my $new_uri = $req->uri->clone; | |||||||||||
| 63 | 0 | my %query = %{$req->query_parameters}; | |||||||||||
| 64 | 0 | delete @query{grep /^\Q${listview_location}\E/, keys %query}; | |||||||||||
| 65 | 0 | $query{$spec_event_id} = $spec->to_string; | |||||||||||
| 66 | 0 | $new_uri->query_form(\%query); | |||||||||||
| 67 | 0 | $req->uri($new_uri); | |||||||||||
| 68 | 0 | $listview->clear_page; | |||||||||||
| 69 | 0 | $listview->clear_order_by; | |||||||||||
| 70 | }, | ||||||||||||
| 71 | 0 | ▶ | %{$args->{search}||{}} | ||||||||||
|
Condition0%0/2
$args->{'search'} || {}
MC/DC0%0/1
$args->{'search'} || {}
$args->{'search'}
Truth table0%0/2
A
A= $args->{'search'}
| |||||||||||||
| 72 | ); | ||||||||||||
| 73 | 0 | $args; | |||||||||||
| 74 | 4 | }; | |||||||||||
| 75 | |||||||||||||
| 76 | 0 | ▶ | override child_event_sinks => method () { | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 77 | 0 | ((map $self->$_, 'search_form', 'listview'), super); | |||||||||||
| 78 | 4 | }; | |||||||||||
| 79 | |||||||||||||
| 80 | 4 | 1; | |||||||||||
| 81 | |||||||||||||