Commit 9ed7cf94 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Revisited the helpers and documentation

parent 3fd1d168
......@@ -14,12 +14,49 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <>.
=encoding utf8
=head1 NAME
Mojolicious::Plugin::AWIT::FontAwesome - FontAwesome fonts and helpers
# Mojolicious
# Mojolicious::Lite
plugin 'Mojolicious::Plugin::AWIT::FontAwesome';
L<Mojolicious::Plugin::AWIT::FontAwesome> is a L<Mojolicious> plugin.
package Mojolicious::Plugin::AWIT::FontAwesome;
use Mojo::Base 'Mojolicious::Plugin';
our $VERSION = '5.6.3';
=head1 METHODS
L<Mojolicious::Plugin::AWIT::FontAwesome> inherits all methods from
L<Mojolicious::Plugin> and implements the following new ones.
=head2 register
Register plugin in L<Mojolicious> application.
sub register
......@@ -28,17 +65,88 @@ sub register
# Load helpers
$app->helper(stylesheet_fontawesome => sub {
my $self = shift;
# Fake the call
$app->helper('stylesheet_fontawesome' => \&_stylesheet_fontawesome);
$app->helper('icon_fontawesome' => \&_icon);
return 1;
=head1 HELPERS
The below helpers are implemented.
=head2 stylesheet_fontawesome
Return the stylesheet for FontAwesome.
sub _stylesheet_fontawesome {
my $self = shift;
return Mojolicious::Plugin::TagHelpers::_stylesheet($self,"/static/fontawesome/css/all.min.css");
=head2 icon_fontawesome
Return a list of available helpers.
# Create a nice icon
sub _icon {
my ($self, $icon, @params) = @_;
my $cb = ref $params[-1] eq 'CODE' ? pop(@params) : undef;
my %attrs = @params;
# Add form-group class
if (defined($attrs{'class'})) {
$attrs{'class'} .= " fas fa-fw $icon";
} else {
$attrs{'class'} = "fas fa-fw $icon";
return Mojolicious::Plugin::TagHelpers::_tag('i', %attrs, $cb);
=head1 AUTHORS
Nigel Kukard E<lt>nkukard@lbsd.netE<gt>
=head1 BUGS
All bugs should be reported via the project issue tracker
Copyright (C) 2014-2019, AllWorldIT
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<>.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment