NAME
Mojolicious::Plugin::BootstrapHelpers - Type less bootstrap
SYNOPSIS
# Mojolicious
$self->plugin('BootstrapHelpers');
# ::Lite
plugin 'BootstrapHelpers';
STATUS
This is an unstable work in progress. Backwards compatibility is
currently not to be expected between releases.
Currently supported Bootstrap version: 3.2.0.
Only Perl 5.20+ is supported (thanks to postderef). This might change.
DESCRIPTION
Mojolicious::Plugin::BootstrapHelpers is a convenience plugin that
reduces some bootstrap complexity by introducing several tag helpers
specifically for Bootstrap 3 .
The goal is not to have tag helpers for everything, but for common use
cases.
All examples below (and more, see tests) currently works.
Panels
Bootstrap documentation
No body, no title
%= bs_panel
Body, no title
%= bs_panel undef ,=> begin
A short text.
% end
A short text.
Body and title
%= bs_panel 'The header' => begin
A short text.
% end
The Header
A short text.
Body and title, with context
%= bs_panel 'Panel 5', success => 1 => begin
A short text.
% end
Panel 5
A short text.
Form groups
Bootstrap documentation
Basic form group
%= bs_formgroup 'Text test 1', text_field => ['test_text']
The first item in the array ref is used for both "id" and "name".
Input group (before), and large input field
%= bs_formgroup 'Text test 4', text_field => ['test_text', append => '.00', large => 1]
.00
Input group (before and after), and with value
%= bs_formgroup 'Text test 5', text_field => ['test_text', '200', prepend => '$', append => '.00']
$.00
The (optional) second item in the array ref is the value, if any, that
should populate the input tag.
Large input group
%= bs_formgroup 'Text test 6', text_field => ['test_text'], large => 1
Note the difference with the earlier example. Here "large => 1" is
outside the "text_field" array ref, and therefore is applied to the form
group.
Horizontal form groups
%= bs_formgroup 'Text test 8', text_field => ['test_text'], cols => { medium => [2, 10], small => [4, 8] }
If the "form" has the "form-horizontal" class, you can set the column
widths with the "cols" attribute. The first item in each array ref is
for the label, and the second for the input.
AUTHOR
Erik Carlsson
COPYRIGHT
Copyright 2014- Erik Carlsson
LICENSE
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO