Dojo Helpers Plugin

No Gravatar

This is a plugin that is design to assist in the usage of the dojo toolkit with your rails application. It is still very much in the works, so any recommendation are definitely welcome. It is designed to be used with Rails 2+ and Dojo 1.1.   The full dojo 1.1 library is included in the assets folder of the plugin.  Check out the readme for more details on usage.

Download:

dojo_helpers_plugin

View Helpers:

dojo_config(options = {})

  • Description: Inserts a script tag that sets the djConfig options.
  • Usage: <%= dojo_config(options) -%>
  • Example: <%= dojo_config(:isDebug => true, :parseOnLoad => true) -%>

dojo_include(options = {})

  • Description: Includes the core dojo and dijit library files, and optionally calls dojo_config.
  • Usage: <%= dojo_include(:path => ‘custom/path/to/dojo/dojo.js’, :djConfig => {})
  • Example: <%= dojo_include(:djConfig => {:isDebug => true, :parseOnLoad => true})
  • Note: will automatically call the dojo_config method if it’s passed a djConfig parameter.

dojo_require(options = {})

  • Description: Inserts a script that contains all of the dojo.require statements.
  • Usage: dojo_require(:dojo => {}, :dijit => {}, :dojox => {}, :options => {})
  • Example: <%= dojo_require( :dojo => ['parser'], :dijit => [ 'Tooltip', 'Dialog', 'form.Button', 'layout.ContentPane']) -%>

dojo_stylesheet_link_tag(options = {})

  • Description: Inserts links to the dojo, dijit and tundra theme stylesheets unless a different theme is specified.
  • Usage: <%= dojo_stylesheet_link_tag :theme => ‘dojo_theme_name’ -%>
  • Example: <%= dojo_stylesheet_link_tag :theme => ‘tundra’ -%>

inline_editor_field(object, method, dijit_options = {}, ajax_options = {}, tag_options = {})

  • Description: Inserts a span tag that becomes an editor when clicked. Similar to the scriptaculous in_place_editor, except it work with a larger variety of editor types.
  • Usage: <%= inline_editor_field(:object, :method, {:editor => ‘editor_type’, :editor_options => {}}) -%>
  • Example: <%= inline_editor_field(:address, :zipcode, {:editor_options => {:required => “true”, :invalidMessage => “‘Required’”}}) -%>
  • Default Editor: form.TextBox
  • Available Editors: form.NumberTextBox, form.DateTextBox, form.TimeTextBox, form.CurrencyTextBox, form.NumberSpinner, form.FilteringSelect, form.simpleTextarea
  • ajax_options: accepts the same ajax options as the link_to_remote helper
  • Note: This helper relies on the prototype js library so be sure to include it whenever using the inline editor field.

Controller Methods:

inline_editor_for(object, attribute, options = {})

  • Description: Creates a controller method that updates the specified attribute of an object.
  • Usage: inline_editor_for :object, :method
  • Example: inline_editor_for :post, :title

*And still more is on the way

Please leave a comment if there are any features or improvements you would like to see.

Tags: , , , , , , , ,

Related posts

One Response to “Dojo Helpers Plugin”

  1. [...] designed to make it easier to use the dojo toolkit javascript library with your rails application.http://thetacom.info/2008/04/14/dojo-helpers-plugin/Art &amp Design LibraryHouses collections which focus upon the visual arts, including materials in [...]

Leave a Reply