app/views/docs/index.html.erb
<% page_title "#{t('app.documentation.technical')} - #{t('app.about')} - #{t('app.title')}" %>
<div class="subnav">
<ul class="nav nav-pills">
<li><a href="#source-code">Source code</a></li>
<li><a href="#api">API</a></li>
<li><a href="#data-import">Data import</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Input formats <b class="caret"></b></a>
<ul class="dropdown-menu">
<% @import_types.each do |type| %>
<li><a href="#input-format-<%= base_kind type %>"><%= type.kind %></a></li>
<% end %>
</ul>
</li>
</ul>
</div>
<section id="source-code">
<div class="page-header">
<h1>Source code</h1>
</div>
<p>The source code for this project is available on <a href="http://github.com/holderdeord/hdo-site">GitHub</a>.
</section>
<section id="api">
<div class="page-header">
<h1>API</h1>
</div>
<p>Future: Describe the API.</p>
</section>
<section id="data-import">
<div class="page-header">
<h1>Importing external data</h1>
</div>
<p>To import external data (e.g. from the parliament), you should have a file for each of <a href="#input-formats">these JSON types</a>, and pass them to <code>script/import json</code>, e.g.:</p>
<pre>
<strong>$</strong> cat /path/to/reps.json
<%= @representative_example %>
<strong>$</strong> script/import json /path/to/reps.json</pre>
<p>JSON should be imported in the following order to keep relationships intact:</p>
<ul>
<li>party</li>
<li>committee</li>
<li>district</li>
<li>representative</li>
<li>category</li>
<li>issue</li>
<li>vote</li>
</ul>
</section>
<section id="input-formats">
<div class="page-header">
<h1>Input formats</h1>
</div>
<p>Describes the data formats used to import parliamentary data into the application.</p>
<% @import_types.each do |import_type| %>
<h2 class="page-header" id="input-format-<%= base_kind import_type %>">
<%= base_kind import_type %>
<small><%= import_type.description %></small>
</h2>
<h3>Properties</h3>
<table class="table table-striped">
<thead>
<tr>
<th>name</th>
<th>required</th>
<th>type</th>
<th>description</th>
</tr>
</thead>
<tbody>
<% import_type.properties.each do |property| %>
<tr>
<td><code><%= property.name %></code></td>
<td><%= property.required %></td>
<td><%= property.type %></td>
<td><%= property.description.html_safe %></td>
</tr>
<% end %>
</tbody>
</table>
<h3>JSON example</h3>
<div class="row-fluid">
<pre class="prettyprint"><code class="language-js"><%= import_type.json_example %></code></pre>
</div>
<% end %>
</section>
<% content_for :document_ready do %>
<script>
$(document).ready(function() { prettyPrint(); });
</script>
<% end %>