| 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 | 1 | ▶ | 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 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | with 'JPList::Controls::Sort' | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | The Sort module allows you get the values sort controls | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | =head2 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | =item C<sortdropdown> | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | Params : sort_vals | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 'type' => 'sort-drop-down', | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 'inStorage' => $VAR1->[0]{'inDeepLinking'}, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 'inAnimation' => $VAR1->[0]{'inDeepLinking'}, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 'name' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 'data' => { | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 'order' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 'type' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 'dateTimeFormat' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 'path' => 'default', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 'ignore' => '' | ||||||||||||||||||||||||||||||||||||||||||
| 47 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 'initialIndex' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 'inDeepLinking' => $VAR1->[0]{'inDeepLinking'}, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 'action' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 'isAnimateToTop' => $VAR1->[0]{'isAnimateToTop'} | ||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | Returns: Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | Desc : Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | sub sortdropdown | ||||||||||||||||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | my ($self, $sort_vals) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sortdropdown: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $data = $sort_vals->{'data'}; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $result; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $order = "asc"; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if ($data && exists($data->{'path'}) && $data->{'path'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/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 table0%0/4
A and B and C
A= $dataB= exists $data->{"path"}C= $data->{"path"}
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $result->{'column'} = $data->{'path'}; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | $result->{'column'} =~ s/\.//; | |||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (exists($data->{'order'})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $order = lc($data->{'order'}); | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $result->{'order'} = ($order eq "desc") ? "desc" : "asc"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | # ========================================================================== # | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | =item C<sortselect> | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | Params : sort_vals | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 'type' => 'sort-select', | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 'action' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 'inStorage' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ), | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 'data' => { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 'order' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 'type' => '', | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 'dateTimeFormat' => '{month}/{day}/{year}', | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 'path' => 'default', | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 'ignore' => '' | ||||||||||||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 'isAnimateToTop' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ), | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 'inDeepLinking' => $VAR1->[0]{'inStorage'}, | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 'name' => 'sort', | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 'inAnimation' => $VAR1->[0]{'inStorage'} | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | Returns: Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | Desc : Returns the column and value for order | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | sub sortselect | ||||||||||||||||||||||||||||||||||||||||||
| 113 | { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | shift->sortdropdown(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sortselect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | Sheeju Alex, <sheeju@exceleron.com> | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | https://github.com/sheeju/JPList/issues | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | perldoc JPList | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | =item * RT: CPAN's request tracker (report bugs here) | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=JPList> | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | L<http://annocpan.org/dist/JPList> | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | =item * CPAN Ratings | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | L<http://cpanratings.perl.org/d/JPList> | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | =item * Search CPAN | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | L<http://search.cpan.org/dist/JPList/> | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | =head1 ACKNOWLEDGEMENTS | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | Development time supported by Exceleron L<www.exceleron.com|http://www.exceleron.com>. | ||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | Copyright (C) 2017 Exceleron Software, LLC | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||
| 169 | under the terms of the the Artistic License (2.0). You may obtain a | ||||||||||||||||||||||||||||||||||||||||||
| 170 | copy of the full license at: | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | Any use, modification, and distribution of the Standard or Modified | ||||||||||||||||||||||||||||||||||||||||||
| 175 | Versions is governed by this Artistic License. By using, modifying or | ||||||||||||||||||||||||||||||||||||||||||
| 176 | distributing the Package, you accept this license. Do not use, modify, | ||||||||||||||||||||||||||||||||||||||||||
| 177 | or distribute the Package, if you do not accept this license. | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | If your Modified Version has been derived from a Modified Version made | ||||||||||||||||||||||||||||||||||||||||||
| 180 | by someone other than you, you are nevertheless required to ensure that | ||||||||||||||||||||||||||||||||||||||||||
| 181 | your Modified Version complies with the requirements of this license. | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | This license does not grant you the right to use any trademark, service | ||||||||||||||||||||||||||||||||||||||||||
| 184 | mark, tradename, or logo of the Copyright Holder. | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | This license includes the non-exclusive, worldwide, free-of-charge | ||||||||||||||||||||||||||||||||||||||||||
| 187 | patent license to make, have made, use, offer to sell, sell, import and | ||||||||||||||||||||||||||||||||||||||||||
| 188 | otherwise transfer the Package with respect to any patent claims | ||||||||||||||||||||||||||||||||||||||||||
| 189 | licensable by the Copyright Holder that are necessarily infringed by the | ||||||||||||||||||||||||||||||||||||||||||
| 190 | Package. If you institute patent litigation (including a cross-claim or | ||||||||||||||||||||||||||||||||||||||||||
| 191 | counterclaim) against any party alleging that the Package constitutes | ||||||||||||||||||||||||||||||||||||||||||
| 192 | direct or contributory patent infringement, then this Artistic License | ||||||||||||||||||||||||||||||||||||||||||
| 193 | to you shall terminate on the date that such litigation is filed. | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||||||||||||||||||||||||||||||||||||||||||
| 196 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||||||||||||||||||||||||||||||||||||||||||
| 197 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||||||||||||||||||||||||||||||||||||||||||
| 198 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||||||||||||||||||||||||||||||||||||||||||
| 199 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||||||||||||||||||||||||||||||||||||||||||
| 200 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||||||||||||||||||||||||||||||||||||||||||
| 201 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||||||||||||||||||||||||||||||||||||||||||
| 202 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | # vim: ts=4 | ||||||||||||||||||||||||||||||||||||||||||
| 207 | # vim600: fdm=marker fdl=0 fdc=3 | ||||||||||||||||||||||||||||||||||||||||||