line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::SemanticUI; |
2
|
1
|
|
|
1
|
|
469
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
187
|
use Mojo::Util qw(class_to_path); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
9
|
use List::Util qw(first); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
61
|
|
5
|
1
|
|
|
1
|
|
3
|
use File::Spec::Functions qw(catdir); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
258
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub register { |
10
|
1
|
|
|
1
|
1
|
29
|
my ($self, $app) = @_; |
11
|
1
|
|
|
|
|
3
|
$self->_add_paths($app); |
12
|
1
|
|
|
|
|
2
|
return; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Add Plugin specific paths in case they differ from $app paths. |
16
|
|
|
|
|
|
|
sub _add_paths { |
17
|
1
|
|
|
1
|
|
1
|
my ($self, $app) = @_; |
18
|
1
|
|
|
|
|
3
|
my $class_path = $INC{class_to_path(__PACKAGE__)}; |
19
|
1
|
|
|
|
|
15
|
$class_path =~ s|Mojolicious[\\/].*$||x; |
20
|
1
|
|
|
|
|
9
|
my ($static, $templates) = ( |
21
|
|
|
|
|
|
|
catdir($class_path, 'Mojolicious', 'public'), |
22
|
|
|
|
|
|
|
catdir($class_path, 'Mojolicious', 'templates') |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
50
|
1
|
|
3
|
if (!(first { $static eq $_ // '' } @{$app->static->paths}) |
|
1
|
|
33
|
|
|
40
|
|
|
1
|
|
|
|
|
5
|
|
26
|
|
|
|
|
|
|
&& (-d $static)) |
27
|
|
|
|
|
|
|
{ |
28
|
1
|
|
|
|
|
1
|
push @{$app->static->paths}, $static; |
|
1
|
|
|
|
|
2
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
50
|
1
|
|
8
|
if (!(first { $templates eq $_ // '' } @{$app->renderer->paths}) |
|
1
|
|
33
|
|
|
25
|
|
|
1
|
|
|
|
|
4
|
|
32
|
|
|
|
|
|
|
&& (-d $templates)) |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
0
|
push @{$app->renderer->paths}, $templates; |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
2
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |