Revision 1490701d
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Layout/None.pm | ||
---|---|---|
6 | 6 |
use List::MoreUtils qw(apply); |
7 | 7 |
|
8 | 8 |
sub javascripts_inline { |
9 |
_setup_formats(), |
|
10 |
_setup_focus(), |
|
11 |
_setup_ajax_spinner(), |
|
9 |
my ($self) = @_; |
|
10 |
|
|
11 |
my $datefmt = apply { |
|
12 |
s/d+/dd/gi; |
|
13 |
s/m+/mm/gi; |
|
14 |
s/y+/yy/gi; |
|
15 |
} $::myconfig{dateformat}; |
|
16 |
|
|
17 |
return $self->render( |
|
18 |
'layout/javascript_setup', |
|
19 |
{ type => 'js', output => 0, }, |
|
20 |
datefmt => $datefmt, |
|
21 |
focus => $::request->layout->focus, |
|
22 |
ajax_spinner => 1, |
|
23 |
); |
|
12 | 24 |
} |
13 | 25 |
|
14 | 26 |
sub use_javascript { |
... | ... | |
29 | 41 |
$self->SUPER::use_stylesheet(@_); |
30 | 42 |
} |
31 | 43 |
|
32 |
sub _setup_formats { |
|
33 |
my $datefmt = apply { |
|
34 |
s/d+/dd/gi; |
|
35 |
s/m+/mm/gi; |
|
36 |
s/y+/yy/gi; |
|
37 |
} $::myconfig{dateformat}; |
|
38 |
|
|
39 |
$::form->parse_html_template('layout/javascript_setup', { datefmt => $datefmt }); |
|
40 |
} |
|
41 |
|
|
42 |
sub _setup_focus { |
|
43 |
if ($::request->{layout}->focus) { |
|
44 |
return $::form->parse_html_template('layout/focus_setup', { |
|
45 |
focus => $::request->{layout}->focus, |
|
46 |
}) |
|
47 |
} else { |
|
48 |
return (); |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
sub _setup_ajax_spinner { |
|
53 |
return SL::Presenter->get->render('layout/ajax_spinner_setup', { type => 'js' }); |
|
54 |
} |
|
55 |
|
|
56 | 44 |
1; |
Auch abrufbar als: Unified diff
"None"-Layout: alle JavaScript-Setup-Funktionen in einer Funktion zusammengefasst