Slovo::Plugin::TagHelpers - additional and advanced tag helpers
<%= select_box page_type => [map {[$_=>$_]}], @$page_types] required => 1, label => 'Page type' %>
Slovo::Plugin::TagHelpers extends Mojolicious::Plugin::TagHelpers and implements some additional helpers. Slovo::Plugin::DefaultHelpers and Slovo::Plugin::TagHelpers are loaded unconditionally after all other mandatory for Slovo plugins.
The following helpers are currently implemented.
<% my $groups = [ [berov => 1, disabled => undef], [admin => 2], [foo => 3] ]; %> <%= checkboxes(groups => $groups, label =>'Множества') %> <div class="mui-textfield groups"> <label for="groups">Множества</label> <div class="mui-checkbox"> <label><input disabled name="groups" type="checkbox" value="1"> berov</label> <label><input name="groups" type="checkbox" value="2"> admin</label> <label><input name="groups" type="checkbox" value="3"> foo</label> </div> </div>
Generates a group of checkboxes with same name wrapped with a div tag with class mui-textfield $name. If label attribute is not provided, a label is derived from the $name. Suitable for fields with multiple values.
mui-textfield $name
label
$name
%= html_substr($writing->{teaser}//$writing->{body}, 'p,blockquote', 225);
Parameters: $c, $html, $selector, $chars
$c, $html, $selector, $chars
Get all_text for each $selector from $html and does substr on the last so the total characters in the produced output are not more than $chars. Starts from the first character in the first matched $selector. In case the $html is simple text, produces <p> elements.
all_text
$selector
$html
$chars
<p>
<%= select_box published => [['for (p)review' => 1], ['no' => 0], ['Yes' => 2]], value => 2, label => 'Published'; %> <%= select_box colors => [(white green red blue yellow)], value => [qw(white green)], label => 'Favorite colors' multiple => undef %>
This is a wrapper for "select_field" in Mojolicious::Plugin::TagHelpers with additional optional attributes label and value. If label is not provided, the name of the field is used as label. If value is not provided, it is retreived from input $c->every_param($name) by the wrapped select_field. If value is provided it does $c->param($name => $attrs{value}). The generated tags are wrapped in a div tag with class="mui-select $name".
value
$c->every_param($name)
select_field
$c->param($name => $attrs{value})
div
class="mui-select $name"
The usual method is implemented.
Calls the parent's register if needed and registers additional helpers in Slovo application.
Mojolicious::Plugin::TagHelpers, Slovo::Plugin::DefaultHelpers
To install Slovo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Slovo
CPAN shell
perl -MCPAN -e shell install Slovo
For more information on module installation, please visit the detailed CPAN module installation guide.