<%= t('page.listing', model: t('activerecord.models.shelf')) -%>

<% if @library %>

<%= link_to @library.display_name, @library -%>

<% end %>
<%= form_for :shelves, url: shelves_path, html: {method: 'get'} do -%>

<%= label_tag :search_form_top, t('page.search_term') -%>: <%= search_field_tag 'query', h(@query), {id: 'search_form_top', class: 'search_form', placeholder: t('page.search_term')} -%> <%= submit_tag t('page.search') -%> <%= hidden_field_tag :library_id, @library.name if @library -%>

<%- end -%>
<%- @shelves.each_with_index do |shelf, i| -%> "> <%- end -%>
<%= t('activerecord.attributes.shelf.name') -%> <%= t('activerecord.models.library') -%>
<% if @library and params[:query].blank? and params[:order].blank? %> <%- if policy(shelf).update? -%> <%= move_position(shelf) -%> <%- end -%> <% end %> <%= link_to shelf.display_name, shelf -%>
<%= shelf.name if current_user.try(:has_role?, 'Librarian') %>
<%= link_to shelf.library.display_name, library_path(shelf.library) -%> <% if shelf.closed? %> <%= t('activerecord.attributes.shelf.closed') %> <% end %>
<%= shelf.library.name if current_user.try(:has_role?, 'Librarian') %>
<%- if policy(shelf).update? -%> <%= link_to t('page.edit'), edit_shelf_path(shelf) -%> <% end %> <%- if policy(shelf).destroy? -%> <%= link_to t('page.destroy'), shelf, data: {confirm: t('page.are_you_sure')}, method: :delete -%> <%- end -%>
<%= paginate(@shelves) -%>