<% content_for :status_bar do %>
  <h2><%= t('headings') %></h2>
<% end %>

<div class="span12">
  <div id="index-controls">
  <% if @headings.total_entries > Heading.per_page || params[:q].present? %>
    <% form_tag('/headings', :method => :get, :class => "skip-prompt form-search pull-right") do %>
      <%= text_field_tag :q, params[:q], :class => "search-query", :placeholder => "Lemma" %>
      <%= submit_tag "Cerca", :name => "", :class => "btn btn-small" %>
    <% end %>
  <% end %>
  <div id="buttons">
    <%= link_to t('new_heading'), new_heading_path, { :class => "btn btn-small new" } %>
    <%= link_to '<i class="icon-share"></i> ' + t('import_heading'), import_csv_headings_path, { :class => "btn btn-small" } %>
  </div>
  </div>

<% if @headings.size > 0 %>

<%= display_page_entries_info @headings %>

<table class="table">
  <thead>
  <tr>
    <th><%= sortable("heading_type", t('heading_type')) %></th>
    <th><%= sortable("name", t('heading_name')) %></th>
    <th><%= sortable("dates", t('heading_dates')) %></th>
    <th><%= sortable("qualifier", t('heading_qualifier')) %></th>
    <th>&nbsp;</th>
	<th>&nbsp;</th>
  </tr>
  </thead>
  <tbody>
  <% @headings.each do |heading| %>
    <tr>
      <td><%= show_value(heading.heading_type, "t") %></td>
      <td><%= link_to heading.name, edit_heading_path(heading) %></td>
      <td><%= heading.dates %></td>
      <td><%= heading.qualifier %></td>  
	  <td class="action"><%= link_to t('show'), heading %></td>
      <td><%= link_to t('destroy'), heading, :confirm => 'Are you sure?', :method => :delete %></td>
    </tr>
  <% end %>
  </tbody>
</table>

<%= will_paginate @headings %>

<% else %>
  <p>Non sono presenti lemmi.</p>
<% end %>
</div>