<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Rubynaut: Redbox, or a box overlay on rails</title>
    <link>http://www.rubynaut.net/articles/2007/03/20/redbox</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Redbox, or a box overlay on rails</title>
      <description>&lt;p&gt;As linked in the last digest, the Craig Ambrose&amp;#8217;s &lt;a href="http://www.craigambrose.com/projects/redbox"&gt;Redbox&lt;/a&gt; is a Rails plugin inspired by &lt;a href="http://jquery.com/demo/thickbox/"&gt;Thickbox&lt;/a&gt;. It provides a way to show box overlaying your page.&lt;/p&gt;


	&lt;p&gt;Example:&lt;/p&gt;


&lt;center&gt;&lt;img src="http://www.rubynaut.net/files/2007-03-20_redbox_login.png" title="Redbox Login" alt="Redbox Login" /&gt;&lt;/center&gt;

Not fully documented, I&#226;&#8364;&#8482;ll give you the way I have used it. Before starting, install the plugin:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;script/plugin install http://www.tinboxsoftware.com/plugins/show/redbox/&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

First you need to verify your &lt;span class="caps"&gt;CSS&lt;/span&gt; and if, same me, your application not cover all the visible page of your navigator you should add the following in your &lt;span class="caps"&gt;CSS&lt;/span&gt;:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_css "&gt;html {
  height: 100%;
  width: 100%;
}

body {
  height: 100%;
  width: 100%;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

This code allows the overlay to cover all the page. Verify also you have the default javascript loaded and add Redbox &lt;span class="caps"&gt;CSS&lt;/span&gt; and javascript:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;lt;%= stylesheet_link_tag 'redbox' %&amp;gt;
&amp;lt;%= javascript_include_tag :defaults %&amp;gt;
&amp;lt;%= javascript_include_tag 'redbox' %&amp;gt; &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

Next you need to create hidden div for each box you need. The name of the div must follow the Redbox convention: hidden_content_&lt;i&gt;actionname&lt;/i&gt;_&lt;i&gt;controllername&lt;/i&gt;. The default style have to be &lt;code&gt;display: none;&lt;/code&gt;.
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_html "&gt;&amp;lt;div id=&amp;quot;hidden_content_login_admin&amp;quot;
 style=&amp;quot;display: none;&amp;quot;&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

Once you have put this code in your layout, you can activate your overlay with the following code (in my case it was a call to an action rendering a piece of html in return):
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;&amp;lt;%= link_to_remote_redbox &amp;lt;i&amp;gt;'link text'&amp;lt;/i&amp;gt;, :url =&amp;gt; {:controller =&amp;gt; &amp;lt;i&amp;gt;'controllername'&amp;lt;/i&amp;gt;, :action =&amp;gt; &amp;lt;i&amp;gt;'actionname'&amp;lt;/i&amp;gt;} %&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;That&#226;&#8364;&#8482;s all, Redbox afford other ways to call box don&#226;&#8364;&#8482;t hesitate to look at the &lt;a href="http://www.craigambrose.com/redbox_demo"&gt;demos&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;When you install redbox, it copies css and javascript to the public folder. You can configure the &lt;span class="caps"&gt;CSS&lt;/span&gt; to modify the transparency of the overlay as you wish.&lt;/p&gt;


	&lt;p&gt;Hope this article would be helpful&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.craigambrose.com/projects/redbox"&gt;Redbox&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Tue, 20 Mar 2007 19:16:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:649b2f5e-7e94-4ab2-9203-36dbe7548694</guid>
      <author>stephane</author>
      <link>http://www.rubynaut.net/articles/2007/03/20/redbox</link>
      <trackback:ping>http://www.rubynaut.net/articles/trackback/14168</trackback:ping>
    </item>
  </channel>
</rss>
