php_app/app/views/public/articles/archive.html.haml
Nicolas Bally 5cf3a3e83d initial
2014-11-25 22:56:20 +01:00

19 lines
829 B
Plaintext

%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