volontariat/voluntary_scholarship

View on GitHub
app/views/scholarship/programs/index.html.erb

Summary

Maintainability
Test Coverage
<h3><%= t("scholarship_programs.index.title") %></h3>
<% if @programs.none? || @programs.select{|e| e.id.present? }.none? %>
<p><%= I18n.t("scholarship_programs.index.empty_collection")%></p>
<% else %>
<table class="table table-striped">
  <thead>
    <tr class="<%= cycle('odd', 'even') %>">
      <th><%= t("activerecord.attributes.general.name") %></th>
      <th><%= t("activerecord.models.organization") %></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
  <% @programs.select{|e| e.id.present? }.each do |program| %>
    <tr class="<%= cycle('odd', 'even') %>">
      <td>
        <%= link_to program.name, scholarship_program_path(program) %>
      </td>
      <td>
        <%= link_to program.organization.name, organization_path(program.organization) %>
      </td>
      <td>
          <%= render partial: 'actions', locals: { program: program } %>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>
<% end %>

<%= will_paginate @programs %>

<%= link_to t("scholarship_programs.new.title"), @organization ? new_organization_scholarship_program_path(@organization) : new_scholarship_program_path %>