Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5dbd60bf

Von Sven Schöling vor fast 7 Jahren hinzugefügt

  • ID 5dbd60bfea0c2ca1b3856bddd8dd388acf5aa237
  • Vorgänger 86eed232
  • Nachfolger 4ad23419

Presenter::Tag: date_tag aus Plugin/L verschoben

Unterschiede anzeigen:

SL/Presenter/Tag.pm
4 4

  
5 5
use SL::HTML::Restrict;
6 6
use SL::Presenter::EscapedText qw(escape);
7
use Scalar::Util qw(blessed);
7 8

  
8 9
use Exporter qw(import);
9 10
our @EXPORT_OK = qw(
10 11
  html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag
11 12
  checkbox_tag button_tag submit_tag ajax_submit_tag input_number_tag
12
  stringify_attributes restricted_html textarea_tag link
13
  stringify_attributes restricted_html textarea_tag link date_tag
13 14
);
14 15
our %EXPORT_TAGS = (ALL => \@EXPORT_OK);
15 16

  
......
330 331
  html_tag('a', $content, %params, href => $href);
331 332
}
332 333

  
334
sub date_tag {
335
  my ($name, $value, %params) = @_;
336

  
337
  _set_id_attribute(\%params, $name);
338
  my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : ();
339
  my @classes  = $params{no_cal} || $params{readonly} ? () : ('datepicker');
340
  push @classes, delete($params{class}) if $params{class};
341
  my %class    = @classes ? (class => join(' ', @classes)) : ();
342

  
343
  $::request->layout->add_javascripts('kivi.Validator.js');
344
  $::request->presenter->need_reinit_widgets($params{id});
345

  
346
  input_tag(
347
    $name, blessed($value) ? $value->to_lxoffice : $value,
348
    size   => 11,
349
    "data-validate" => "date",
350
    %params,
351
    %class, @onchange,
352
  );
353
}
354

  
333 355
1;
334 356
__END__
335 357

  
SL/Template/Plugin/L.pm
81 81
sub link                     { return _call_presenter('link',                     @_); }
82 82
sub input_number_tag         { return _call_presenter('input_number_tag',         @_); }
83 83
sub textarea_tag             { return _call_presenter('textarea_tag',             @_); }
84
sub date_tag                 { return _call_presenter('date_tag',                 @_); }
84 85

  
85 86
sub _set_id_attribute {
86 87
  my ($attributes, $name, $unique) = @_;
......
152 153
  return $code;
153 154
}
154 155

  
155
my $date_tag_id_idx = 0;
156
sub date_tag {
157
  my ($self, $name, $value, %params) = _hashify(3, @_);
158

  
159
  _set_id_attribute(\%params, $name);
160
  my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : ();
161
  my @classes  = $params{no_cal} || $params{readonly} ? () : ('datepicker');
162
  push @classes, delete($params{class}) if $params{class};
163
  my %class    = @classes ? (class => join(' ', @classes)) : ();
164

  
165
  $::request->layout->add_javascripts('kivi.Validator.js');
166
  $::request->presenter->need_reinit_widgets($params{id});
167

  
168
  return $self->input_tag(
169
    $name, blessed($value) ? $value->to_lxoffice : $value,
170
    size   => 11,
171
    "data-validate" => "date",
172
    %params,
173
    %class, @onchange,
174
  );
175
}
176 156

  
177 157
# simple version with select_tag
178 158
sub vendor_selector {

Auch abrufbar als: Unified diff