= Dojo_Toolbocks
The Dojo Toolbocks is a superstar plugin (engine) that provides the functionality to include any of the Dojo Toolkit libraries into your Ruby on Rails application.
==Dependencies
The dependencies are automatically loaded into your application.
For reference they are:
- Dojo Toolkit v0.4
- Engines v1.2
- Rails v1.2.x
==Installation
1. script/plugin install dojo_toolbocks
a) If you don't already have engines installed and configured, then you will need to modify the /config/environment.rb file. After the "Rails::Initializer.run" add the following line:
config.plugins = ["engines", "*"]
2. Add the following line to the main template (/app/views/layouts/application.rhtml) between the opening and closing
tags. Alternatively, you can add it to each individual template as needed.
<%= javascript_include_tag 'dojo', :plugin => 'dojo_toolbocks' %>
3. Depending on what libraries you need for the functionality you desire, you can use the _dojo_require_ method either as a tag, or as a block as shown in a) and b). This method is to be called within the tag. See ==Usage for examples.
==Usage
Here is the full rhtml template for using the Dojo Toolbocks::Slideshow, with debugging enabled.
Dojo Toolbocks: Slideshow Demo
<%= dojo_config(:debug => true) %>
<%= javascript_include_tag 'dojo', :plugin => 'dojo_toolbocks' %>
<%= dojo_require ({:script_tag => true}, "dojo.widget.*", "dojo.widget.SlideShow") %>
"dojo_toolbocks") }.join(';') %>"
transitionInterval="700"
delay="7000"
src="<%= image_path('demos/widget/slideshow/1.jpg', :plugin => 'dojo_toolbocks') %>"
imgWidth="400" imgHeight="300" />
a) Debugging
<%= dojo_config(:debug => true) %>
b) Library Inclusion: Tag Style
<%= dojo_require ({:script_tag => true}, "dojo.widget.*", "dojo.lang.*") %>
c) Library Inclusion: Block Style
<% dojo_require ({:script_tag => true}, "dojo.widget.*", "dojo.lang.*") do %>
function somethingUseful(todo) {
// this method does something useful, and is wrapped in the same script tag as the library includes
}
<% end %>
==Bugs
Please report any bugs or feature enhancements to http://dev.toolbocks.com
==Author
Nathaniel Brown
email: nshb@inimit.com
blog: http://nshb.net
==License
Copyright (c) 2007 Nathaniel Brown
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.