<% if @lessons.blank? %>
  <%= render partial: '/admin/shared/norecords' %>
<% else %>
  <table class="table table-bordered">
    <thead class="thead-dark">
      <tr>
        <th><%= t('lesson.table.name') %></th>
        <th><%= t('lesson.table.description') %></th>
        <th class="fit"><%= t('actions') %></th>
      </tr>
    </thead>
    <tbody>
      <% @lessons.each do |lesson| %>
        <tr>
          <td><%= link_to lesson.name, [:admin, lesson] %></td>
          <td><%= lesson.description %></td>
          <td class="fit">
            <%= link_to raw('<i class="fa fa-pencil-alt"></i>'), edit_admin_lesson_path(lesson), { remote: true, class: 'btn btn-sm btn-info', title: t('edit') } %>
            <%= link_to raw('<i class="fa fa-times"></i>'), [:admin, lesson], { remote: true, class: 'btn btn-sm btn-danger', method: :delete, data:{ confirm: t('confirm_delete') }, title: t('delete')} %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>
  <%= paginate @lessons, params: { controller: 'admin/lessons', action: :index , week_id: @week.id}, remote: true, theme: 'twitter-bootstrap-4', pagination_class: 'justify-content-center' %>
<% end %>
