Dancer2-Plugin-Menu

 view release on metacpan or  search on metacpan

lib/Dancer2/Plugin/Menu.pm  view on Meta::CPAN

The module is in early development stages and currently has few options. It has
not been heavily tested and there are likely bugs especially with dynamic paths
which are completely untested at this time. The module should work and be
adequate for simple menu structures, however.

=head2 KEYWORDS

=head3 menu_item( { [title => $str], [weight => $num] }, C<ROUTE METHOD> C<REGEXP>, C<CODE>)

Wraps a conventional route handler preceded by a required hash reference
containing data that will be applied to the route's endpoint.

Two keys can be supplied in the hash reference: a C<title> for the menu item and
a C<weight>. The C<title> will be used as the content for the menu items. The
C<weight> will determine the order of the menu items. Heavier items (with larger
values) will "sink" to the bottom compared to sibling menu items. If two sibling
menu items have the same weight, the menu items will be ordered alphabetically.

Menu items that are not endpoints in the route or that don't have a C<title>,
will automatically generate a title according to the path segment's name. For
example, the route C</categories/fun food/desserts> is converted to a hierarchy
of menu items entitled C<Categories>, C<Fun food>, and C<Desserts>. Note that
capitalization is automatically added.  Automatic titles will be overridden with
endpoint specific titles if they are supplied in a later C<menu_item> call.

If the C<weight> is not supplied it will default to a value of C<5>.

=head1 CONFIGURATION

Add a C<E<lt>% menu %E<gt>> tag in the appropriate location within your Dancer2
template files. If desired, add css for C<E<lt>liE<gt>> tags in the C<active>
class.

=head1 REQUIRES

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.219 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )