unepwcmc/SAPI

View on GitHub
app/views/trade/statistics/summary_year.html.erb

Summary

Maintainability
Test Coverage
<h1>Trade Statistics</h1>

<%= render 'menu' %>

<p>Summary of CITES annual reports submitted
  by CITES Parties by year</p>

<%= form_tag("summary_year", :method => "get") do %> 
  <div class="control-group">
    <%= select_year(@date_selected, :start_year => Time.now.year,
                    :end_year => 1975, :field_name => "yearSelected") %>
    <%= submit_tag("Update", {:class => 'btn btn-primary'})%>
  </div>
<% end %>

<table class="table table-bordered table-striped ">
  <thead>
    <tr>
      <th>No</th>
      <th>Country</th>
      <th>Year</th>
      <th>Type</th>
    </tr>
  </thead>
  <tbody>
    <%  @countries_reported_by_year.to_enum.with_index(1).each do |country, i| %>
      <tr>
        <td><%= i %></td>
        <td><%= country[:name_en] %></td>
        <td><%= country[:year] %></td>
        <td><%= country[:reporter_type] %></td>
      </tr>
    <% end %>
  </tbody>
</table>