From c59e85c3a7538b1279e25022a6cf431ca1dee700 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 31 Aug 2017 13:46:34 +0200 Subject: [PATCH] AreaInputTag: kleines Icon neben Input zum Umschalten auf Textarea MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In Masken, in denen es keinen »Erneuern«-Button gab (neuer Artikelcontroller), hatten die Benutzer*innen somit auch keine Möglichkeit, aus dem normalen Input eine Textarea zu machen. Dies hier ist nun eine manuelle Möglichkeit dafür. --- SL/Template/Plugin/L.pm | 12 +++++++++--- image/edit-entry.png | Bin 0 -> 633 bytes js/kivi.js | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 image/edit-entry.png diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 0b0c760ec..a8e63815c 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -279,9 +279,15 @@ sub areainput_tag { my $maxrows = delete $attributes{max_rows}; my $rows = $::form->numtextrows($value, $cols, $maxrows, $minrows); - return $rows > 1 - ? $self->textarea_tag($name, $value, %attributes, rows => $rows, cols => $cols) - : $self->input_tag($name, $value, %attributes, size => $cols); + $attributes{id} ||= _tag_id(); + my $id = $attributes{id}; + + return $self->textarea_tag($name, $value, %attributes, rows => $rows, cols => $cols) if $rows > 1; + + return '' + . $self->input_tag($name, $value, %attributes, size => $cols) + . "" + . ''; } sub multiselect2side { diff --git a/image/edit-entry.png b/image/edit-entry.png new file mode 100644 index 0000000000000000000000000000000000000000..c8888f3410c78c05ac4df19c00eeff59c00b806a GIT binary patch literal 633 zcmV-<0*3vGP)t)jIshz7y>D) zMJeVYNXxJ&Eoc?AY2~g>6hRbJE`m0-P=YohWKc|-sfB%_rWI0)(XgZ$-#N|eVi-d( z?FX03h37nQt`ZUchh~|SQYK!b)~>kV^0^(uZcBeHDJj{z?1J`#`bow5Z?U%Hr%ib{ zbzkNDQ-R89ikrLpchmSH`JDsX-cnUr_7n&pB1@izox11FB_-W0ZkbC|Ny{DvfhZ7M za=5;l&g&Oc_WTjQ%nU`PtBH3&9k32?sabiGm*$9=Tota!B$y}&b{WcEO6u6 z6~;%s9BWi4tr_$6&`=vE5D4OAT`uF?^F@XnyP!ZsSQD5f-dw>d_XN*V-RwJb7@t3g zW!%nCJ}*jRESFb%40(ft1N8Ux^KnZx9cORST3SjvohIm?AEuBJ8zU$RR|tiQ>3x{M z@Au;{#!#d+wgAEcA`0Ww{?3pWtK1F+*^CX?EJ~Dxnf>)+VrZbxW(7t*41f9qDDu!I TKb+Ol00000NkvXXu0mjfVO13F literal 0 HcmV?d00001 diff --git a/js/kivi.js b/js/kivi.js index 41b3762a3..fbe0c953b 100644 --- a/js/kivi.js +++ b/js/kivi.js @@ -535,6 +535,23 @@ namespace("kivi", function(ns) { return true; }; + + ns.switch_areainput_to_textarea = function(id) { + var $input = $('#' + id); + if (!$input.length) + return; + + var $area = $(''); + + $area.prop('rows', 3); + $area.prop('cols', $input.prop('size') || 40); + $area.prop('name', $input.prop('name')); + $area.prop('id', $input.prop('id')); + $area.val($input.val()); + + $input.parent().replaceWith($area); + $area.focus(); + }; }); kivi = namespace('kivi'); -- 2.20.1