diff --git a/app/assets/stylesheets/public/events.css.scss b/app/assets/stylesheets/public/events.css.scss new file mode 100644 index 0000000..2de7be0 --- /dev/null +++ b/app/assets/stylesheets/public/events.css.scss @@ -0,0 +1,9 @@ +#events_large{ + +.event{ +margin-top:2em; +padding-bottom:2em; +border-bottom:1px solid gray; +} + +} \ No newline at end of file diff --git a/app/controllers/public/events_controller.rb b/app/controllers/public/events_controller.rb new file mode 100644 index 0000000..2ae9ff5 --- /dev/null +++ b/app/controllers/public/events_controller.rb @@ -0,0 +1,60 @@ +# -*- encoding : utf-8 -*- + +class Public::EventsController < ApplicationController + + layout "public" + + def index + + @events = Event.after(Time.now.beginning_of_day).order(:start_at) + + + + + @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 + @article = Article.find_by_slug(params[:slug]) + + if @article and @article.enabled + + @title = @article.title + + else + redirect_to "/", :notice => "La page que vous demandez n'a pas pu être trouvée.

Vous avez donc été redirigé sur notre page d'accueil" + + end + end + + +end diff --git a/app/views/public/events/index.html.haml b/app/views/public/events/index.html.haml new file mode 100644 index 0000000..70ae1aa --- /dev/null +++ b/app/views/public/events/index.html.haml @@ -0,0 +1,23 @@ + + + +-content_for :sidebar do + + + + =render :partial => "public/articles/sidebar_recents" + + .widget + %h2 Profitez de mon expérience ! + =link_to "Conférences, sorties, études...", "/pages/presentation/profitez-de-mon-experience.html" + + +-content_for :body do + .breadcumbs + =link_to "Accueil", "/" + > + Agenda + + %h1 Agenda + + #events_large=render @events \ No newline at end of file diff --git a/app/views/public/home/home.html.haml b/app/views/public/home/home.html.haml index f91cee3..9668ffa 100644 --- a/app/views/public/home/home.html.haml +++ b/app/views/public/home/home.html.haml @@ -64,7 +64,7 @@ =render Event.after(Time.now.beginning_of_day).order(:start_at).limit(3) - + =link_to "voir la suite.", public_events_path, :style => "display:block;padding-top:15px;text-align:right" #articles diff --git a/config/database.yml b/config/database.yml index b46df3e..408e663 100644 --- a/config/database.yml +++ b/config/database.yml @@ -8,8 +8,8 @@ development: encoding: utf8 database: jfn_app pool: 5 - username: jfn_app - password: dev + username: root + socket: /tmp/mysql.sock # Warning: The database defined as "test" will be erased and diff --git a/config/routes.rb b/config/routes.rb index e2ed761..5442d66 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -7,6 +7,10 @@ Crossey2::Application.routes.draw do #blog + match "agenda.:f"=> "public/events#index", :as => :public_events, :f => "html" + + + match "blog_ecologie/categorie/:slug.:f"=> "public/articles#category", :as => :category_public_article, :f => "html"