| 1 | package JavaScript::Framework::jQuery::Plugin::FilamentGrpMenu; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | with 'JavaScript::Framework::jQuery::Role::Plugin'; | |||||||||
| 8 | 1 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use MooseX::Types::Moose qw( Str ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = '0.05'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | has 'content_from' => ( | |||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | isa => Str, | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 1 | has 'options' => ( | |||||||||
| 20 | is => 'ro', | ||||||||||
| 21 | isa => Str, | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | =head1 NAME | ||||||||||
| 27 | |||||||||||
| 28 | JavaScript::Framework::jQuery::Plugin::FilamentGrpMenu - Support for Filament Group jQuery menu plugin | ||||||||||
| 29 | |||||||||||
| 30 | =head1 SYNOPSIS | ||||||||||
| 31 | |||||||||||
| 32 | my $plugin = JavaScript::Framework::jQuery::Plugin::FilamentGroupMenu->new( | ||||||||||
| 33 | target_selector => '#menu-items', | ||||||||||
| 34 | content => '$("#menu-items").html()', | ||||||||||
| 35 | options => | ||||||||||
| 36 | 'posX : "left", | ||||||||||
| 37 | posY : "bottom", | ||||||||||
| 38 | directionV : "down", | ||||||||||
| 39 | showSpeed : 200, | ||||||||||
| 40 | backLink : "false"' | ||||||||||
| 41 | ); | ||||||||||
| 42 | |||||||||||
| 43 | print $plugin->cons_statement; | ||||||||||
| 44 | |||||||||||
| 45 | # $('#menu-items').menu({ | ||||||||||
| 46 | # content: $("#menu-items").html(), | ||||||||||
| 47 | # posX: "left", | ||||||||||
| 48 | # posY: "bottom", | ||||||||||
| 49 | # directionV: "down", | ||||||||||
| 50 | # showSpeed: 200, | ||||||||||
| 51 | # backLink: false | ||||||||||
| 52 | # }); | ||||||||||
| 53 | |||||||||||
| 54 | =head1 DESCRIPTION | ||||||||||
| 55 | |||||||||||
| 56 | This module implements the interface required to generate a jQuery constructor for | ||||||||||
| 57 | the Filament Group jQuery menu plugin. | ||||||||||
| 58 | |||||||||||
| 59 | L<http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/> | ||||||||||
| 60 | |||||||||||
| 61 | =cut | ||||||||||
| 62 | |||||||||||
| 63 | =head1 CONSTRUCTOR PARAMETERS | ||||||||||
| 64 | |||||||||||
| 65 | The C<new> constructor, provided automatically by Moose (in case you're looking for it and | ||||||||||
| 66 | can't find it) is called from &JavaScript::Framework::jQuery::construct_plugin. The | ||||||||||
| 67 | arguments passed to this subroutine are validated by this module. | ||||||||||
| 68 | |||||||||||
| 69 | =head2 content_from | ||||||||||
| 70 | |||||||||||
| 71 | Required | ||||||||||
| 72 | |||||||||||
| 73 | A string representing a jQuery selector expression. | ||||||||||
| 74 | |||||||||||
| 75 | =head2 options | ||||||||||
| 76 | |||||||||||
| 77 | A string representing a JavaScript object literal. | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | =head2 cons_statement( ) | ||||||||||
| 82 | |||||||||||
| 83 | Return the text of the JavaScript statement that invokes the jQuery plugin constructor. | ||||||||||
| 84 | |||||||||||
| 85 | =cut | ||||||||||
| 86 | |||||||||||
| 87 | 2 | ▶ | sub cons_statement { | ||||||||
|
Subroutine
cons_statement: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 88 | 2 | my ( $self ) = @_; | |||||||||
| 89 | |||||||||||
| 90 | 2 | my @arg = $self->target_selector; | |||||||||
| 91 | |||||||||||
| 92 | 2 | my $options = 'content : ' . $self->content_from; | |||||||||
| 93 | 2 | ▶ | if (my $opts = $self->options) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 94 | 1 | $options = join ",\n" => $options, $opts; | |||||||||
| 95 | } | ||||||||||
| 96 | 2 | $options = join "\n" => '{', $options, '}'; | |||||||||
| 97 | |||||||||||
| 98 | 2 | push @arg, ['menu', [ $options ]]; | |||||||||
| 99 | |||||||||||
| 100 | 2 | return $self->mk_jQuery_method_call(@arg); | |||||||||
| 101 | } | ||||||||||
| 102 | |||||||||||
| 103 | 1 | 1; | |||||||||
| 104 | |||||||||||
| 105 | __END__ | ||||||||||