line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::SemanticUI; |
2
|
1
|
|
|
1
|
|
582
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
157
|
use Mojo::Util qw(class_to_path); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
56
|
|
4
|
1
|
|
|
1
|
|
10
|
use List::Util qw(first); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
84
|
|
5
|
1
|
|
|
1
|
|
5
|
use File::Spec::Functions qw(catdir); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
383
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub register { |
10
|
1
|
|
|
1
|
1
|
31
|
my ($self, $app) = @_; |
11
|
1
|
|
|
|
|
4
|
$self->_add_paths($app); |
12
|
1
|
|
|
|
|
3
|
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
|
|
|
|
|
4
|
my $class_path = $INC{class_to_path(__PACKAGE__)}; |
19
|
1
|
|
|
|
|
16
|
$class_path =~ s|Mojolicious[\\/].*$||x; |
20
|
1
|
|
|
|
|
6
|
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
|
|
|
41
|
|
|
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
|
|
|
28
|
|
|
1
|
|
|
|
|
4
|
|
32
|
|
|
|
|
|
|
&& (-d $templates)) |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
0
|
push @{$app->renderer->paths}, $templates; |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
4
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |