File Coverage

blib/lib/Rest/HtmlVis/Base.pm
Criterion Covered Total %
statement 12 27 44.4
branch 0 2 0.0
condition n/a
subroutine 4 9 44.4
pod 5 5 100.0
total 21 43 48.8


line stmt bran cond sub pod time code
1             package Rest::HtmlVis::Base;
2              
3 1     1   660 use 5.006;
  1         2  
  1         33  
4 1     1   3 use strict;
  1         1  
  1         26  
5 1     1   3 use warnings FATAL => 'all';
  1         1  
  1         32  
6              
7 1     1   523 use parent qw( Rest::HtmlVis::Key );
  1         257  
  1         4  
8              
9             =head1 NAME
10              
11             Rest::HtmlVis::Base - Return base struct of rest html (menu, styles etc.)
12              
13             =head1 VERSION
14              
15             Version 0.01
16              
17             =cut
18              
19             our $VERSION = '0.01';
20              
21             sub setStruct {
22 0     0 1   my ($self, $key, $struct, $env) = @_;
23 0           $self->{struct} = $struct;
24 0           $self->{env} = $env;
25 0           return 1;
26             }
27              
28             sub getOrder {
29 0     0 1   return 0;
30             }
31              
32             sub blocks {
33 0     0 1   return 0;
34             }
35              
36             my $style =
37             ' body {
38             padding: 0px;
39             margin: 0px;
40             font: 14px/1 Helvetica, Verdana, sans-serif;
41             }
42              
43             /* Bootstrap */
44             .row {
45             margin: 10px 0px 0px 0px;
46             }
47              
48             .form-control {
49             margin-bottom: 4px;
50             }
51              
52             /* Header styles */
53             .header {
54             background-color: #eee;
55             display: inline-block;
56             width: 100%;
57             min-height: 38px;
58             padding: 6px 0px 5px 0px;
59             border: 1px solid #ddd
60             }
61              
62             /* Header title style */
63             .header .title {
64             margin: 9px;
65             display:inline;
66             text-decoration: none;
67             color: #aaa;
68             font-size: 24px;
69             }
70              
71             .title .project {
72             color: #ccc;
73             }
74              
75             /* Format styles */
76             .format {
77             float:right;
78             list-style-type: none;
79             margin: 5px 10px 0px 0px;
80             padding: 0px;
81             }
82              
83             .format li {
84             float:left;
85             border-right: 1px solid #fff;
86             padding: 0px 7px 0px 7px;
87             }
88              
89             .format li:last-child {
90             border-right: none;
91             }
92              
93             .format li a {
94             margin-top: 1px;
95             text-decoration: none;
96             color: #ccc;
97             text-transform: uppercase;
98            
99             -webkit-transition: all 0.5s ease;
100             -moz-transition: all 0.5s ease;
101             -o-transition: all 0.5s ease;
102             -ms-transition: all 0.5s ease;
103             transition: all 0.5s ease;
104             }
105            
106             .format li a:hover {
107             color: #666;
108             }
109            
110             .format li.active a {
111             font-weight: bold;
112             color: #333;
113             }
114              
115             /* Links ul */
116             .links {
117             list-style-type: none;
118             margin: 5px 0px 0px 10px;
119             padding: 0px;
120             }
121              
122             .links li {
123             padding-bottom: 1px;
124             }
125              
126             .links li a {
127             margin-top: 1px;
128             text-decoration: none;
129             color: #23527c;
130            
131             -webkit-transition: all 0.5s ease;
132             -moz-transition: all 0.5s ease;
133             -o-transition: all 0.5s ease;
134             -ms-transition: all 0.5s ease;
135             transition: all 0.5s ease;
136             }
137            
138             .links li a:hover {
139             color: #666;
140             }
141            
142             .links li.active a {
143             font-weight: bold;
144             color: #333;
145             }
146              
147             .method-form {
148             margin: 7px 0px 5px 0px;
149             }
150              
151             .links span {
152             color: #aaa;
153             }
154              
155             /* pretty print */
156             pre.prettyprint {
157             padding: 10px;
158             border: 1px solid #ccc;
159             }
160              
161             .kwd {
162             color: #23527c;
163             }
164              
165             a {
166             color: #23527c;
167             }
168             ';
169              
170             sub head {
171 0     0 1   my ($self, $local) = @_;
172              
173             ### !!! if edit main.css edit also inline css in else branch
174              
175 0 0         if ($local){
176 0           return '
177            
178            
179            
182              
183            
184              
185            
186            
187            
188            
189             ';
190             }else{
191 0           return '
192            
193            
194            
197              
198            
199              
200            
201            
202             ';
203             }
204             }
205              
206             sub html {
207 0     0 1   my ($self) = @_;
208              
209 0           my $project = $self->getEnv->{'restapi.class'};
210 0           my $method = $self->getEnv->{REQUEST_METHOD};
211 0           my $path = $self->getEnv->{SCRIPT_NAME};
212              
213 0           "
214            
215            
216             $project:
217             $method
218             $path
219            
220            
221            
  • json
  • 222            
  • yaml
  • 223            
  • text
  • 224            
    225            
    226             "
    227             }
    228              
    229             =head1 AUTHOR
    230              
    231             Vaclav Dovrtel, C<< >>
    232              
    233             =head1 BUGS
    234              
    235             Please report any bugs or feature requests to github repository.
    236              
    237             =head1 ACKNOWLEDGEMENTS
    238              
    239             Inspired by L
    240              
    241             =head1 REPOSITORY
    242              
    243             L
    244              
    245             =head1 LICENSE AND COPYRIGHT
    246              
    247             Copyright 2015 Vaclav Dovrtel.
    248              
    249             This program is free software; you can redistribute it and/or modify it
    250             under the terms of either: the GNU General Public License as published
    251             by the Free Software Foundation; or the Artistic License.
    252              
    253             See L for more information.
    254              
    255             =cut
    256              
    257             1; # End of Rest::HtmlVis::Base