PDA

View Full Version : Redbox - How to use in Rails?


jacobnelson79
July 9th, 2007, 12:34 AM
Step 1:
1.1: download all the files from the link "http://www.craigambrose.com/projects/redbox" and save it in the folder "redbox"

1.2: create a folder named "redbox" in "vendor/plugins" and save the file "init.rb" in "vendor/plugins/redbox"
1.3: save the "redbox.js" file inside the folder "public/javascripts"
1.4: save the "redbox.css" file inside the folder "public/stylesheets"
1.5: save the "redbox_spinner.gif" file inside the folder "public/images"

Step 2:
2.1: include the javscript file in your rhtml using the command
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'redbox' %>
2.2: include the stylesheet using the command
<%= stylesheet_link_tag 'redbox' %>

Now you are ready to use the RedBox in your application.

You can include a Redbox using three ways

1. Inline Redbox :- This box is already somewhere in this page, but is hidden, and is specified using it's id attribute.

<%=link_to_redbox('Inline Red Box', 'inline_box', {:complete => 'inline_box', :loading => visual_effect(:highlight, 'inline_box')}) %>

<div id="inline_box" style="display: none"><p>This is an Inline Redbox.</p></div>

2. Inline redbox generated by a component :- This box is generated by another action, just like a remote redbox, however it is rendered into this page so that it behaves like an inline redbox. This removes the load time when the box is opened, however it slows down the initial page load.

<%= link_to_component_redbox("Red Box Component Contact Page", :action => "contact") %>

3. AJAX redbox

<%= link_to_remote_redbox("Red Box Ajax Contact Page", :url => {:action => "contact"}) %>

Command to close the Redbox

<%= link_to_close_redbox('Close')%>

xnine
December 26th, 2007, 01:58 AM
thank you for you cord. but i have mistake in IE7.:(