68 lines
1.4 KiB
Ruby
68 lines
1.4 KiB
Ruby
# -*- encoding : utf-8 -*-
|
|
|
|
class Public::EventsController < ApplicationController
|
|
|
|
layout "public"
|
|
|
|
def index
|
|
|
|
|
|
|
|
if params[:month] and params[:year]
|
|
|
|
@start_list_date = Date.new(params[:year].to_i, params[:month].to_i).beginning_of_month
|
|
@end_list_date = @start_list_date
|
|
|
|
|
|
|
|
|
|
else
|
|
@start_list_date = Time.now.beginning_of_month
|
|
@end_list_date = Event.order("start_at DESC").first.start_at.end_of_month.next_month
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
@title = "Agenda"
|
|
end
|
|
|
|
def category
|
|
|
|
|
|
|
|
|
|
@category = Category.find_by_slug(params[:slug])
|
|
@articles = @category.articles.recents
|
|
@articles = @articles.page(params[:page]).per(10)
|
|
@title = "Articles du blog"
|
|
@index_title = 'Articles de la catégorie "'+@category.name+'"'
|
|
render :action => :index
|
|
|
|
end
|
|
|
|
def archives
|
|
@month = Date.parse("#{params[:year]}/#{params[:month]}").beginning_of_month
|
|
@articles = Article.where("enabled = ? and published_at > ? and published_at < ?", true, @month, @month.end_of_month )
|
|
@articles = @articles.page(params[:page]).per(10)
|
|
@title = "Articles du blog"
|
|
if [4,8].include?(@month.month)
|
|
@index_title = 'Articles du mois d\''+l(@month, :format => "%B %Y")+''
|
|
else
|
|
@index_title = 'Articles du mois de '+l(@month, :format => "%B %Y")+''
|
|
end
|
|
|
|
render :action => :index
|
|
end
|
|
|
|
|
|
def show
|
|
end
|
|
|
|
|
|
end
|