| 1 | 15 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 2 | 15 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||
| 4 | package Mojolicious::Plugin::BootstrapHelpers; | ||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Type less bootstrap | ||||||||||||||||||||||||||||||||
| 7 | 15 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||||||||||||||
| 8 | 15 | our $VERSION = '0.0206'; | |||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 15 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 15 | ▶ | use Mojolicious::Plugin::BootstrapHelpers::Helpers; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 15 | ▶ | use experimental qw/postderef signatures/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | 14 | ▶ | sub register($self, $app, $args) { | ||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=10 SCAR=25.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||
| 16 | 14 | ▶ | if(exists $args->{'short_strappings_prefix'}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 17 | 0 | $app->log->debug("'short_strappings_prefix' is deprecated. Use 'shortcut_prefix' instead"); | |||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | $args->{'shortcut_prefix'} //= $args->{'short_strappings_prefix'}; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{"shortcut_prefix"} //= $args->{"short_strappings_prefix"}
MC/DC0%0/2
$args->{"shortcut_prefix"} //= $args->{"short_strappings_prefix"}
$args->{"shortcut_prefix"}
$args->{"short_strappings_prefix"}
Truth table0%0/3
A //= B
A= $args->{"shortcut_prefix"}B= $args->{"short_strappings_prefix"}
| |||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||
| 20 | 14 | ▶ | if(exists $args->{'init_short_strappings'}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 21 | 0 | $app->log->debug("'init_short_strappings' is deprecated. Use 'init_shortcuts' instead"); | |||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | $args->{'init_shortcuts'} //= $args->{'init_short_strappings'}; | ||||||||||||||||||||||||||||||
|
Condition0%0/3
$args->{"init_shortcuts"} //= $args->{"init_short_strappings"}
MC/DC0%0/2
$args->{"init_shortcuts"} //= $args->{"init_short_strappings"}
$args->{"init_shortcuts"}
$args->{"init_short_strappings"}
Truth table0%0/3
A //= B
A= $args->{"init_shortcuts"}B= $args->{"init_short_strappings"}
| |||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||
| 24 | 14 | my $tp = setup_prefix($args->{'tag_prefix'}); | |||||||||||||||||||||||||||||||
| 25 | 14 | my $ssp = setup_prefix($args->{'shortcut_prefix'}); | |||||||||||||||||||||||||||||||
| 26 | 14 | ▶ | my $init_shortcuts = $args->{'init_shortcuts'} //= 1; | ||||||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"init_shortcuts"} //= 1
MC/DC0%0/1
$args->{"init_shortcuts"} //= 1
$args->{"init_shortcuts"}
Truth table50%1/2
A
A= $args->{"init_shortcuts"}
| |||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 14 | $app->helper($tp.'bootstrap' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstraps_bootstraps); | |||||||||||||||||||||||||||||||
| 29 | 14 | $app->helper($tp.'table' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_table); | |||||||||||||||||||||||||||||||
| 30 | 14 | $app->helper($tp.'panel' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_panel); | |||||||||||||||||||||||||||||||
| 31 | 14 | $app->helper($tp.'formgroup' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_formgroup); | |||||||||||||||||||||||||||||||
| 32 | 14 | $app->helper($tp.'button' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_button); | |||||||||||||||||||||||||||||||
| 33 | 14 | $app->helper($tp.'submit_button' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_submit); | |||||||||||||||||||||||||||||||
| 34 | 14 | $app->helper($tp.'badge' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_badge); | |||||||||||||||||||||||||||||||
| 35 | 14 | $app->helper($tp.'context_menu' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_context_menu); | |||||||||||||||||||||||||||||||
| 36 | 14 | $app->helper($tp.'dropdown' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_dropdown); | |||||||||||||||||||||||||||||||
| 37 | 14 | $app->helper($tp.'buttongroup' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_buttongroup); | |||||||||||||||||||||||||||||||
| 38 | 14 | $app->helper($tp.'toolbar' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_toolbar); | |||||||||||||||||||||||||||||||
| 39 | 14 | $app->helper($tp.'input' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_input); | |||||||||||||||||||||||||||||||
| 40 | 14 | $app->helper($tp.'navbar' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_navbar); | |||||||||||||||||||||||||||||||
| 41 | 14 | $app->helper($tp.'nav' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_nav); | |||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 14 | ▶ | if(exists $args->{'icons'}{'class'} && $args->{'icons'}{'formatter'}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $args->{"icons"}{"class"} and $args->{"icons"}{"formatter"}
MC/DC0%0/2
exists $args->{"icons"}{"class"} and $args->{"icons"}{"formatter"}
exists $args->{"icons"}{"class"}
$args->{"icons"}{"formatter"}
Truth table33%1/3
A and B
A= exists $args->{"icons"}{"class"}B= $args->{"icons"}{"formatter"}
| |||||||||||||||||||||||||||||||||
| 44 | 14 | $app->config->{'Plugin::BootstrapHelpers'} = $args; | |||||||||||||||||||||||||||||||
| 45 | 14 | $app->helper($tp.'icon' => \&Mojolicious::Plugin::BootstrapHelpers::Helpers::bootstrap_icon); | |||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | 14 | ▶ | if($init_shortcuts) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 49 | 14 | my @sizes = qw/xsmall small medium large/; | |||||||||||||||||||||||||||||||
| 50 | 14 | my @contexts = qw/default active primary success info warning danger/; | |||||||||||||||||||||||||||||||
| 51 | 14 | my @table = qw/striped bordered hover condensed responsive/; | |||||||||||||||||||||||||||||||
| 52 | 14 | my @direction = qw/right left block vertical justified dropup/; | |||||||||||||||||||||||||||||||
| 53 | 14 | my @menu = qw/caret hamburger/; | |||||||||||||||||||||||||||||||
| 54 | 14 | my @misc = qw/disabled inverse/; | |||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 14 | foreach my $helper (@sizes, @contexts, @table, @direction, @menu, @misc) { | |||||||||||||||||||||||||||||||
| 57 | 364 | ▶ | $app->helper($ssp.$helper, sub { ("__$helper" => 1) }); | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 28 | ▶ | sub setup_prefix($prefix) { | ||||||||||||||||||||||||||||||
|
Subroutine
setup_prefix: called CC=4 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 63 | 28 | ▶ | return defined $prefix && !length $prefix ? '_' | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
defined $prefix and not length $prefix
MC/DC0%0/2
defined $prefix and not length $prefix
defined $prefix
not length $prefix
Truth table33%1/3
A and not(B)
A= defined $prefixB= not length $prefix
| |||||||||||||||||||||||||||||||||
| 64 | : defined $prefix ? $prefix | ||||||||||||||||||||||||||||||||
| 65 | : '' | ||||||||||||||||||||||||||||||||
| 66 | ; | ||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | 15 | 1; | |||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | __END__ | ||||||||||||||||||||||||||||||||