%h1 Sommaire

-if Article.before(Date.today).recents.size > 0
  

  -first_month = Article.before(Date.today).where(:enabled => true).order(:published_at).first.published_at.beginning_of_month
  -last_month = Article.before(Date.today).where(:enabled => true).order(:published_at).last.published_at.beginning_of_month
  -the_month = last_month
  
  -while the_month >= first_month
    -articles = Article.before(Date.today).recents.where("enabled = ? and published_at > ? and published_at < ?", true, the_month.beginning_of_month, the_month.end_of_month )
    %h2=l(the_month.to_date, :format => :only_month)
    
  
    -articles.each do |article|
      %p= link_to article.title, public_article_path(:id => article.slug),:title => "La cabanne du lutin : "+article.title.to_s
      
    %hr
    -the_month = the_month.prev_month