<div id="articles">
  <h1>Articles</h1>

  <% @categories.each do |category| %>
    <h3 class="title"><%= category.name %></h3>

    <div class="category">
      <% category.articles.nodrafts.ordered.each do |article| %>
        <div class="article-list">
          <div class="title">
            <% if cuser and !article.read_by? cuser %>
              <span class="new">NEW</span>
            <% end %>

            <%= namelink article %>
          </div>
          <div class="meta">
            <span class="author">
              <%= namelink article.user %>
            </span>
            <span class="date">
              on <%= longdate article.created_at %>
            </span>
          </div>
        </div>
      <% end %>
    </div>
  <% end %>

  <% if Article.new.can_create? cuser %>
    <%= link_to 'New Article', new_article_path, class: 'button new' %>
  <% end %>
</div>
  