Skip to content

Commit

Permalink
Set title, copyright, minor UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fishnix committed May 1, 2015
1 parent 6004718 commit 241a67f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 21 deletions.
4 changes: 4 additions & 0 deletions lib/calamum/doc_parser.rb
Expand Up @@ -18,6 +18,10 @@ def get_version
@definition['version']
end

def get_copyright
@definition['copyright']
end

def get_authentication
@definition['authentication']
end
Expand Down
4 changes: 3 additions & 1 deletion lib/calamum/runner.rb
Expand Up @@ -96,7 +96,8 @@ def process_index
:name => @definition.get_name,
:resources => @definition.resources,
:description => @definition.get_description,
:version => @definition.get_version
:version => @definition.get_version,
:copyright => @definition.get_copyright
}

page = Calamum::DocGenerator.new(:index)
Expand All @@ -110,6 +111,7 @@ def process_section(section, content)
:name => @definition.get_name,
:version => @definition.get_version,
:description => content,
:copyright => @definition.get_copyright
}
page = Calamum::DocGenerator.new(:section)
page.save_template("#{section}.html", bindings)
Expand Down
28 changes: 17 additions & 11 deletions lib/calamum/templates/bootstrap/index.html.erb
Expand Up @@ -65,12 +65,13 @@
</div>
<div id="<%= req.slug %>" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="nav nav-tabs">
<li class="active"><a href="#description_<%= req.slug %>" data-toggle="tab">Description</a></li>
<li><a href="#header_<%= req.slug %>" data-toggle="tab">Header</a></li>
<li><a href="#params_<%= req.slug %>" data-toggle="tab">Parameters</a></li>
<li><a href="#response_<%= req.slug %>" data-toggle="tab">Response</a></li>
</ul>
<ul class="nav nav-tabs">
<li class="active"><a href="#description_<%= req.slug %>" data-toggle="tab">Description</a></li>
<li><a href="#header_<%= req.slug %>" data-toggle="tab">Header</a></li>
<li><a href="#params_<%= req.slug %>" data-toggle="tab">Parameters</a></li>
<li><a href="#request_<%= req.slug %>" data-toggle="tab">Request</a></li>
<li><a href="#response_<%= req.slug %>" data-toggle="tab">Response</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="description_<%= req.slug %>"><%= req.description %></div>
<div class="tab-pane" id="header_<%= req.slug %>">
Expand Down Expand Up @@ -121,11 +122,16 @@
Request without parameters
<% end %>
</div>
<div class="tab-pane content" id="response_<%= req.slug %>">
<% if req.response %>
<pre class="prettyprint"><%= pj req.response %></pre>
<% end%>
</div>
<div class="tab-pane content" id="request_<%= req.slug %>">
<% if req.request %>
<pre class="prettyprint"><%= pj req.request %></pre>
<% end%>
</div>
<div class="tab-pane content" id="response_<%= req.slug %>">
<% if req.response %>
<pre class="prettyprint"><%= pj req.response %></pre>
<% end%>
</div>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion lib/calamum/templates/twitter/assets/css/main.css
Expand Up @@ -1043,6 +1043,7 @@ pre.prettyprint {
padding: 0px;
background-color: #fafafb;
border: none !important;
overflow-y: auto;
}
pre .str {
color: #36C;
Expand All @@ -1052,4 +1053,4 @@ pre.prettyprint {
}
pre .pun {
color: #999;
}
}
2 changes: 1 addition & 1 deletion lib/calamum/templates/twitter/errors.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Developers API</title>
<title><%= @name %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="assets/css/main.css" />
</head>
Expand Down
6 changes: 3 additions & 3 deletions lib/calamum/templates/twitter/index.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Developers API</title>
<title><%= @name %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="assets/css/main.css" />
</head>
Expand All @@ -27,7 +27,7 @@
<table>
<caption>
<strong><%= name.capitalize %></strong>
<p>This endpoints belong to <%= name %> resource.</p>
<p>These endpoints belong to the <%= name %> resource.</p>
</caption>
<thead>
<tr>
Expand All @@ -53,7 +53,7 @@
</div>

<div id="footer-outer">
<div id="footer"><%= @name %> &copy; 2013</div>
<div id="footer"><%= @name %> &copy; <%= @copyright || '2015' %></div>
</div>

</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/calamum/templates/twitter/section.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Developers API</title>
<title><%= @name %></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="assets/css/main.css" />
</head>
Expand Down Expand Up @@ -29,7 +29,7 @@
</div>

<div id="footer-outer">
<div id="footer"><%= @name %> &copy; 2013</div>
<div id="footer"><%= @name %> &copy; <%= @copyright || '2015' %></div>
</div>
</div>
</body>
Expand Down
5 changes: 3 additions & 2 deletions sample/sample_separate_resources.json
Expand Up @@ -3,5 +3,6 @@
"url": "http://api.sample.com",
"version": "1.0",
"description": "Calamum is a simple ruby build program to generate a REST API documentation from a YAML file definition",
"resources": "./resources"
}
"resources": "./resources",
"copyright": "2015"
}

0 comments on commit 241a67f

Please sign in to comment.