Revision 0e14fb48
Von Sven Schöling vor mehr als 3 Jahren hinzugefügt
SL/Presenter/MaterialComponents.pm | ||
---|---|---|
27 | 27 |
use constant SMALL => 'small'; |
28 | 28 |
use constant TINY => 'tiny'; |
29 | 29 |
use constant INPUT_FIELD => 'input-field'; |
30 |
use constant DATEPICKER => 'datepicker'; |
|
30 | 31 |
|
31 | 32 |
use constant WAVES_EFFECT => 'waves-effect'; |
32 | 33 |
use constant WAVES_LIGHT => 'waves-light'; |
... | ... | |
204 | 205 |
); |
205 | 206 |
} |
206 | 207 |
|
208 |
sub date_tag { |
|
209 |
my ($name, $value, %attributes) = @_; |
|
210 |
|
|
211 |
_set_id_attribute(\%attributes, $name); |
|
212 |
|
|
213 |
my $icon = $attributes{icon} |
|
214 |
? icon(delete $attributes{icon}, class => 'prefix') |
|
215 |
: ''; |
|
216 |
|
|
217 |
my $label = $attributes{label} |
|
218 |
? html_tag('label', delete $attributes{label}, for => $attributes{id}) |
|
219 |
: ''; |
|
220 |
|
|
221 |
$attributes{type} = 'text'; # required for materialize |
|
222 |
|
|
223 |
my @onchange = $attributes{onchange} ? (onChange => delete $attributes{onchange}) : (); |
|
224 |
my @classes = (delete $attributes{class}); |
|
225 |
|
|
226 |
$::request->layout->add_javascripts('kivi.Validator.js'); |
|
227 |
$::request->presenter->need_reinit_widgets($attributes{id}); |
|
228 |
|
|
229 |
$attributes{'data-validate'} = join(' ', "date", grep { $_ } (delete $attributes{'data-validate'})); |
|
230 |
|
|
231 |
html_tag('div', |
|
232 |
$icon . |
|
233 |
html_tag('input', |
|
234 |
blessed($value) ? $value->to_lxoffice : $value, |
|
235 |
size => 11, type => 'text', name => $name, |
|
236 |
%attributes, |
|
237 |
class => DATEPICKER, @onchange, |
|
238 |
) . |
|
239 |
$label, |
|
240 |
class => [ grep $_, @classes, INPUT_FIELD ], |
|
241 |
); |
|
242 |
|
|
207 | 243 |
|
208 | 244 |
} |
209 | 245 |
|
Auch abrufbar als: Unified diff
mobile: date_tag Komponente