LibraryManagementSystem/app/views/admin/books/index.html.erb

39 lines
1.3 KiB
Plaintext

<div class="row">
<div class="col-sm-12 ">
<h1 class="my-4">Manage Books</h1>
<%= link_to 'Add New Book', new_admin_book_path, class: 'btn btn-sm btn-primary mb-2'%>
</div>
<div class="col-sm-12">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Title</th>
<th scope="col">Genre</th>
<th scope="col">SubGenre</th>
<th scope="col">Author</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<% @books.each_with_index do |book, index| %>
<tr>
<th scope="row"><%= index + 1 %></th>
<td><%= book.title %></td>
<td><%= book.genre %></td>
<td><%= book.sub_genre %></td>
<td><%= book.author %></td>
<td>
<%= link_to 'Edit', edit_admin_book_path(book), class: 'btn btn-sm btn-primary' %>
<%= link_to 'Delete', admin_book_path(book), method: :delete, class: 'btn btn-sm btn-danger', data: { confirm: 'Are you sure?'} %>
<%= link_to 'View', admin_book_path(book), class: 'btn btn-sm btn-secondary' %></td>
</td>
</tr>
<% end %>
</tbody>
</table>
<%= paginate @books, theme: 'twitter-bootstrap-4' %>
</div>
</div>