[Jifty-commit] r2288 - jifty/trunk/lib/Jifty/Action/Record
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Sun Dec 3 03:39:11 EST 2006
Author: audreyt
Date: Sun Dec 3 03:39:09 2006
New Revision: 2288
Modified:
jifty/trunk/lib/Jifty/Action/Record/Search.pm
Log:
* Action::Record::Search - When there is just one choice, don't bother
displaying '(any)' for Radio.
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 Sun Dec 3 03:39:09 2006
@@ -70,8 +70,14 @@
# For radio display, display an "any" label as empty choices looks weird
if (lc $info->{render_as} eq 'radio') {
- unshift @$valid_values, { display => _("(any)"), value => '' };
- $info->{default_value} ||= '';
+ if (@$valid_values > 1) {
+ unshift @$valid_values, { display => _("(any)"), value => '' };
+ $info->{default_value} ||= '';
+ }
+ else {
+ # We've got only one choice anyway...
+ $info->{default_value} ||= $valid_values->[0];
+ }
}
else {
unshift @$valid_values, "";
More information about the Jifty-commit
mailing list