| 1 | package JavaScript::Framework::jQuery::Plugin::mcDropdown; | ||||||||||
| 2 | |||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 8 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 8 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 8 | with 'JavaScript::Framework::jQuery::Role::Plugin'; | |||||||||
| 8 | 8 | ▶ | use MooseX::Types::Moose qw( Str ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 8 | our $VERSION = '0.05'; | |||||||||
| 11 | |||||||||||
| 12 | 8 | has 'source_ul' => ( | |||||||||
| 13 | is => 'ro', | ||||||||||
| 14 | isa => Str, | ||||||||||
| 15 | required => 1, | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | 8 | has 'options' => ( | |||||||||
| 19 | is => 'ro', | ||||||||||
| 20 | isa => Str, | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | 8 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | |||||||||||
| 25 | =head1 NAME | ||||||||||
| 26 | |||||||||||
| 27 | JavaScript::Framework::jQuery::Plugin::mcDropdown - Support for jQuery mcDropdown plugin | ||||||||||
| 28 | |||||||||||
| 29 | =head1 SYNOPSIS | ||||||||||
| 30 | |||||||||||
| 31 | my $plugin = JavaScript::Framework::jQuery::Plugin::mcDropdown->new( | ||||||||||
| 32 | target_selector => '#inputid', | ||||||||||
| 33 | source_ul => '#ulid', | ||||||||||
| 34 | options => | ||||||||||
| 35 | 'minRows : 12, | ||||||||||
| 36 | openSpeed : 500', | ||||||||||
| 37 | } | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | print $plugin->cons_statement; | ||||||||||
| 41 | |||||||||||
| 42 | # $("#inputid").mcDropdown("#ulid"); | ||||||||||
| 43 | |||||||||||
| 44 | =head1 DESCRIPTION | ||||||||||
| 45 | |||||||||||
| 46 | This module implements the interface required to generate a jQuery constructor for | ||||||||||
| 47 | the mcDropdown jQuery plugin (see :L<http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm>). | ||||||||||
| 48 | |||||||||||
| 49 | =cut | ||||||||||
| 50 | |||||||||||
| 51 | =head1 METHODS | ||||||||||
| 52 | |||||||||||
| 53 | =cut | ||||||||||
| 54 | |||||||||||
| 55 | =head2 cons_statement( ) | ||||||||||
| 56 | |||||||||||
| 57 | Return the text of the JavaScript statement that invokes the mcDropdown constructor. | ||||||||||
| 58 | |||||||||||
| 59 | =cut | ||||||||||
| 60 | |||||||||||
| 61 | 9 | ▶ | sub cons_statement { | ||||||||
|
Subroutine
cons_statement: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 62 | 9 | my ( $self ) = @_; | |||||||||
| 63 | |||||||||||
| 64 | 9 | my @arg = $self->target_selector; | |||||||||
| 65 | 9 | my @opt = '"' . $self->source_ul . '"'; | |||||||||
| 66 | 9 | ▶ | if (my $options = $self->options) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 67 | 1 | $options = join "\n" => '{', $options, '}'; | |||||||||
| 68 | 1 | push @opt, $options; | |||||||||
| 69 | } | ||||||||||
| 70 | 9 | push @arg, ['mcDropdown', [ @opt ]]; | |||||||||
| 71 | |||||||||||
| 72 | 9 | return $self->mk_jQuery_method_call(@arg); | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 8 | 1; | |||||||||
| 76 | |||||||||||
| 77 | __END__ | ||||||||||