Skip to content

firebait/simply_load

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simply load is really just a short way to write a JQuery load method to populate a page.

Why did I make a gem out of this little thing? I just thought it was fun to load pieces of html at random or have a little form widget without having to actually instantiate the object on a completely unrelated controller method.
Anyway, hope you guys like it and sure there is always room for improvement.

Installing:

Add this to you Gemfile:

    gem 'simply_load'  

The run:

    bundle install  

As simply_load uses a javascript files, you will be required to install it for use (also remember to include it with javascript_include_tag):

    rails g simply_load  

Using:

On any of your views just use this code:

    <%= simply_load url_to_load, "Loading content if no block is provided",  {other options} %>  

Callbacks:

In order to react to a load success event, you will need to listen to the "simply_load:success" event like this:

$("#simply_load_object").live("simply_load:success", function(){
	alert("Finished Loading")
}

Periodically Load:

You can also reload an element periodically using a function call:

simply_load_every_x_y 

where x is the amount and y is the time unit. 

examples: 

simply_load_every_15_seconds or simply_load_every_1_minute or simply_load_every_3_hours

Hope you like it!!

About

Rails gem to simply_load ajax content.

Resources

Stars

Watchers

Forks

Packages

No packages published