Skip to content

Commit

Permalink
All Resources on Index + little styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Pape committed Mar 1, 2012
1 parent 226dd86 commit 3212022
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
57 changes: 51 additions & 6 deletions templates/default/layout/html/layout.erb
Expand Up @@ -8,22 +8,67 @@
#toc .title {display: none;}
#toc a:link, #content a:visited { text-decoration: none; color: #05a; }
#toc a:hover { background: #ffffa5; }
pre code {
display: block;
background: #EAF0FF;
padding: 12px;
line-height: 1.9em;
}
h2 {
margin: 2.4em 0 0.5em;
}
h3 {
font-size: 1.2em;
font-weight: normal;
padding-top: 22px;
margin-bottom: -6px;
}
#resources {
padding: 14px 20px 52px;
}
#resources li {
display: block;
font-size: 1.3em;
float: left;
width: 140px;
}
.resource_url {
display: block;
background: #EAF0FF;
padding: 12px;
}
#search_frame #search {
display: none;
}
.parameters {

}
.parameters .required {
float: left;
min-width: 300px;
width: 50%;
}
.parameters .optional {
float: left;
min-width: 300px;
width: 50%;
}
</style>
<script type="text/javascript">
//<![CDATA[
function setup_toc() {
if ($('#wrapper').length === 0) return;
if ($('#content').length === 0) return;
var _toc = $('<ol class="top"></ol>');
var show = false;
var toc = _toc;
var counter = 0;
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
var i;
if ($('#wrapper h1').length > 1) tags.unshift('h1');
for (i = 0; i < tags.length; i++) { tags[i] = '#wrapper ' + tags[i]; }
if ($('#content h1').length > 1) tags.unshift('h1');
for (i = 0; i < tags.length; i++) { tags[i] = '#content ' + tags[i]; }
var lastTag = parseInt(tags[0][1], 10);
$(tags.join(', ')).each(function() {
if (this.id == "wrapper") return;
if (this.id == "content") return;
show = true;
var thisTag = parseInt(this.tagName[1], 10);
if (this.id.length === 0) {
Expand All @@ -44,7 +89,7 @@
});
if (!show) return;
html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
$('#wrapper').prepend(html);
$('#content').prepend(html);
$('#toc').append(_toc);
$('#toc .hide_toc').toggle(function() {
$('#toc .top').slideUp('fast');
Expand Down Expand Up @@ -78,7 +123,7 @@

<iframe id="search_frame"></iframe>

<div id="wrapper" style="padding-top: 12px;">
<div id="content" style="padding-top: 12px;">
<%= yieldall %>
</div>

Expand Down
3 changes: 2 additions & 1 deletion templates/default/layout/html/setup.rb
Expand Up @@ -3,7 +3,7 @@
def init
@page_title = options[:title]
if object == "_index.html"
# we dont need the _index

elsif object.name == :root
sections :layout, [:index]
else
Expand All @@ -24,5 +24,6 @@ def menu_lists
def index
path_to_readme = "./doc/README_FOR_API"
@readme = YARD::CodeObjects::ExtraFileObject.new(path_to_readme) if File.exists?(path_to_readme)
@resources = index_objects(@objects)
erb(:index)
end

0 comments on commit 3212022

Please sign in to comment.