<% if flash[:notice] %>
<%= flash[:notice] %>
<% end %>

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

<%= form_for :libraries, url: libraries_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') -%>

<%- end -%>

<%= t('page.sort_by') -%>: <%= link_to t('activerecord.attributes.library.name'), libraries_path(order: 'name') -%> <%= link_to t('page.created_at'), libraries_path(sort_by: 'created_at') -%>

<%- @libraries.each_with_index do |library, i| -%> "> <%- end -%>
<%= t('activerecord.attributes.library.name') -%> <%= t('activerecord.attributes.library.display_name') -%> / <%= t('activerecord.attributes.library.address') -%> <%= t('activerecord.attributes.library.telephone_number_1') -%> / <%= t('activerecord.attributes.library.telephone_number_2') -%>
<%= t('activerecord.attributes.library.fax_number') -%>
<%- if policy(library).update? and params[:query].blank? -%> <%= library.first? ? image_tag('icons/stop.png', size: '16x16') : link_to(image_tag('icons/arrow_up.png', size: '16x16', class: 'enju_icon', alt: t('page.asc')), {action: 'update', move: 'higher', id: library.name}, method: :put) -%> <%= library.last? ? image_tag('icons/stop.png', size: '16x16') : link_to(image_tag('icons/arrow_down.png', size: '16x16', class: 'enju_icon', alt: t('page.desc')), {action: 'update', move: 'lower', id: library.name}, method: :put) -%> <%- end -%> <%= library.name -%> <%= link_to library.display_name.localize, library -%>
<%= library.zip_code -%> <%= library.address -%>
<% if library.telephone_number_1.present? %> tel: <%= library.telephone_number_1 -%>
<% end %> <% if library.telephone_number_2.present? %> tel: <%= library.telephone_number_2 -%>
<% end %> <% if library.fax_number.present? %> fax: <%= library.fax_number -%> <% end %>
<%- if policy(library).update? -%> <%= link_to t('page.edit'), edit_library_path(library) -%> <% end %> <%- if policy(library).destroy? -%> <%= link_to t('page.destroy'), library, data: {confirm: t('page.are_you_sure')}, method: :delete -%> <%- end -%>
<%= paginate(@libraries) %>