Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple restful ajax overlay to work with jQuery and Rails
Ruby JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
generators/restbox
lib
rails
restbox
.document
.gitignore
Gemfile
LICENSE
README.rdoc
Rakefile
VERSION.yml
init.rb
install.rb
restbox.gemspec

README.rdoc

Restbox

Install

To install as a Rails plugin:

script/plugin install http://github.com/richardiux/restbox.git

To install as a gem:

gem install restbox

Copy javascript, CSS, and images files to public

script/generate restbox

Setup

in your layout after including jQuery:

<%= javascript_include_tag 'restbox' %>
<%= stylesheet_link_tag 'restbox' %>

Example on Rails Application

In your application.js

$(document).ready(function() {
  jQuery("a.restbox").restbox({})
}

In your view

<%= link_to "edit", order_path(@order), :class => "restbox" %>

In your controller

def edit
  @order = Order.find params[:id]
  respond_to do |format|
    format.html { }
    format.js   { }
  end
end

The JS view for the action (edit.js.erb)

You can use the following javascript helpers

To put text in the restbox:

<%= restbox(:content => 'some text') %>

To put a partial inside the restbox:

<%= restbox(:content => render(:partial => 'form')) %>

With javascript

To put content in the restbox

$.restbox({content: "some text"})

To manually display loading restbox

$.restbox({})

Prerequisites

JQuery 1.3.2

Upgrading

Reinstall the plugin

script/plugin install http://github.com/richardiux/restbox.git -f

Regenerate JS and CSS

script/generate restbox

Bug Reports

If you have found a bug to report or a feature to request, please add it to the GitHub issue tracker if it is not there already.

github.com/richardiux/restbox/issues/

Development

This project can be found on github at the following URL.

github.com/richardiux/restbox

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but

    bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2009 Richard Millan & Joseph Silvashy. See LICENSE for details.

Something went wrong with that request. Please try again.