Skip to content

Instantly share code, notes, and snippets.

@alkema
Created February 20, 2009 19:45
Show Gist options
  • Select an option

  • Save alkema/67657 to your computer and use it in GitHub Desktop.

Select an option

Save alkema/67657 to your computer and use it in GitHub Desktop.
#calling view
<%= growl4rails_includes(3000, 5) %>
<%=
periodically_call_remote(
:url => '/foos/loading_statuses.js',
:frequency => '4',
:complete => "request",
:method => 'GET'
)
%>
#controller
def loading_statuses
@foos = Foo.find(:all, :conditions => {:busy => false, :notified => false, :complete => true, :user => user.id})
@foos.each{|foo| foo.notified = true; foo.save; }
respond_to do |format|
format.js
end
end
#responding view
<% @foos.each do |foo| -%>
Growl4Rails.showGrowl({image_path:'/images/download.png', title:'<%= foo.name %> loaded',
message:"Loaded <%= foo.name %> "});
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment