My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members

Makes indicators easy!

Install

  script/plugin install http://indicator.googlecode.com/svn/tags/indicator

Documentation

This plug-in is very easy to use.

It extends the "remote_function" method in Rails. It accepts 2 new parameters:

  • :indicate - The identifier for an indicator or indicated_tag.

  • :indicate_and_update - Same as :indicate, but sets the update paramter to the indicated_tag.

Available Methods

  • indicator(identifier) - render an indicator.
  •   <%= indicator("my_indicator") %>
      <% form_for(:record, :url => {:action => :update}, :indicate => "my_indicator") do |f| %>
        form content ...
      <% end %>
  • indicated_tag(tag, identifier, *args, &block) - render a tag with an indicator.
  •   <%= indicated_tag(:span, "my_tag", "This content will disappear and an indicator will appear while loading") %>
      - <%= link_to_remote "Delete", :url => { :action => "destroy", :id => record.id }, :indicate => "my_tag" %>
  • indicated_span, indicated_div - Shorthand methods to indicated_tag :div or indicated_tag :span

Examples

Hide target content while loading

  <% indicated_div "hide_target_while_loading" do %>
    Content
  <% end %>
  <div>
    <%= link_to_remote "Update value", :url => { :action=> "partial" }, :indicate_and_update => "hide_target_while_loading" %>
  </div>

Hide link while loading.

  <div id="normal_div">
    This is a regular div.  It will be updated, however the link will be hidden.
  </div>
    
  <% indicated_div "link_div" do %>
    <%= link_to_remote "Update value", :url => { :action=> "partial" }, :indicate => "link_div", :update => "normal_div" %>
  <% end %>

Don't hide any content, but show an indicator next to the link.

  <div id="normal_div_2">
    Content
  </div>
  <%= link_to_remote "Update div", :url => {:action => "partial"}, :indicate => "solo", :update => "normal_div_2"%>
  <%= indicator("solo") %>
Powered by Google Project Hosting