Revision 003ccb5a
Von Cem Aydin vor mehr als 1 Jahr hinzugefügt
SL/Presenter/MaterialComponents.pm | ||
---|---|---|
13 | 13 |
our @EXPORT_OK = qw( |
14 | 14 |
button_tag |
15 | 15 |
input_tag |
16 |
textarea_tag |
|
16 | 17 |
date_tag |
17 | 18 |
submit_tag |
18 | 19 |
icon |
... | ... | |
231 | 232 |
); |
232 | 233 |
} |
233 | 234 |
|
235 |
sub textarea_tag { |
|
236 |
my ($name, $value, %attributes) = @_; |
|
237 |
|
|
238 |
_set_id_attribute(\%attributes, $attributes{name}); |
|
239 |
|
|
240 |
my $class = delete $attributes{class}; |
|
241 |
my $icon = $attributes{icon} |
|
242 |
? icon(delete $attributes{icon}, class => 'prefix') |
|
243 |
: ''; |
|
244 |
|
|
245 |
my $label = $attributes{label} |
|
246 |
? html_tag('label', delete $attributes{label}, for => $attributes{id}) |
|
247 |
: ''; |
|
248 |
|
|
249 |
html_tag('div', |
|
250 |
$icon . |
|
251 |
html_tag('textarea', $value, class => 'materialize-textarea', %attributes, name => $name) . |
|
252 |
$label, |
|
253 |
class => [ grep $_, $class, INPUT_FIELD ], |
|
254 |
); |
|
255 |
} |
|
256 |
|
|
234 | 257 |
sub date_tag { |
235 | 258 |
my ($name, $value, %attributes) = @_; |
236 | 259 |
|
templates/mobile_webpages/test/components.html | ||
---|---|---|
32 | 32 |
[% P.M.input_tag("", "", placeholder="with placeholder", label="test input with placeholder") %] |
33 | 33 |
[% P.M.input_tag("", "default value", placeholder="with placeholder", label="test input with placeholder and default value") %] |
34 | 34 |
|
35 |
<h3>Textarea:</h3> |
|
36 |
[% P.M.textarea_tag("", "", label="Notes") %] |
|
37 |
[% P.M.textarea_tag("", "default value\nmulti-line", label="Notes with multi-line default value") %] |
|
38 |
[% P.M.textarea_tag("", "", placeholder="with placeholder", label="Notes with placeholder") %] |
|
39 |
[% P.M.textarea_tag("", "default value\nmulti-line", placeholder="with placeholder", label="Notes with placeholder and multi-line default value") %] |
|
40 |
|
|
35 | 41 |
<h3>With grid:</h3> |
36 | 42 |
<div class="row"> |
37 | 43 |
[% P.M.input_tag("", "", label="2 cols", class="col s6") %] |
Auch abrufbar als: Unified diff
Mobile Design: MaterialComponents Presenter textarea input hinzugefügt