<% @page_heading = _('Manage articles') %>
<% subtabs_for(:content) %>

<%= render :partial => "drafts" %>

<div class="list" id="articles">	
  <% form_remote_tag  :url      => {:action => 'index'},
  :method   => :get,
  :name     => 'article',
  :update   => {:success => 'articleList'},
  :before   => "Element.show('spinner')",
  :complete => "Element.hide('spinner')" \
  do %>

  <label for="search"><%= _("Search articles that contains...")%></label><br />  
  <input id="search" type="text" name="search[searchstring]" size="30" />
  <%= submit_tag _("Search") %>
  <span id='spinner' style="display:none;"><%= image_tag('spinner.gif') %></span>

  <table>
    <tr>
      <th><%= _("Title") %></th>
      <th><%= _("Categories") %></th>
      <th><%= _("Date") %></th>
      <th><%= _("Author")%></th>
      <th><%= _("Status") %></th>
      <th><%= _("Feedback")%></th>
    </tr>
    <tr class="menubar">
      <td>&nbsp;</td>
      <td><%= collection_select_with_current('search', 'category', @categories, "id", "name", @search[:category].to_i, true)
      %></td>
      <td>
        <%= collection_select_with_current(:search, :published_at, Article.find_by_published_at, "publication", "publication", @search[:published_at], true) %>
      </td>
      <td><%= collection_select_with_current(:search, :user_id, User.find(:all), "id", "name", @search[:user_id].to_i, true) %></td>
      <td>
        <select name="search[published]">
          <option value="">Please select</option>
          <option value="0">Unpublished</option>
          <option value="1">Published</option>
        </select>
      </td>
      <td><input type="submit" value='<%= _("Filter") %>' />
      </tr>
      <tbody id="articleList">
        <%= render :partial => 'article_list', :object => @articles -%>
      </tbody>
    </table>

    <%end%>
  </div>                      
