projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changelog - Features aus Unstable aktualisiert
[kivitendo-erp.git]
/
SL
/
Template
/
Plugin
/
JavaScript.pm
diff --git
a/SL/Template/Plugin/JavaScript.pm
b/SL/Template/Plugin/JavaScript.pm
index
4815830
..
16989e9
100644
(file)
--- a/
SL/Template/Plugin/JavaScript.pm
+++ b/
SL/Template/Plugin/JavaScript.pm
@@
-1,23
+1,16
@@
package SL::Template::Plugin::JavaScript;
package SL::Template::Plugin::JavaScript;
-use base qw( Template::Plugin::Filter );
+use base qw( Template::Plugin );
+use Template::Plugin;
use strict;
use strict;
-my $cached_instance;
-
sub new {
sub new {
- my $class = shift;
-
- return $cached_instance ||= $class->SUPER::new(@_);
-}
-
-sub init {
- my $self = shift;
-
- $self->install_filter($self->{ _ARGS }->[0] || 'js');
+ my ($class, $context, @args) = @_;
- return $self;
+ return bless {
+ CONTEXT => $context,
+ }, $class;
}
#
}
#
@@
-45,11
+38,6
@@
sub escape {
return $text;
}
return $text;
}
-sub filter {
- my ($self, $text) = @_;
- return $self->escape($text);
-}
-
sub replace_with {
return _replace_helper('replaceWith', @_);
}
sub replace_with {
return _replace_helper('replaceWith', @_);
}
@@
-104,11
+92,6
@@
value is not wrapped in quotes. Example:
<input type="submit" value="Delete"
onclick="if (confirm('Do you really want to delete this: [% JavaScript.escape(obj.description) %]') return true; else return false;">
<input type="submit" value="Delete"
onclick="if (confirm('Do you really want to delete this: [% JavaScript.escape(obj.description) %]') return true; else return false;">
-You can also use the filter syntax instead:
-
- <input type="submit" value="Delete"
- onclick="if (confirm('Do you really want to delete this: [% obj.description | js %]') return true; else return false;">
-
=item C<replace_with $selector, $template, %locals>
Returns code replacing the DOM elements matched by C<$selector> with
=item C<replace_with $selector, $template, %locals>
Returns code replacing the DOM elements matched by C<$selector> with