This commit is contained in:
Nicolas Bally 2014-12-17 23:07:57 +01:00
parent fd7f028064
commit a49b163724
3 changed files with 18 additions and 4 deletions

View File

@ -12,7 +12,7 @@ class Public::ArticlesController < ApplicationController
@articles = Article.before(Date.today).recents @articles = Article.before(Date.today).recents
@articles = @articles.page(params[:page]).per(3) @articles = @articles.page(params[:page]).per(12)
@title = "Articles du blog" @title = "Articles du blog"
@ -70,7 +70,7 @@ class Public::ArticlesController < ApplicationController
def archives def archives
@month = Date.parse("#{params[:year]}/#{params[:month]}").beginning_of_month @month = Date.parse("#{params[:year]}/#{params[:month]}").beginning_of_month
@articles = Article.recents.where("enabled = ? and published_at > ? and published_at < ?", true, @month, @month.end_of_month ).before(Date.today) @articles = Article.recents.where("enabled = ? and published_at > ? and published_at < ?", true, @month, @month.end_of_month ).before(Date.today)
@articles = @articles.page(params[:page]).per(3) @articles = @articles.page(params[:page]).per(12)
@title = "Articles du blog" @title = "Articles du blog"
if [4,8].include?(@month.month) if [4,8].include?(@month.month)
@index_title = 'Articles du mois d\''+l(@month, :format => "%B %Y")+'' @index_title = 'Articles du mois d\''+l(@month, :format => "%B %Y")+''

View File

@ -106,7 +106,7 @@
=#render Event.recents.limit(2) =#render Event.recents.limit(2)
dsfdfs
=yield :sidebar =yield :sidebar
.clear .clear

View File

@ -1,5 +1,19 @@
-if @articles.size > 0 -if @articles.size > 0
=render :partial => "public/articles/article", :collection => @articles, :as => "article"
-articles = @articles
-if articles
.articles
-articles.each do |article|
%a{:href => public_article_path(:id => article.slug)}
.article
.image=image_tag article.image_file.file.large.medium.url if article.image_file
.description
%h2=article.title
.clear
#articles_pagination= paginate @articles #articles_pagination= paginate @articles
-else -else
%p %p