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.
2c0a2cbea5455db466aed567de71bfd2?d=identicon&s=25 Andrew Gibson (esquilax)
on 2006-05-01 22: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>
------------
F5c118aaeb5bb7162db613a37e595be8?d=identicon&s=25 Mick Sharpe (micksharpe)
on 2006-05-01 22: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 Gibson 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>
> ------------
D90ef6808433e63203e15a5c2dadb0bb?d=identicon&s=25 Ben Reubenstein (Guest)
on 2006-05-03 18: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 Gibson <gibson_andrew@yahoo.com> wrote:
> The problem I'm having is that I don't understand how to structure this
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Ben Reubenstein
303-947-0446
http://www.benr75.com
Ad7805c9fcc1f13efc6ed11251a6c4d2?d=identicon&s=25 Alex Young (Guest)
on 2006-05-03 18:58
(Received via mailing list)
Andrew Gibson 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 Sharpe, 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.