File Coverage

blib/lib/HTML/FormHandler/Widget/Theme/Bootstrap3.pm
Criterion Covered Total %
statement 4 5 80.0
branch n/a
condition n/a
subroutine 2 3 66.6
pod 0 2 0.0
total 6 10 60.0


line stmt bran cond sub pod time code
1             package HTML::FormHandler::Widget::Theme::Bootstrap3;
2             # ABSTRACT: sample Bootstrap3 theme
3             $HTML::FormHandler::Widget::Theme::Bootstrap3::VERSION = '0.40068';
4              
5 2     2   3747 use Moose::Role;
  2         5  
  2         20  
6             with 'HTML::FormHandler::Widget::Theme::BootstrapFormMessages';
7              
8             after 'before_build' => sub {
9             my $self = shift;
10             $self->set_widget_wrapper('Bootstrap3')
11             if $self->widget_wrapper eq 'Simple';
12             };
13              
14 2     2 0 1292 sub build_form_element_class { ['form-horizontal'] }
15              
16 0     0 0   sub form_messages_alert_error_class { 'alert-danger' }
17              
18             1;
19              
20             __END__
21              
22             =pod
23              
24             =encoding UTF-8
25              
26             =head1 NAME
27              
28             HTML::FormHandler::Widget::Theme::Bootstrap3 - sample Bootstrap3 theme
29              
30             =head1 VERSION
31              
32             version 0.40068
33              
34             =head1 SYNOPSIS
35              
36             Also see L<HTML::FormHandler::Manual::Rendering>.
37              
38             Sample Bootstrap3 theme role. Can be applied to your subclass of HTML::FormHandler.
39             Sets the widget wrapper to 'Bootstrap3' and renders form messages using Bootstrap3
40             formatting and classes.
41              
42             There is an example app using Bootstrap3 at http://github.com/gshank/formhandler-example.
43              
44             This is a lightweight example of what you could do in your own custom
45             Bootstrap3 theme. The heavy lifting is done by the Bootstrap3 wrapper,
46             L<HTML::FormHandler::Widget::Wrapper::Bootstrap3>,
47             which you can use by itself in your form with:
48              
49             has '+widget_wrapper' => ( default => 'Bootstrap3' );
50              
51             It also uses L<HTML::FormHandler::Widget::Theme::BootstrapFormMessages>
52             to render the form messages in a Bootstrap style:
53              
54             <div class="alert alert-danger">
55             <span class="error_message">....</span>
56             </div>
57              
58             By default this does 'form-horizontal' with 'build_form_element_class'.
59             Implement your own sub to use 'form-vertical':
60              
61             sub build_form_element_class { ['form-vertical'] }
62              
63             =head1 AUTHOR
64              
65             FormHandler Contributors - see HTML::FormHandler
66              
67             =head1 COPYRIGHT AND LICENSE
68              
69             This software is copyright (c) 2017 by Gerda Shank.
70              
71             This is free software; you can redistribute it and/or modify it under
72             the same terms as the Perl 5 programming language system itself.
73              
74             =cut