line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::SemanticUI; |
2
|
1
|
|
|
1
|
|
457
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
123
|
use Mojo::Util qw(class_to_path); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
4
|
1
|
|
|
1
|
|
8
|
use List::Util qw(first); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
5
|
1
|
|
|
1
|
|
3
|
use File::Spec::Functions qw(catdir); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
266
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub register { |
10
|
1
|
|
|
1
|
1
|
27
|
my ($self, $app) = @_; |
11
|
1
|
|
|
|
|
2
|
$self->_add_paths($app); |
12
|
1
|
|
|
|
|
1
|
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
|
|
|
|
|
14
|
$class_path =~ s|Mojolicious[\\/].*$||x; |
20
|
1
|
|
|
|
|
5
|
my ($static, $templates) = ( |
21
|
|
|
|
|
|
|
catdir($class_path, 'Mojolicious', 'public'), |
22
|
|
|
|
|
|
|
catdir($class_path, 'Mojolicious', 'templates') |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
1
|
50
|
50
|
1
|
|
2
|
if (!(first { $static eq $_ // '' } @{$app->static->paths}) |
|
1
|
|
33
|
|
|
49
|
|
|
1
|
|
|
|
|
18
|
|
26
|
|
|
|
|
|
|
&& (-d $static)) |
27
|
|
|
|
|
|
|
{ |
28
|
1
|
|
|
|
|
2
|
push @{$app->static->paths}, $static; |
|
1
|
|
|
|
|
15
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
1
|
50
|
50
|
1
|
|
19
|
if (!(first { $templates eq $_ // '' } @{$app->renderer->paths}) |
|
1
|
|
33
|
|
|
38
|
|
|
1
|
|
|
|
|
14
|
|
32
|
|
|
|
|
|
|
&& (-d $templates)) |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
0
|
push @{$app->renderer->paths}, $templates; |
|
0
|
|
|
|
|
0
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
3
|
return; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |