Forum: Rails Engines [ANN] Dojo Toolbocks - v1.0.0 (Ruby on Rails Plugin)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nshbrown N. (Guest)
on 2007-03-17 05:51
(Received via mailing list)
In true engine style, here is a new alternative to the default
javascript libraries that come with Rails. Dojo, the massively
successful and huge repository of established widgets most with
internationalization libraries integrated within now has a golden
pathway into the world of Ruby on Rails.

Here is content from the README, which will give you an idea what's
included, and even see a few links to the repositories and demos if
you haven't seen any of the Dojo Toolkit before.

Nathaniel.

= 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.

http://dojo.toolbocks.com

==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
<head> 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
<head> tag. See ==Usage for examples.


==Usage

Here is the full rhtml template for using the Dojo
Toolbocks::Slideshow, with debugging enabled.

       <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
               "http://www.w3.org/TR/html4/strict.dtd">
       <html>
               <head>
                       <title>Dojo Toolbocks: Slideshow Demo</title>
                       <%= dojo_config(:debug => true) %>
                       <%= javascript_include_tag 'dojo', :plugin =>
'dojo_toolbocks' %>
                       <%= dojo_require ({:script_tag => true},
"dojo.widget.*",
"dojo.widget.SlideShow") %>
               </head>
               <body>
                       <img dojoType="SlideShow"
                               imgUrls="<%= (1..6).map { |n|
image_path("demos/widget/slideshow/#{n}.jpg", :plugin =>
"dojo_toolbocks") }.join(';') %>"
                               transitionInterval="700"
                               delay="7000"
                               src="<%=
image_path('demos/widget/slideshow/1.jpg', :plugin =>
'dojo_toolbocks') %>"
                               imgWidth="400" imgHeight="300" />
               </body>
       </html>

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

==Demo

http://dojo.toolbocks.com


--
Nathaniel Steven Henry Brown

Toll Free: 1-877-446-4647
Vancouver: 604-724-6624
This topic is locked and can not be replied to.