Ajout de la page "agenda"
This commit is contained in:
parent
8b5cac4229
commit
6500df7659
9
app/assets/stylesheets/public/events.css.scss
Normal file
9
app/assets/stylesheets/public/events.css.scss
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#events_large{
|
||||||
|
|
||||||
|
.event{
|
||||||
|
margin-top:2em;
|
||||||
|
padding-bottom:2em;
|
||||||
|
border-bottom:1px solid gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
60
app/controllers/public/events_controller.rb
Normal file
60
app/controllers/public/events_controller.rb
Normal file
@ -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.<br /><br />Vous avez donc été redirigé sur notre page d'accueil"
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
23
app/views/public/events/index.html.haml
Normal file
23
app/views/public/events/index.html.haml
Normal file
@ -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
|
@ -64,7 +64,7 @@
|
|||||||
|
|
||||||
=render Event.after(Time.now.beginning_of_day).order(:start_at).limit(3)
|
=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
|
#articles
|
||||||
|
@ -8,8 +8,8 @@ development:
|
|||||||
encoding: utf8
|
encoding: utf8
|
||||||
database: jfn_app
|
database: jfn_app
|
||||||
pool: 5
|
pool: 5
|
||||||
username: jfn_app
|
username: root
|
||||||
password: dev
|
|
||||||
socket: /tmp/mysql.sock
|
socket: /tmp/mysql.sock
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
@ -7,6 +7,10 @@ Crossey2::Application.routes.draw do
|
|||||||
|
|
||||||
#blog
|
#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"
|
match "blog_ecologie/categorie/:slug.:f"=> "public/articles#category", :as => :category_public_article, :f => "html"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user