Forum: Ruby on Rails using HTML frames with rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andrew G. (Guest)
on 2006-05-02 00:34
Hi:

I'm trying to get a page setup with the left side having a collapsable
javascript menu (built from the database) and the right side having more
data about each node in the tree... very standard actually.

I figured frames would be a good way to go, because as the tree expands
as the user dives further in, the frame will add scroll bars without
disrupting the left hand side.

The problem I'm having is that I don't understand how to structure this
setup, how do I refer to the rhtml file? how do I get it loaded and
parsed and the output in the Menu frame?

I put the frame definitions in the layout file, as such:
------------
<html>
<head>
  <title>Admin: <%= controller.action_name %></title>
  <%= stylesheet_link_tag 'scaffold' %>
</head>

<frameset cols="25%,*">
    <frame name="Menu" src="menu.html" frameborder="1"
scrolling="auto"></frame>
    <frame name="Body" src="body.html"></frame>
</frameset>
</html>
------------
Mick S. (Guest)
on 2006-05-02 00:49
Just reference the controllers that you want to use to populate the
frames in the src attributes. Here's a frameset that I use:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
"http://www.w3c.org/TR/REC-html40/strict.dtd">
<html lang="en">
	<head>
		<%= stylesheet_link_tag 'store', 'admin', :media => 'all' %>
		<% @page_title ||= 'Site Administration' -%>
		<title>Admin | <%= @page_title %></title>
	</head>
	<frameset rows="90,*">
		<frame src="/admin/banner" scrolling="no" />
		<frameset cols="250,*">
			<frame src="/admin/treeview?nobanner=true" />
			<frame name="main" />
		</frameset>
	</frameset>
</html>


Andrew G. wrote:
> Hi:
>
> I'm trying to get a page setup with the left side having a collapsable
> javascript menu (built from the database) and the right side having more
> data about each node in the tree... very standard actually.
>
> I figured frames would be a good way to go, because as the tree expands
> as the user dives further in, the frame will add scroll bars without
> disrupting the left hand side.
>
> The problem I'm having is that I don't understand how to structure this
> setup, how do I refer to the rhtml file? how do I get it loaded and
> parsed and the output in the Menu frame?
>
> I put the frame definitions in the layout file, as such:
> ------------
> <html>
> <head>
>   <title>Admin: <%= controller.action_name %></title>
>   <%= stylesheet_link_tag 'scaffold' %>
> </head>
>
> <frameset cols="25%,*">
>     <frame name="Menu" src="menu.html" frameborder="1"
> scrolling="auto"></frame>
>     <frame name="Body" src="body.html"></frame>
> </frameset>
> </html>
> ------------
Ben R. (Guest)
on 2006-05-03 20:58
(Received via mailing list)
Hi Andrew ~

I try to avoid frames like the plague.  Maybe RJS templates might work
better for your application.

~ Ben's 2 cents ~

On 5/1/06, Andrew G. <removed_email_address@domain.invalid> wrote:
> The problem I'm having is that I don't understand how to structure this
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Ben R.
303-947-0446
http://www.benr75.com
Alex Y. (Guest)
on 2006-05-03 20:58
(Received via mailing list)
Andrew G. wrote:
> The problem I'm having is that I don't understand how to structure this
> setup, how do I refer to the rhtml file? how do I get it loaded and
> parsed and the output in the Menu frame?
There's a <frameset> answer from Mick S., but I thought I'd suggest
going with a single-page solution.  I think it's cleaner, but I've been
known to have some pretty funny ideas about this sort of thing :-)

You can have a fixed-width div with scrollbars like this:

<body>
	<div id='menu' style='width: 200px; overflow: scroll'>
		<%= render_menu %>
	</div>
	<div id='content'>
		<%= render_content %>
	</div>
</body>

No need for frames at all :-)
This topic is locked and can not be replied to.