use List::MoreUtils qw(apply);
sub javascripts_inline {
- _setup_formats(),
- _setup_focus(),
- _setup_ajax_spinner(),
+ my ($self) = @_;
+
+ my $datefmt = apply {
+ s/d+/dd/gi;
+ s/m+/mm/gi;
+ s/y+/yy/gi;
+ } $::myconfig{dateformat};
+
+ return $self->render(
+ 'layout/javascript_setup',
+ { type => 'js', output => 0, },
+ datefmt => $datefmt,
+ focus => $::request->layout->focus,
+ ajax_spinner => 1,
+ );
}
sub use_javascript {
$self->SUPER::use_stylesheet(@_);
}
-sub _setup_formats {
- my $datefmt = apply {
- s/d+/dd/gi;
- s/m+/mm/gi;
- s/y+/yy/gi;
- } $::myconfig{dateformat};
-
- $::form->parse_html_template('layout/javascript_setup', { datefmt => $datefmt });
-}
-
-sub _setup_focus {
- if ($::request->{layout}->focus) {
- return $::form->parse_html_template('layout/focus_setup', {
- focus => $::request->{layout}->focus,
- })
- } else {
- return ();
- }
-}
-
-sub _setup_ajax_spinner {
- return SL::Presenter->get->render('layout/ajax_spinner_setup', { type => 'js' });
-}
-
1;
+++ /dev/null
-$(function() {
- $(document).ajaxSend(function() {
- $('#ajax-spinner').show();
- }).ajaxStop(function() {
- $('#ajax-spinner').hide();
- });
-});
+++ /dev/null
-function fokus(){ [% IF focus %]$('[% focus %]').focus()[% END %] }
+++ /dev/null
-[%- USE T8 %]
-$(function() {
- setupPoints('[% myconfig.numberformat %]', '[% 'wrongformat' | $T8 %]');
- setupDateFormat('[% myconfig.dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]');
-
- $.datepicker.setDefaults(
- $.extend({}, $.datepicker.regional["[% myconfig.countrycode %]"], {
- dateFormat: "[% datefmt %]",
- showOn: "button",
- showButtonPanel: true,
- changeMonth: true,
- changeYear: true,
- buttonImage: "image/calendar.png",
- buttonImageOnly: true
- }));
-
- $('.datepicker').each(function() {
- $(this).datepicker();
- });
-})
--- /dev/null
+[%- USE T8 %]
+$(function() {
+[% IF datefmt %]
+ setupPoints('[% MYCONFIG.numberformat %]', '[% 'wrongformat' | $T8 %]');
+ setupDateFormat('[% MYCONFIG.dateformat %]', '[% 'Falsches Datumsformat!' | $T8 %]');
+
+ $.datepicker.setDefaults(
+ $.extend({}, $.datepicker.regional["[% MYCONFIG.countrycode %]"], {
+ dateFormat: "[% datefmt %]",
+ showOn: "button",
+ showButtonPanel: true,
+ changeMonth: true,
+ changeYear: true,
+ buttonImage: "image/calendar.png",
+ buttonImageOnly: true
+ }));
+
+ $('.datepicker').each(function() {
+ $(this).datepicker();
+ });
+[% END %]
+
+[% IF ajax_spinner %]
+ $(document).ajaxSend(function() {
+ $('#ajax-spinner').show();
+ }).ajaxStop(function() {
+ $('#ajax-spinner').hide();
+ });
+[% END %]
+});
+
+function fokus() {
+[%- IF focus -%]
+ $('[% focus %]').focus();
+[%- END -%]
+}