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:
<%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %> <script type="text/javascript"
src="…\Libraries\jquery.min.js">
/* 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; }
<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>
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’ %>