[Jifty-commit] r6939 - in jifty/trunk: lib/Jifty/Action lib/Jifty/Plugin/REST lib/Jifty/Web/Form share/web/static/js
Jifty commits
jifty-commit at lists.jifty.org
Mon May 4 16:02:49 EDT 2009
Author: sartak
Date: Mon May 4 16:02:49 2009
New Revision: 6939
Modified:
jifty/trunk/lib/Jifty/Action/Record.pm
jifty/trunk/lib/Jifty/Manual/Models.pod
jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
jifty/trunk/lib/Jifty/Web/Form/Field.pm
jifty/trunk/share/web/static/js/jifty.js
Log:
Add and use the display_length attribute on columns
Modified: jifty/trunk/lib/Jifty/Action/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record.pm (original)
+++ jifty/trunk/lib/Jifty/Action/Record.pm Mon May 4 16:02:49 2009
@@ -296,7 +296,7 @@
# If we're hand-coding a render_as, hints or label, let's use it.
for (
- qw(render_as label hints max_length mandatory sort_order container documentation)
+ qw(render_as label hints display_length max_length mandatory sort_order container documentation)
)
{
if ( defined( my $val = $column->$_ ) ) {
Modified: jifty/trunk/lib/Jifty/Manual/Models.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Models.pod (original)
+++ jifty/trunk/lib/Jifty/Manual/Models.pod Mon May 4 16:02:49 2009
@@ -94,6 +94,7 @@
| 'validator' 'is' subroutine_reference
| 'immutable'
| 'unreadable'
+ | 'display_length' 'is' number
| 'max_length' 'is' number
| 'mandatory'
| 'not_null'
Modified: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm Mon May 4 16:02:49 2009
@@ -498,6 +498,7 @@
type
default
readable writable
+ display_length
max_length
mandatory
distinct
Modified: jifty/trunk/lib/Jifty/Web/Form/Field.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field.pm (original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field.pm Mon May 4 16:02:49 2009
@@ -13,6 +13,7 @@
label
hints
placeholder
+display_length
max_length
mandatory
@@ -122,14 +123,16 @@
shift->SUPER::accessors(), qw(name label input_name type
sticky sticky_value default_value action mandatory ajax_validates
ajax_canonicalizes autocompleter preamble hints placeholder focus
- render_mode max_length _element_id disable_autocomplete multiple);
+ render_mode display_length max_length _element_id disable_autocomplete
+ multiple);
}
__PACKAGE__->mk_accessors(
qw(name _label _input_name type sticky sticky_value
default_value mandatory ajax_validates ajax_canonicalizes
autocompleter preamble hints placeholder focus render_mode
- max_length _element_id disable_autocomplete multiple)
+ display_length max_length _element_id disable_autocomplete
+ multiple)
);
=head2 name [VALUE]
@@ -526,7 +529,15 @@
$field .= qq! id="@{[ $self->element_id ]}"!;
$field .= qq! value="@{[$self->canonicalize_value(Jifty->web->escape($self->current_value))]}"! if defined $self->current_value;
$field .= $self->_widget_class;
- $field .= qq! size="@{[ $self->max_length() ]}" maxlength="@{[ $self->max_length() ]}"! if ($self->max_length());
+
+ if ($self->display_length) {
+ $field .= qq! size="@{[ $self->display_length() ]}"!;
+ }
+ elsif ($self->max_length) {
+ $field .= qq! size="@{[ $self->max_length() ]}"!;
+ }
+
+ $field .= qq! maxlength="@{[ $self->max_length() ]}"! if ($self->max_length());
$field .= qq! autocomplete="off"! if defined $self->disable_autocomplete;
$field .= " " .$self->other_widget_properties;
$field .= $self->javascript;
Modified: jifty/trunk/share/web/static/js/jifty.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty.js (original)
+++ jifty/trunk/share/web/static/js/jifty.js Mon May 4 16:02:49 2009
@@ -437,7 +437,14 @@
fields.push('id', tthis.element_id());
if (tthis.current_value) fields.push('value', tthis.current_value);
fields.push('class', tthis._widget_class().join(' '));
- if (tthis.max_length) fields.push('size', tthis.max_length, 'maxlength', tthis.max_length);
+ if (tthis.display_length) {
+ fields.push('size', tthis.display_length)
+ }
+ else if (tthis.max_length) {
+ fields.push('size', tthis.max_length)
+ }
+
+ if (tthis.max_length) fields.push('maxlength', tthis.max_length);
if (tthis.disable_autocomplete) fields.push('autocomplete', "off");
//" " .$self->other_widget_properties;
return fields;
More information about the Jifty-commit
mailing list