%h1 Articles
= link_to 'New Article', new_admin_article_path, class: 'btn btn-default'
= form_tag '#', method: :get, class: 'inline-form' do
= text_field_tag :search, params[:search], class: 'form-control inline-form', placeholder: 'search'
= select_tag(:status, options_for_select(%w"Archived Published Drafts", params[:status]), include_blank: 'Status', class: 'form-control inline-form')
%table.table
%thead
%tr
%th
Article
%th
Tags
%th
Created At
%th
Actions
- @articles.each do |article|
%tr
%th
= article.title
%th
- article.tags.each do |tag|
= link_to tag, articles_path(search: tag)
%th
= article.created_at.strftime("%B %d")
%th
= article.draft ? link_to( 'Publish',admin_article_path(article, article: { draft: false }), method: :put, class: 'btn btn-xs btn-default') : link_to( 'Make Draft',admin_article_path(article, article: { draft: true }), method: :put, class: 'btn btn-xs btn-default')
= link_to 'Archive', admin_article_path(article, article: { archived: false } ), method: :put, class: 'btn btn-xs btn-default'
= link_to 'Delete', admin_article_path(article), method: :delete, class: 'btn btn-xs btn-default'
= link_to 'Edit', edit_admin_article_path(article), class: 'btn btn-xs btn-default'