How to show menu in application.html.erb on other pages?

I am using Aptana Studio 3 to write a small application.

In the Views folder, I added a new .html.erb page and added a jQuery
navigation menu bar. This page also has a banner. I want to keep this as
a base page (like Master Page in .NET) for all the other pages.

I want all the other pages to automatically show the banner and menu bar on top.

How to do this? I am using Rails 3.2.

Code of application.html.erb:

<!DOCTYPE html>
<html>
<head>
  <title></title>
  <%= stylesheet_link_tag "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <%= csrf_meta_tags %>

      <script type="text/javascript" src="..\Libraries\jquery.min.js"></script>
      <script type="text/javascript">
            $(document).ready(function(){
                    $('li.headlink').hover(
                        function() { $('ul', this).css('display', 'block'); },
                        function() { $('ul', this).css('display', 'none'); });
                });
      </script>
      <style type="text/css" rel="stylesheet">
            /* General */
            #cssdropdown, #cssdropdown ul { list-style: none; }
            #cssdropdown, #cssdropdown * { padding: 0; margin: 0; }

            /* Head links */
            #cssdropdown li.headlink { width: 220px; float: left; margin-left: -1px; border: 1px black solid; background-color: #e9e9e9; text-align: center; }
            #cssdropdown li.headlink a { display: block; padding: 15px; }

            /* Child lists and links */
            #cssdropdown li.headlink ul { display: none; border-top: 1px black solid; text-align: left; }
            #cssdropdown li.headlink:hover ul { display: block; }
            #cssdropdown li.headlink ul li a { padding: 5px; height: 17px; }
            #cssdropdown li.headlink ul li a:hover { background-color: LightBlue; color:Black }

            /* Pretty styling */
            body { font-family: verdana, arial, sans-serif; font-size: 0.8em;}
            #cssdropdown a { color: white; } #cssdropdown ul li a:hover { text-decoration: none; }
            #cssdropdown li.headlink { background-color: Blue;}
            #cssdropdown li.headlink ul { background-position: bottom; padding-bottom: 10px; }
      </style>
</head>
<body>
<%= yield %>

        <div id="divMain">
            <div id="divHeader">
                <img src="..\Images\W.png">
            </div>
            <div id="divMenu">
                <ul id="cssdropdown">
                <li class="headlink">
                    <a href="#">Task</a>
                     <ul>
                      <li><a href="#">Add New</a></li>
                     </ul>
                     </li>
                      <li class="headlink">
                      <a href="#">Reports</a>
                         <ul>
                      <li><a href="#">Report</a></li>
                     </ul>
                 </li>
                </ul>
            </div>
        </div>

<div id="content"><%= content_for?(:content) ? yield(:content) : yield %></div>
</body>
</html>

Code of Content.html.erb

        <% content_for :content do %>
          <div id="divMain"></div>
          <%= content_for?(:news_content) ? yield(:news_content) : yield %>
        <% end %>
        <%= render :template => 'layouts/application' %>

I am using Aptana Studio 3 to write a small application.

ProTip: no one cares what editor you're using.

In the Views folder, I added a new .html.erb page and added a jQuery
navigation menu bar. This page also has a banner. I want to keep this as a
base page (like Master Page in .NET) for all the other pages.
I want all the other pages to automatically show the banner and menu bar on
top.

Your primary layout file, by default application.html.erb, is there to
wrap page-specific content. You can include and position elements
in that layout however you choose.

Have you worked through a Rails tutorial yet?

···

On Mon, May 27, 2013 at 10:57 AM, Rohit Coder <passionate_programmer@hotmail.com> wrote:

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan

Yes Schroeder, I referred Rails documentation but I am not able to solve my requirement.

···

Date: Tue, 28 May 2013 03:40:31 +0900
From: hassan.schroeder@gmail.com
Subject: Re: How to show menu in application.html.erb on other pages?
To: ruby-talk@ruby-lang.org

On Mon, May 27, 2013 at 10:57 AM, Rohit Coder > <passionate_programmer@hotmail.com> wrote:
> I am using Aptana Studio 3 to write a small application.

ProTip: no one cares what editor you're using.

> In the Views folder, I added a new .html.erb page and added a jQuery
> navigation menu bar. This page also has a banner. I want to keep this as a
> base page (like Master Page in .NET) for all the other pages.
> I want all the other pages to automatically show the banner and menu bar on
> top.

Your primary layout file, by default application.html.erb, is there to
wrap page-specific content. You can include and position elements
in that layout however you choose.

Have you worked through a Rails tutorial yet?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
Hassan Schroeder | about.me
twitter: @hassan

Really? You haven't seen something like this?

<body>
  <%= render :partial => 'layouts/banner' %>
  <%= render :partial => 'layouts/menubar' %>

  <%= yield %>

</body>

Because that's pretty much all you need...

···

On Mon, May 27, 2013 at 11:51 AM, Rohit Coder <passionate_programmer@hotmail.com> wrote:

Yes Schroeder, I referred Rails documentation but I am not able to solve my
requirement.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan

I included that line you suggested. Below is the code of my content page:

···

================================================
<% content_for :stylesheets do %>
  <div id="divLogin">
    
  </div>
<% end %>

<% content_for :MainContent do %>
  <div id="divMain">

  </div>
<% end %>

<%= render :partial => "layouts\application.html.erb" %>

=================================================

Date: Tue, 28 May 2013 04:09:23 +0900
From: hassan.schroeder@gmail.com
Subject: Re: How to show menu in application.html.erb on other pages?
To: ruby-talk@ruby-lang.org

On Mon, May 27, 2013 at 11:51 AM, Rohit Coder > <passionate_programmer@hotmail.com> wrote:
> Yes Schroeder, I referred Rails documentation but I am not able to solve my
> requirement.

Really? You haven't seen something like this?

<body>
  <%= render :partial => 'layouts/banner' %>
  <%= render :partial => 'layouts/menubar' %>

  <%= yield %>

</body>

Because that's pretty much all you need...

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
Hassan Schroeder | about.me
twitter: @hassan

Completely and utterly backwards. If you've actually gone through
a Rails tutorial, you apparently haven't understood it at all.

application.html.erb *is* the "Master Page" you want.

···

On Mon, May 27, 2013 at 12:24 PM, Rohit Coder <passionate_programmer@hotmail.com> wrote:

I included that line you suggested. Below is the code of my content page:

<%= render :partial => "layouts\application.html.erb" %>

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

twitter: @hassan