| 1 | package HTML::FormHandler::Widget::Theme::Bootstrap3; | ||||||||||
| 2 | # ABSTRACT: sample Bootstrap3 theme | ||||||||||
| 3 | 2 | $HTML::FormHandler::Widget::Theme::Bootstrap3::VERSION = '0.410001'; | |||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | with 'HTML::FormHandler::Widget::Theme::BootstrapFormMessages'; | |||||||||
| 7 | |||||||||||
| 8 | after 'before_build' => sub { | ||||||||||
| 9 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 10 | 2 | ▶ | $self->set_widget_wrapper('Bootstrap3') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | if $self->widget_wrapper eq 'Simple'; | ||||||||||
| 12 | 2 | }; | |||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | sub build_form_element_class { ['form-horizontal'] } | ||||||||
|
Subroutine
build_form_element_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | |||||||||||
| 16 | 0 | ▶ | sub form_messages_alert_error_class { 'alert-danger' } | ||||||||
|
Subroutine
form_messages_alert_error_class: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 17 | |||||||||||
| 18 | 2 | 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.410001 | ||||||||||
| 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 | ||||||||||