<div class="categories">
  <h1 class="title">Listing Categories</h1>

  <% Category.new.domains.each do |key, domain| %>
    <h3 class="title"><%=h domain %></h3>

    <table class="categories striped">
      <tr>
        <th class="name">Name</th>
        <th class="actions"></th>
      </tr>
      <% @categories.each do |category| %>
        <% if category.domain == key %>
          <tr>
            <td><%=h category.name %></td>
            <td class="actions">
              <%= link_to icon('chevron-up'), controller: :categories, action: "up", id: category.id %>
              <%= link_to icon('chevron-down'), controller: :categories, action: "down", id: category.id %>
              <%= link_to icon('pencil'), edit_category_path(category) %>
              <%= link_to icon('times'), category, :confirm => 'Are you sure?', :method => :delete %>
            </td>
          </tr>
        <% end %>
      <% end %>
    </table>
  <% end %>

  <%= link_to 'New Category', new_category_path, class: 'button' %>
</div>