From: Sven Schöling Date: Wed, 18 Jan 2012 13:56:16 +0000 (+0100) Subject: L.areainput_tag: cols als parameter akzeptieren. X-Git-Tag: release-2.7.0beta1~35 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=796598ed8f166e284da918c34ca6dd949a0a91f9;p=kivitendo-erp.git L.areainput_tag: cols als parameter akzeptieren. --- 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