NAME

Sledge::Plugin::Prototype - HTML::Prototype wrapper


DOWNLOAD


SYNOPSIS

  package Foo::Pages::Bar;
  use Sledge::Plugin::Prototype; # just use
  # you can use parameter 'prototype' if template engine is tt
  [% prototype.define_javascript_functions %]
  # or in your dispatcher
  sub dispatch_prototype_js {
    shift->show_prototype_js;
  }
 
  # use the helper methods
  <div id="view"></div>
  <textarea id="editor" cols="80" rows="24"></textarea>
  [% prototype.observe_field( 'editor', 'http://foo.bar/baz', { 'update' => 'view' } ) %]


DESCRIPTION

Sledge::Plugin::Prototype はHTML::Prototypeのwrapperです。 Sledge::Plugin::PrototypeuseすることでPagesクラスにprototypeメソッドと、 show_prototype_jsメソッドを追加します。 テンプレートエンジンにSledge::Template::TTを利用している場合、 テンプレートのパラメータにprototypeをセットします。 dispatchでshow_prototype_jsを使用すると、HTML::Prototypeの使うprototype.jsのJavaScript ソースをcontent-type:text/javascriptで出力します。


AUTHOR

Yasuhiro Horiuchi <horiuchi@vcube.com>


SEE ALSO

the HTML::Prototype manpage