[Jifty-commit] r2219 - jifty/trunk/lib/Jifty/Action/Record
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Nov 29 10:05:10 EST 2006
Author: audreyt
Date: Wed Nov 29 10:05:10 2006
New Revision: 2219
Modified:
jifty/trunk/lib/Jifty/Action/Record/Search.pm
Log:
* Jifty::Action::Record::Search - Consider "float" and "double" fields
as numeric for comparison. Also consider "char" as textual.
Modified: jifty/trunk/lib/Jifty/Action/Record/Search.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Search.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record/Search.pm Wed Nov 29 10:05:10 2006
@@ -30,7 +30,7 @@
=over 4
-=item C<text> or C<varchar> fields
+=item C<text>, C<char> or C<varchar> fields
Create C<field>_contains and C<field>_lacks arguments
@@ -38,7 +38,7 @@
Create C<field>_before and C<field>_after arguments
-=item integer fields
+=item C<integer>, C<float> or C<double> fields
Generate C<field>_lt and C<field>_gt arguments
@@ -87,14 +87,15 @@
my $label = $info->{label} || $field;
$args->{"${field}_not"} = {%$info, label => "$label is not"};
- if($column->type =~ /^(?:text|varchar)/i) {
+ my $type = lc($column->type);
+ if($type =~ /(?:text|char)/) {
$info->{render_as} = 'text';
$args->{"${field}_contains"} = {%$info, label => "$label contains"};
$args->{"${field}_lacks"} = {%$info, label => "$label lacks"};
- } elsif($column->type =~ /(?:date|time)/) {
+ } elsif($type =~ /(?:date|time)/) {
$args->{"${field}_after"} = {%$info, label => "$label after"};
$args->{"${field}_before"} = {%$info, label => "$label before"};
- } elsif( $column->type =~ /(?:int)/
+ } elsif( $type =~ /(?:int|float|double)/
&& !$column->refers_to) {
$args->{"${field}_gt"} = {%$info, label => "$label greater than"};
$args->{"${field}_lt"} = {%$info, label => "$label less than"};
More information about the Jifty-commit
mailing list