projects
/
kivitendo-erp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5551a36
)
L.button_tag: Support für 'confirm' & Doku
author
Moritz Bunkus
<m.bunkus@linet-services.de>
Wed, 13 Mar 2013 14:29:50 +0000
(15:29 +0100)
committer
Moritz Bunkus
<m.bunkus@linet-services.de>
Wed, 13 Mar 2013 16:56:52 +0000
(17:56 +0100)
SL/Template/Plugin/L.pm
patch
|
blob
|
history
diff --git
a/SL/Template/Plugin/L.pm
b/SL/Template/Plugin/L.pm
index
0bdef40
..
b6021f5
100644
(file)
--- a/
SL/Template/Plugin/L.pm
+++ b/
SL/Template/Plugin/L.pm
@@
-180,6
+180,8
@@
sub button_tag {
$attributes{id} ||= $self->name_to_id($attributes{name}) if $attributes{name};
$attributes{type} ||= 'button';
$attributes{id} ||= $self->name_to_id($attributes{name}) if $attributes{name};
$attributes{type} ||= 'button';
+ $onclick = 'if (!confirm("'. _J(delete($attributes{confirm})) .'")) return false; ' . $onclick if $attributes{confirm};
+
return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
}
return $self->html_tag('input', undef, %attributes, value => $value, onclick => $onclick);
}
@@
-572,9
+574,20
@@
tag's C<id> defaults to C<name_to_id($name)>.
If C<$attributes{confirm}> is set then a JavaScript popup dialog will
be added via the C<onclick> handler asking the question given with
If C<$attributes{confirm}> is set then a JavaScript popup dialog will
be added via the C<onclick> handler asking the question given with
-C<$attributes{confirm}>.
If
request is only submitted if the user
+C<$attributes{confirm}>.
The
request is only submitted if the user
clicks the dialog's ok/yes button.
clicks the dialog's ok/yes button.
+=item C<button_tag $onclick, $text, %attributes>
+
+Creates a HTML 'input type="button"' tag with an onclick handler
+C<$onclick> and a value of C<$text>. The button does not have a name
+nor an ID by default.
+
+If C<$attributes{confirm}> is set then a JavaScript popup dialog will
+be prepended to the C<$onclick> handler asking the question given with
+C<$attributes{confirm}>. The request is only submitted if the user
+clicks the dialog's "ok/yes" button.
+
=item C<textarea_tag $name, $value, %attributes>
Creates a HTML 'textarea' tag named C<$name> with the content
=item C<textarea_tag $name, $value, %attributes>
Creates a HTML 'textarea' tag named C<$name> with the content