Revision 99d0bd2b
Von Moritz Bunkus vor fast 8 Jahren hinzugefügt
SL/Presenter/Tag.pm | ||
---|---|---|
7 | 7 |
use parent qw(Exporter); |
8 | 8 |
|
9 | 9 |
use Exporter qw(import); |
10 |
our @EXPORT = qw(html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag checkbox_tag button_tag submit_tag ajax_submit_tag stringify_attributes restricted_html); |
|
10 |
our @EXPORT = qw(html_tag input_tag hidden_tag javascript man_days_tag name_to_id select_tag checkbox_tag button_tag submit_tag ajax_submit_tag stringify_attributes restricted_html link);
|
|
11 | 11 |
|
12 | 12 |
use Carp; |
13 | 13 |
|
... | ... | |
282 | 282 |
return $html_restricter->process($value); |
283 | 283 |
} |
284 | 284 |
|
285 |
sub link { |
|
286 |
my ($self, $href, $content, %params) = @_; |
|
287 |
|
|
288 |
$href ||= '#'; |
|
289 |
|
|
290 |
return $self->html_tag('a', $content, %params, href => $href); |
|
291 |
} |
|
292 |
|
|
285 | 293 |
1; |
286 | 294 |
__END__ |
287 | 295 |
|
... | ... | |
417 | 425 |
The attribute C<size> can be used to set the text input's size. It |
418 | 426 |
defaults to 5. |
419 | 427 |
|
428 |
=item C<hidden_tag $name, $value, %attributes> |
|
429 |
|
|
430 |
Creates a HTML 'input type=hidden' tag named C<$name> with the value |
|
431 |
C<$value> and with arbitrary HTML attributes from C<%attributes>. The |
|
432 |
tag's C<id> defaults to C<name_to_id($name)>. |
|
433 |
|
|
434 |
=item C<checkbox_tag $name, %attributes> |
|
435 |
|
|
436 |
Creates a HTML 'input type=checkbox' tag named C<$name> with arbitrary |
|
437 |
HTML attributes from C<%attributes>. The tag's C<id> defaults to |
|
438 |
C<name_to_id($name)>. The tag's C<value> defaults to C<1>. |
|
439 |
|
|
440 |
If C<%attributes> contains a key C<label> then a HTML 'label' tag is |
|
441 |
created with said C<label>. No attribute named C<label> is created in |
|
442 |
that case. |
|
443 |
|
|
444 |
If C<%attributes> contains a key C<checkall> then the value is taken as a |
|
445 |
JQuery selector and clicking this checkbox will also toggle all checkboxes |
|
446 |
matching the selector. |
|
447 |
|
|
420 | 448 |
=item C<select_tag $name, \@collection, %attributes> |
421 | 449 |
|
422 | 450 |
Creates an HTML 'select' tag named C<$name> with the contents of one |
SL/Template/Plugin/L.pm | ||
---|---|---|
76 | 76 |
sub button_tag { return _call_presenter('button_tag', @_); } |
77 | 77 |
sub submit_tag { return _call_presenter('submit_tag', @_); } |
78 | 78 |
sub ajax_submit_tag { return _call_presenter('ajax_submit_tag', @_); } |
79 |
sub link { return _call_presenter('link', @_); } |
|
79 | 80 |
|
80 | 81 |
sub _set_id_attribute { |
81 | 82 |
my ($attributes, $name, $unique) = @_; |
... | ... | |
138 | 139 |
return $self->html_tag('li', $content, @slurp); |
139 | 140 |
} |
140 | 141 |
|
141 |
sub link { |
|
142 |
my ($self, $href, $content, %params) = _hashify(3, @_); |
|
143 |
|
|
144 |
$href ||= '#'; |
|
145 |
|
|
146 |
return $self->html_tag('a', $content, %params, href => $href); |
|
147 |
} |
|
148 |
|
|
149 | 142 |
sub yes_no_tag { |
150 | 143 |
my ($self, $name, $value, %attributes) = _hashify(3, @_); |
151 | 144 |
|
... | ... | |
479 | 472 |
|
480 | 473 |
=item * C<input_tag $name, $value, %attributes> |
481 | 474 |
|
475 |
=item * C<hidden_tag $name, $value, %attributes> |
|
476 |
|
|
477 |
=item * C<checkbox_tag $name, %attributes> |
|
478 |
|
|
482 | 479 |
=item * C<select_tag $name, \@collection, %attributes> |
483 | 480 |
|
481 |
=item * C<link $href, $content, %attributes> |
|
482 |
|
|
484 | 483 |
=back |
485 | 484 |
|
486 | 485 |
Available high-level functions implemented in this module: |
... | ... | |
494 | 493 |
which entry is selected. The C<%attributes> are passed through to |
495 | 494 |
L<select_tag>. |
496 | 495 |
|
497 |
=item C<hidden_tag $name, $value, %attributes> |
|
498 |
|
|
499 |
Creates a HTML 'input type=hidden' tag named C<$name> with the value |
|
500 |
C<$value> and with arbitrary HTML attributes from C<%attributes>. The |
|
501 |
tag's C<id> defaults to C<name_to_id($name)>. |
|
502 |
|
|
503 | 496 |
=item C<textarea_tag $name, $value, %attributes> |
504 | 497 |
|
505 | 498 |
Creates a HTML 'textarea' tag named C<$name> with the content |
506 | 499 |
C<$value> and with arbitrary HTML attributes from C<%attributes>. The |
507 | 500 |
tag's C<id> defaults to C<name_to_id($name)>. |
508 | 501 |
|
509 |
=item C<checkbox_tag $name, %attributes> |
|
510 |
|
|
511 |
Creates a HTML 'input type=checkbox' tag named C<$name> with arbitrary |
|
512 |
HTML attributes from C<%attributes>. The tag's C<id> defaults to |
|
513 |
C<name_to_id($name)>. The tag's C<value> defaults to C<1>. |
|
514 |
|
|
515 |
If C<%attributes> contains a key C<label> then a HTML 'label' tag is |
|
516 |
created with said C<label>. No attribute named C<label> is created in |
|
517 |
that case. |
|
518 |
|
|
519 |
If C<%attributes> contains a key C<checkall> then the value is taken as a |
|
520 |
JQuery selector and clicking this checkbox will also toggle all checkboxes |
|
521 |
matching the selector. |
|
522 |
|
|
523 | 502 |
=item C<date_tag $name, $value, %attributes> |
524 | 503 |
|
525 | 504 |
Creates a date input field, with an attached javascript that will open a |
Auch abrufbar als: Unified diff
Presenter: mehr Funktionen von L in Tag-Presenter verschieben