File Coverage

blib/lib/Tags/HTML/Login/Button.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package Tags::HTML::Login::Button;
2              
3 5     5   145402 use base qw(Tags::HTML);
  5         42  
  5         2498  
4 5     5   47458 use strict;
  5         12  
  5         96  
5 5     5   23 use warnings;
  5         10  
  5         127  
6              
7 5     5   27 use Class::Utils qw(set_params split_params);
  5         1851  
  5         214  
8 5     5   26 use Error::Pure qw(err);
  5         9  
  5         1771  
9              
10             our $VERSION = 0.03;
11              
12             # Constructor.
13             sub new {
14 9     9 1 8595 my ($class, @params) = @_;
15              
16             # Create object.
17 9         39 my ($object_params_ar, $other_params_ar) = split_params(
18             ['link', 'title'], @params);
19 9         280 my $self = $class->SUPER::new(@{$other_params_ar});
  9         52  
20              
21             # Login button link.
22 6         243 $self->{'link'} = 'login';
23              
24             # Login button title.
25 6         17 $self->{'title'} = 'LOGIN';
26              
27             # Process params.
28 6         11 set_params($self, @{$object_params_ar});
  6         26  
29              
30             # Object.
31 6         79 return $self;
32             }
33              
34             # Process 'Tags'.
35             sub _process {
36 2     2   23 my $self = shift;
37              
38             # Main content.
39             $self->{'tags'}->put(
40             ['a', 'class', 'outer'],
41              
42             ['b', 'div'],
43             ['a', 'class', 'login'],
44             ['b', 'a'],
45             ['a', 'href', $self->{'link'}],
46 2         21 ['d', $self->{'title'}],
47             ['e', 'a'],
48             ['e', 'div'],
49             );
50              
51 2         473 return;
52             }
53              
54             # Process 'CSS::Struct'.
55             sub _process_css {
56 1     1   31 my $self = shift;
57              
58 1         21 $self->{'css'}->put(
59             ['s', '.outer'],
60             ['d', 'position', 'fixed'],
61             ['d', 'top', '50%'],
62             ['d', 'left', '50%'],
63             ['d', 'transform', 'translate(-50%, -50%)'],
64             ['e'],
65              
66             ['s', '.login'],
67             ['d', 'text-align', 'center'],
68             ['e'],
69              
70             ['s', '.login a'],
71             ['d', 'text-decoration', 'none'],
72             ['d', 'background-image', 'linear-gradient(to bottom,#fff 0,#e0e0e0 100%)'],
73             ['d', 'background-repeat', 'repeat-x'],
74             ['d', 'border', '1px solid #adadad'],
75             ['d', 'border-radius', '4px'],
76             ['d', 'color', 'black'],
77             ['d', 'font-family', 'sans-serif!important'],
78             ['d', 'padding', '15px 40px'],
79             ['e'],
80              
81             ['s', '.login a:hover'],
82             ['d', 'background-color', '#e0e0e0'],
83             ['d', 'background-image', 'none'],
84             ['e'],
85             );
86              
87 1         605 return;
88             }
89              
90             1;
91              
92             __END__