code-mancers/rapidfire

View on GitHub
app/views/rapidfire/surveys/index.html.erb

Summary

Maintainability
Test Coverage
<h2>
  <%= params[:active].to_i == 0 ? "In-A" : "A" %>ctive Surveys
</h2>
<h3>
  <% if can_administer? %>
    <%= link_to "New Survey", new_survey_path %> |
    <% if params[:active].to_i == 0 %>
      <%= link_to "View Active Surveys", surveys_path(active: 1) %>
    <% else %>
      <%= link_to "View Inactive Surveys", surveys_path(active: 0) %>
    <% end %>
  <% end %>
</h3>
<h4>
  <%= link_to t('Back to home'), '/' %>
</h4>
<hr/>

<table>
  <colgroup>
    <col>
    <col width="250">
  </colgroup>
  <thead>
    <tr>
      <th>Survey</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>
    <%= render partial: "survey", collection: @surveys %>
  </tbody>
</table>

<% if defined?(Kaminari) %>
  <%= paginate @surveys %>
<% end %>