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
- 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’)}) %>
This is an Inline Redbox.
- 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”) %>
- AJAX redbox
<%= link_to_remote_redbox(“Red Box Ajax Contact Page”, :url => {:action
=> “contact”}) %>
Command to close the Redbox
<%= link_to_close_redbox(‘Close’)%>