| 1 | package Perl::Achievements::Report::Html; | ||||||||||
| 2 | 1 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | $Perl::Achievements::Report::Html::AUTHORITY = 'cpan:YANICK'; | |||||||||
| 4 | } | ||||||||||
| 5 | { | ||||||||||
| 6 | $Perl::Achievements::Report::Html::VERSION = '0.4.0'; | ||||||||||
| 7 | } | ||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use 5.10.0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | ▶ | use Method::Signatures; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use Template::Caribou::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use Template::Caribou::Tags::HTML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | with qw/ Template::Caribou Perl::Achievements::Role::Report /; | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | method generate { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=4.1
Subroutine
generate: not called CC=2 SCAR=14.6
Branch: 1 branch
| |||||||||||
| 23 | 0 | return $self->render( 'page' ); | |||||||||
| 24 | }; | ||||||||||
| 25 | |||||||||||
| 26 | template page => sub { | ||||||||||
| 27 | my $self = shift; | ||||||||||
| 28 | |||||||||||
| 29 | my %latest; | ||||||||||
| 30 | |||||||||||
| 31 | for( @{ $self->history } ) { | ||||||||||
| 32 | $latest{$_->{achievement}} = $_; | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | html { | ||||||||||
| 36 | show( 'head' ); | ||||||||||
| 37 | body { | ||||||||||
| 38 | show( 'pa_signature' ); | ||||||||||
| 39 | |||||||||||
| 40 | h1 { | ||||||||||
| 41 | say $self->who, "'s " if $self->who; | ||||||||||
| 42 | say "Perl Achievements"; | ||||||||||
| 43 | }; | ||||||||||
| 44 | |||||||||||
| 45 | for ( values %latest ) { | ||||||||||
| 46 | div { | ||||||||||
| 47 | attr class => 'achievement'; | ||||||||||
| 48 | div { | ||||||||||
| 49 | attr class => 'short_title header'; | ||||||||||
| 50 | $_->{achievement} | ||||||||||
| 51 | }; | ||||||||||
| 52 | div { | ||||||||||
| 53 | attr class => 'level header'; | ||||||||||
| 54 | $_->{level} | ||||||||||
| 55 | } if $_->{level}; | ||||||||||
| 56 | div { | ||||||||||
| 57 | attr class => 'details'; | ||||||||||
| 58 | $_->{details} | ||||||||||
| 59 | } if $_->{details}; | ||||||||||
| 60 | } | ||||||||||
| 61 | } | ||||||||||
| 62 | }; | ||||||||||
| 63 | } | ||||||||||
| 64 | }; | ||||||||||
| 65 | |||||||||||
| 66 | #http://colorschemedesigner.com/#3O12.8tPkNQDa | ||||||||||
| 67 | #ACB9E1 | ||||||||||
| 68 | #747987 | ||||||||||
| 69 | #102564; | ||||||||||
| 70 | #CDD6F4 | ||||||||||
| 71 | #DBE1F4; | ||||||||||
| 72 | template head => sub { | ||||||||||
| 73 | head { | ||||||||||
| 74 | style { | ||||||||||
| 75 | <<'EOT'; | ||||||||||
| 76 | body { | ||||||||||
| 77 | font-family: Arial, 'sans'; | ||||||||||
| 78 | width: 800px; | ||||||||||
| 79 | margin: 0 auto; | ||||||||||
| 80 | background: #102564; | ||||||||||
| 81 | color: white; | ||||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | h1 { | ||||||||||
| 85 | text-align: center; | ||||||||||
| 86 | } | ||||||||||
| 87 | |||||||||||
| 88 | .pa_signature { | ||||||||||
| 89 | position: absolute; | ||||||||||
| 90 | right: 5px; | ||||||||||
| 91 | top: 5px; | ||||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | a:visited { color: white; } | ||||||||||
| 95 | |||||||||||
| 96 | .achievement { | ||||||||||
| 97 | margin-bottom: 10px; | ||||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | .achievement div.header { | ||||||||||
| 101 | font-size: 16pt; | ||||||||||
| 102 | border-radius: 10px 10px 0px 0px; | ||||||||||
| 103 | border-color: #747987; | ||||||||||
| 104 | padding: 4px 10px; | ||||||||||
| 105 | display: inline-block; | ||||||||||
| 106 | background: #747987; | ||||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | div.level { | ||||||||||
| 110 | float: right; | ||||||||||
| 111 | } | ||||||||||
| 112 | div.level:before { content: "level " } | ||||||||||
| 113 | |||||||||||
| 114 | div.details { | ||||||||||
| 115 | background-color: #747987; | ||||||||||
| 116 | border-color: 1px #747987 solid; | ||||||||||
| 117 | border-radius: 0px 0px 10px 10px; | ||||||||||
| 118 | padding: 10px; | ||||||||||
| 119 | font-style: italic; | ||||||||||
| 120 | } | ||||||||||
| 121 | EOT | ||||||||||
| 122 | } | ||||||||||
| 123 | }; | ||||||||||
| 124 | }; | ||||||||||
| 125 | |||||||||||
| 126 | template 'pa_signature' => sub { | ||||||||||
| 127 | div { | ||||||||||
| 128 | attr class => 'pa_signature'; | ||||||||||
| 129 | say ::RAW <<'END'; | ||||||||||
| 130 | generated by <a href='https://metacpan.org/release/Perl-Achievements' | ||||||||||
| 131 | >Perl::Achievements</a> | ||||||||||
| 132 | END | ||||||||||
| 133 | } | ||||||||||
| 134 | }; | ||||||||||
| 135 | |||||||||||
| 136 | 1; | ||||||||||
| 137 | |||||||||||
| 138 | __END__ | ||||||||||