| 1 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # lib/JPList/Controls/Sort.pm - JPList Sort controls | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # Copyright (C) 2017 Exceleron Software, LLC | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | package JPList::Controls::Sort; | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | JPList::Controls::Sort - JPList Sort controls | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | Version 0.04 | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | with 'JPList::Controls::Sort' | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | The Sort module allows you get the values sort controls | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =head2 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | =item C<sortdropdown> | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | Params : sort_vals | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 'type' => 'sort-drop-down', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 'inStorage' => $VAR1->[0]{'inDeepLinking'}, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 'inAnimation' => $VAR1->[0]{'inDeepLinking'}, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 'name' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 'data' => { | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 'order' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 'type' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 'dateTimeFormat' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 'path' => 'default', | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 'ignore' => '' | ||||||||||||||||||||||||||||||||||||||||||
| 55 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 'initialIndex' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 'inDeepLinking' => $VAR1->[0]{'inDeepLinking'}, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 'action' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 'isAnimateToTop' => $VAR1->[0]{'isAnimateToTop'} | ||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | Returns: Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | Desc : Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | sub sortdropdown | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sortdropdown: called CC=6 SCAR=18.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 8 | my ($self, $sort_vals) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 8 | my $data = $sort_vals->{'data'}; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 8 | my $result; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 8 | my $order = "asc"; | |||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 8 | ▶ | if ($data && exists($data->{'path'}) && $data->{'path'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$data and exists $data->{"path"} and $data->{"path"}
$data and exists $data->{"path"}
MC/DC0%0/3
$data and exists $data->{"path"} and $data->{"path"}
$data
exists $data->{"path"}
$data->{"path"}
Truth table25%1/4
A and B and C
A= $dataB= exists $data->{"path"}C= $data->{"path"}
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 8 | $result->{'column'} = $data->{'path'}; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 8 | $result->{'column'} =~ s/\.//; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 8 | ▶ | if (exists($data->{'order'})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 8 | $order = lc($data->{'order'}); | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 8 | ▶ | $result->{'order'} = ($order eq "desc") ? "desc" : "asc"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 8 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | =item C<sortselect> | ||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||
| 95 | Params : sort_vals | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 'type' => 'sort-select', | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 'action' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 'inStorage' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ), | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 'data' => { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 'order' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 'type' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 'dateTimeFormat' => '{month}/{day}/{year}', | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 'path' => 'default', | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 'ignore' => '' | ||||||||||||||||||||||||||||||||||||||||||
| 107 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 'isAnimateToTop' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ), | ||||||||||||||||||||||||||||||||||||||||||
| 109 | 'inDeepLinking' => $VAR1->[0]{'inStorage'}, | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 'name' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 'inAnimation' => $VAR1->[0]{'inStorage'} | ||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | Returns: Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | Desc : Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | sub sortselect | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sortselect: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 1 | shift->sortdropdown(@_); | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | __END__ | ||||||||||||||||||||||||||||||||||||||||||