I'm attempting to use Colorbox along with Rails 3 but I'm running into one problem. I'm doing something like the following:
<script type = "text/javascript">
$(function() {
$('a.modal').colorbox({});
});
</scirpt>
The problem that I'm having is that when colorbox displays the content of requested page it's displaying the entire page (header, footer, content, etc), when all that I really want it the content. I'm not sure if this is something to do w/ Colorbox or something that I need to handle w/ Rails.
It sounds like the requested page conforms to whatever default layout you're using for the rest of your app (usually application.html.erb).
If that is the case, it's not a ColorBox issue but rather a question of getting Rails to render your content using a different layout for the requested page. You'll probably want a separate action in the controller that uses a custom layout to render the view rather than the default application.html.erb layout.
For example, let's say your ColorBox links currently invoke this action:
def show
@foo = Foo.find(params[:id])
end
You would do something like this for the ColorBox action:
def colorbox
@foo = Foo.find(params[:id])
render :layout => "colorbox"
end
And create a colorbox.html.erb layout and corresponding routes entry.