The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Jifty::Plugin::YouTube - YouTube Plugin

SYNOPSIS

To use YouTube plugin, insert the below config to your etc/config.yml

Plugins:
  - YouTube: {}

You can write render_as 'Jifty::Plugin::YouTube::Widget' in your model schema:

column url =>
    type is 'varchar',
    render_as 'Jifty::Plugin::YouTube::Widget';

then render the action:

my $foo = Jifty->web->new_action(
    class     => 'UpdateFoo',
    moniker   => "update-foo",
    record    => $record->id,
);
render_action( $foo => ['url'] );

If the column contains a youtube url or a hash code, then the video will be rendered.

Or you can just display a Youtube Widget in Template::Declare:

template 'index.html' => page {

    show '/youtube_widget','http://www.youtube.com/watch?v=4oWbzT_oAJ0';

    # or 

    show '/youtube_widget','4oWbzT_oAJ0';

};

Or by given url:

http://your.app/youtube/4oWbzT_oAJ0

You can override the page wrapper by declaring a template called /_youtube

template '/_youtube' => page {
    my $self = shift;
    my $hash = get('hash');

    return unless( $hash ) ;

    h1 { { id is 'banner' };
        _('Your Page Wrapper');
    };

    div { { class is 'youtube-wrapper' };
        show '/youtube_widget', $hash;
    };

};

DESCRIPTION

AUTHOR

Cornelius <cornelius.howl@gmail.com>