Revision b2017499
Von Sven Schöling vor etwa 7 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 link); |
|
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 input_number_tag stringify_attributes restricted_html link);
|
|
11 | 11 |
|
12 | 12 |
use Carp; |
13 | 13 |
|
... | ... | |
257 | 257 |
return $self->button_tag($onclick, $text, %attributes); |
258 | 258 |
} |
259 | 259 |
|
260 |
sub input_number_tag { |
|
261 |
my ($self, $name, $value, %params) = @_; |
|
262 |
|
|
263 |
_set_id_attribute(\%params, $name); |
|
264 |
my @onchange = $params{onchange} ? (onChange => delete $params{onchange}) : (); |
|
265 |
my @classes = ('numeric'); |
|
266 |
push @classes, delete($params{class}) if $params{class}; |
|
267 |
my %class = @classes ? (class => join(' ', @classes)) : (); |
|
268 |
|
|
269 |
$::request->layout->add_javascripts('kivi.Validator.js'); |
|
270 |
$::request->presenter->need_reinit_widgets($params{id}); |
|
271 |
|
|
272 |
return $self->input_tag( |
|
273 |
$name, $::form->foramt_amount(\%::myconfig, $value), |
|
274 |
"data-validate" => "number", |
|
275 |
%params, |
|
276 |
%class, @onchange, |
|
277 |
); |
|
278 |
} |
|
279 |
|
|
280 |
|
|
260 | 281 |
sub javascript { |
261 | 282 |
my ($self, $data) = @_; |
262 | 283 |
return $self->html_tag('script', $data, type => 'text/javascript'); |
SL/Template/Plugin/L.pm | ||
---|---|---|
77 | 77 |
sub submit_tag { return _call_presenter('submit_tag', @_); } |
78 | 78 |
sub ajax_submit_tag { return _call_presenter('ajax_submit_tag', @_); } |
79 | 79 |
sub link { return _call_presenter('link', @_); } |
80 |
sub input_number_tag { return _call_presenter('input_number_tag', @_); } |
|
80 | 81 |
|
81 | 82 |
sub _set_id_attribute { |
82 | 83 |
my ($attributes, $name, $unique) = @_; |
... | ... | |
169 | 170 |
push @classes, delete($params{class}) if $params{class}; |
170 | 171 |
my %class = @classes ? (class => join(' ', @classes)) : (); |
171 | 172 |
|
173 |
$::request->layout->add_javascripts('kivi.Validator.js'); |
|
172 | 174 |
$::request->presenter->need_reinit_widgets($params{id}); |
173 | 175 |
|
174 | 176 |
return $self->input_tag( |
175 | 177 |
$name, blessed($value) ? $value->to_lxoffice : $value, |
176 | 178 |
size => 11, |
177 |
onchange => "check_right_date_format(this);",
|
|
179 |
"data-validate" => "date",
|
|
178 | 180 |
%params, |
179 | 181 |
%class, @onchange, |
180 | 182 |
); |
Auch abrufbar als: Unified diff
kivi.Validator: date_tag angepasst und input_number_tag eingeführt