From 796598ed8f166e284da918c34ca6dd949a0a91f9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 18 Jan 2012 14:56:16 +0100 Subject: [PATCH] L.areainput_tag: cols als parameter akzeptieren. --- SL/Template/Plugin/L.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 8d5b9f62a..f7ffc11b2 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -421,12 +421,19 @@ sub areainput_tag { my ($self, $name, $value, @slurp) = @_; my %attributes = _hashify(@slurp); - my $rows = delete $attributes{rows} || 1; + my ($rows, $cols); my $min = delete $attributes{min_rows} || 1; + if (exists $attributes{cols}) { + $cols = delete $attributes{cols}; + $rows = $::form->numtextrows($value, $cols); + } else { + $rows = delete $attributes{rows} || 1; + } + return $rows > 1 - ? $self->textarea_tag($name, $value, %attributes, rows => max $rows, $min) - : $self->input_tag($name, $value, %attributes); + ? $self->textarea_tag($name, $value, %attributes, rows => max($rows, $min), ($cols ? (cols => $cols) : ())) + : $self->input_tag($name, $value, %attributes, ($cols ? (size => $cols) : ())); } sub multiselect2side { @@ -691,7 +698,8 @@ should be selected by default. =item C Creates a generic input tag or textarea tag, depending on content size. The -mount of desired rows must be given with C parameter, Accpeted parameters +amount of desired rows must be either given with the C parameter or can +be computed from the value and the C paramter, Accepted parameters include C for rendering a minimum of rows if a textarea is displayed. You can force input by setting rows to 1, and you can force textarea by setting -- 2.20.1