Jifty::Plugin::Prototypism - Provide Prototype and Scriptaculous js libraries


Jifty documentation Contained in the Jifty distribution.

Index


Code Index:

NAME

Top

Jifty::Plugin::Prototypism - Provide Prototype and Scriptaculous js libraries

SYNOPSIS

Top

# In your jifty config.yml under the framework section:

  Plugins:
    - Prototypism
        cdn: 'http://yourcdn.for.static.prefix/'

DESCRIPTION

Top

This module provides the Prototype and Scriptaculous javascript libraries to your application. Jifty used to rely on these libraries, so this plugin may be automatically added to your application's plugins if you upgrade from an older version of Jifty. It is safe to remove if your application does not use Prototype or Scriptaculous javascript code, however.

METHODS

Top

init

On initialization, adds Jifty compatibility methods if the configuration file version is before 4.


Jifty documentation Contained in the Jifty distribution.
use strict;
use warnings;

package Jifty::Plugin::Prototypism;
use base 'Jifty::Plugin';

__PACKAGE__->mk_accessors(qw(cdn));

sub init {
    my $self = shift;
    return if $self->_pre_init;

    my %opt  = @_;
    $self->cdn( $opt{ cdn } || '' );
    my @js = qw(
        prototype
        scriptaculous/builder
        scriptaculous/effects
        scriptaculous/controls
    );

    push @js, 'jifty_compatible' if Jifty->config->framework('ConfigFileVersion') < 4;
    Jifty->web->add_javascript( "prototypism/$_.js" ) for @js;

}

1;