From 04854ac27e2b18b2d5a15089c69ed5b79c495a2b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 27 Dec 2010 13:57:56 +0100 Subject: [PATCH] =?utf8?q?Layout-Helfer=20f=C3=BCr=20multiselect2side?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Template/Plugin/L.pm | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 844c88dd2..9aead0113 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -377,6 +377,26 @@ sub areainput_tag { : $self->input_tag($name, $value, %attributes); } +sub multiselect2side { + my ($self, $id, @slurp) = @_; + my %params = _hashify(@slurp); + + $params{labelsx} = "\"" . _J($params{labelsx} || $::locale->text('Available')) . "\""; + $params{labeldx} = "\"" . _J($params{labeldx} || $::locale->text('Selected')) . "\""; + $params{moveOptions} = 'false'; + + my $vars = join(', ', map { "${_}: " . $params{$_} } keys %params); + my $code = < + \$().ready(function() { + \$('#${id}').multiselect2side({ ${vars} }); + }); + +EOCODE + + return $code; +} + 1; __END__ @@ -545,6 +565,27 @@ 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 rows to anything >1. +=item C + +Creates a JavaScript snippet calling the jQuery function +C on the select control with the ID C<$id>. The +select itself is not created. C<%params> can contain the following +entries: + +=over 2 + +=item C + +The label of the list of available options. Defaults to the +translation of 'Available'. + +=item C + +The label of the list of selected options. Defaults to the +translation of 'Selected'. + +=back + =back =head2 CONVERSION FUNCTIONS -- 2.20.1