<thead>
  <tr>
    <% @columns.each do |field| %>
      <% label = field.to_s.capitalize.gsub(/_.*$/, '') %>
      <th class="<%== field.to_s + (@sort == field ? ' sortfield' : '') %>">
        <% if @nosort && @nosort.include?(field) %>
          <%= label %>
        <% else %>
          <% if @sort == field %>
            <span class="adminicon sort <%= @order %>"></span>
          <% end %>
          <% order = @sort == field ? (@order == :asc ? :desc : :asc) : :asc %>
          <a href="<%== @sort_url %>?sort=<%= u(field) %>&amp;order=<%= order %>">
            <%= label %>
          </a>
        <% end %>
      </th>
    <% end %>
  </tr>
</thead>
