app/views/certificates/index.html.erb
<%= render partial: 'participants/nav' %>
<h1>My Certificates</h1>
<% if @certificates.any? %>
<section>
<h2>Certificates</h2>
<%= content_tag :table, :class => 'certificates table table-bordered table-striped table-hover' do %>
<thead>
<tr>
<th>Date</th>
<th>Name</th>
<th>Course</th>
<th></th>
</tr>
</thead>
<tbody>
<% @certificates.each do |cert| %>
<tr>
<td><%= cert.created_at.strftime('%Y-%m-%d %H:%M') %></td>
<td><%= cert.name %></td>
<% if can? :read, cert.course %>
<td><%= link_to cert.course.name, organization_course_path(cert.course.organization, cert.course) %></td>
<% else %>
<td><%= cert.course.title %></td>
<% end %>
<td>
<%= link_to 'View certificate', cert %>
</td>
</tr>
<% end %>
</tbody>
<% end %>
</section>
<% else %>
<p> No certificates</p>
<% end %>
<% if @courses.any? %>
<div class="row">
<div class="col-md-12">
<h2>Request certificate</h2>
<%= render partial: 'form' %>
</div>
</div>
<% end %>