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