Easily add progress indicators for rails
JavaScript Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
public
MIT-LICENSE
README.textile
init.rb

README.textile

Progress Indicator Helpers v0.1

By Tim Harper (tim c harper at g mail dot com)

OVERVIEW

This plugin provides you with several helpful methods to quickly enable your ajax calls to have progress indicators.

USAGE

  <%= javascript_include_tag "prototype", "indicator" %>
  <%
  sqf = Sqf.find(:first)
  %>
  
  <div>
  <label>MLS #</label><%= text_field 'sqf', 'mls_number' %><br />
  <%= 
  observe_field("sqf_mls_number", 
    :indicate_and_update => dom_id(sql, "row"),
    :with => "mls_number",
    :url => "/sqfs/scan_data",
    :on => "blur"
    )%>
  </div>
  
  <div id="<%= dom_id(sql, "row") %>" class="overlay_to_indicate">
    Here's where the mls data will come back when you change the item above
  </div>
  <% end %>

MORE INFO

remote_function and friends

remote_function (and therefore link_to_remote, remote_form_for, etc.) is extended to support “indicate” and “indicate_and_update”

  observe_field("sqf_mls_number", 
    :indicate_ => dom_id(sql, "row"),
    :with => "mls_number",
    :url => "/sqfs/scan_data",
    :on => "blur"
    )

Target element classes:

If the target div has the class “overlay_to_indicate”, it will put a transluscent layer over the element with a spinner on the front. Additionally, it will disable every form field in the element (and reenable only the ones that were disabled when done).

Otherwise, the default behavior is to hide the element, and show it again when done.