Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f89df736

Von Tamino Steinert vor mehr als 1 Jahr hinzugefügt

  • ID f89df736066ebab90f8be7cfe5c43c86c322b41e
  • Vorgänger 9788b84f
  • Nachfolger 646042f6

Presenter: füge 'input_tag_trim' hinzu; entfernt Leerzeichen um Eingabe

Unterschiede anzeigen:

SL/Presenter/Tag.pm
11 11
  html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag
12 12
  checkbox_tag button_tag submit_tag ajax_submit_tag input_number_tag
13 13
  stringify_attributes textarea_tag link_tag date_tag
14
  div_tag radio_button_tag img_tag multi_level_select_tag);
14
  div_tag radio_button_tag img_tag multi_level_select_tag input_tag_trim);
15 15
our %EXPORT_TAGS = (ALL => \@EXPORT_OK);
16 16

  
17 17
use Carp;
......
87 87
  html_tag('input', undef, %attributes, name => $name, value => $value);
88 88
}
89 89

  
90
sub input_tag_trim {
91
  my ($name, $value, %attributes) = @_;
92
  $attributes{'data-validate'} .= ' trimmed_whitespaces';
93

  
94
  _set_id_attribute(\%attributes, $name);
95
  $::request->layout->add_javascripts('kivi.Validator.js');
96
  $::request->presenter->need_reinit_widgets($attributes{id});
97

  
98
  input_tag($name, $value, %attributes);
99
}
100

  
90 101
sub hidden_tag {
91 102
  my ($name, $value, %attributes) = @_;
92 103
  input_tag($name, $value, %attributes, type => 'hidden');
......
653 664
C<$value> and with arbitrary HTML attributes from C<%attributes>. The
654 665
tag's C<id> defaults to C<name_to_id($name)>.
655 666

  
667
=item C<input_tag_trim $name, $value, %attributes>
668

  
669
This is a wrapper around C<input_tag> that adds ' trimmed_whitespaces' to
670
$attributes{'data-validate'} and loads C<js/kivi.Validator.js>. This will trim
671
the whitespaces around the input.
672

  
656 673
=item C<submit_tag $name, $value, %attributes>
657 674

  
658 675
Creates a HTML 'input type=submit class=submit' tag named C<$name> with the
SL/Template/Plugin/L.pm
72 72
sub select_tag    { return _call_presenter('select_tag',    @_); }
73 73
sub checkbox_tag  { return _call_presenter('checkbox_tag',  @_); }
74 74
sub input_tag     { return _call_presenter('input_tag',     @_); }
75
sub input_tag_trim{ return _call_presenter('input_tag_trim',@_); }
75 76
sub javascript    { return _call_presenter('javascript',    @_); }
76 77
sub truncate      { return _call_presenter('truncate',      @_); }
77 78
sub simple_format { return _call_presenter('simple_format', @_); }
......
427 428

  
428 429
=item * C<input_tag $name, $value, %attributes>
429 430

  
431
=item * C<input_tag_trim $name, $value, %attributes>
432

  
430 433
=item * C<hidden_tag $name, $value, %attributes>
431 434

  
432 435
=item * C<checkbox_tag $name, %attributes>

Auch abrufbar als: Unified diff