From 1ec0f541eb70afb7b2058acf9d6847e6e6e21dff Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 28 Aug 2012 13:31:00 +0200 Subject: [PATCH] Helferfunktion L.yes_no_tag() Implementiert die Standard-"Ja/Nein"-Selectbox via L.select_tag(..., L.options_for_select()) --- SL/Template/Plugin/L.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SL/Template/Plugin/L.pm b/SL/Template/Plugin/L.pm index 0b4967d34..f6a3fd804 100644 --- a/SL/Template/Plugin/L.pm +++ b/SL/Template/Plugin/L.pm @@ -252,6 +252,14 @@ sub options_for_select { return $code; } +sub yes_no_tag { + my ($self, $name, $value) = splice @_, 0, 3; + my %attributes = _hashify(@_); + + my $options = $self->options_for_select([ [ 1, $::locale->text('Yes') ], [ 0, $::locale->text('No') ] ], default => $value ? 1 : 0); + return $self->select_tag($name, $options, %attributes); +} + sub javascript { my ($self, $data) = @_; return $self->html_tag('script', $data, type => 'text/javascript'); @@ -629,6 +637,13 @@ L function. If C<$options_string> is an array reference then it will be passed to L automatically. +=item C + +Creates a HTML 'select' tag with the two entries C and C by +calling L and L. C<$value> determines +which entry is selected. The C<%attributes> are passed through to +L. + =item C Creates a HTML 'input type=text' tag named C<$name> with the value -- 2.20.1