Accès aux flux rss par région
This commit is contained in:
parent
97d285e497
commit
bd2dca40c8
@ -66,7 +66,7 @@ main
|
||||
margin: 10px 5px 5px 5px
|
||||
letter-spacing: 2px
|
||||
h2
|
||||
margin: 52px 0px 18px
|
||||
margin: 52px 0px 20px
|
||||
h3
|
||||
margin: 1.1em 0 1em
|
||||
font-size: 1.2em
|
||||
@ -85,7 +85,7 @@ main
|
||||
margin: 10px 20px
|
||||
|
||||
footer.bottom nav
|
||||
margin: 18px auto -3px
|
||||
margin: 26px auto -3px
|
||||
font-size: smaller
|
||||
a + a:before
|
||||
color: black
|
||||
|
@ -30,9 +30,6 @@ table.calendar + h2
|
||||
|
||||
table.calendar
|
||||
width: 90%
|
||||
margin: 0 auto
|
||||
padding: 0
|
||||
border-spacing: 2px
|
||||
tr
|
||||
th
|
||||
padding-bottom: 0.35em
|
||||
@ -78,14 +75,15 @@ table.calendar
|
||||
|
||||
ul
|
||||
clear: left
|
||||
margin-top: 0
|
||||
margin-left: 0
|
||||
padding-left: 15px
|
||||
margin-bottom: 5px
|
||||
list-style-type: circle
|
||||
li
|
||||
color: #444
|
||||
margin: 0
|
||||
padding: 0
|
||||
margin-bottom: 5px
|
||||
|
||||
.event
|
||||
font-size: smaller
|
||||
@ -101,7 +99,7 @@ table.calendar
|
||||
|
||||
.formats
|
||||
width: 90%
|
||||
margin: 10px auto
|
||||
margin: 11px auto 28px
|
||||
font-size: smaller
|
||||
text-align: right
|
||||
|
||||
|
@ -1,17 +1,20 @@
|
||||
@import "compass"
|
||||
|
||||
table
|
||||
margin: 1em auto
|
||||
padding: 1em
|
||||
border-spacing: 0
|
||||
margin: auto
|
||||
border-spacing: 2px
|
||||
th
|
||||
padding: 0.3em 0.6em
|
||||
|
||||
table.list
|
||||
&.list
|
||||
width: 30%
|
||||
tr:nth-child(odd)
|
||||
background-color: #D1EAFF
|
||||
tr:nth-child(even)
|
||||
background-color: #C9E2F5
|
||||
td
|
||||
text-align: left
|
||||
//tr:nth-child(even) td
|
||||
// border-bottom: solid thin #ddf
|
||||
//tr:nth-child(odd) td
|
||||
// border-bottom: solid thin #fdd
|
||||
padding: 0.2em
|
||||
|
||||
.view_link:link, .edit_link:link, .delete_link:link
|
||||
font-size: 0
|
||||
|
@ -21,7 +21,7 @@ class EventsController < InheritedResources::Base
|
||||
}
|
||||
|
||||
format.rss {
|
||||
@events = @events.where('start_time >= now()').order(start_time: :asc).limit(25)
|
||||
@events = @events.future.limit(25)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
5
app/controllers/regions_controller.rb
Normal file
5
app/controllers/regions_controller.rb
Normal file
@ -0,0 +1,5 @@
|
||||
class RegionsController < InheritedResources::Base
|
||||
def index
|
||||
@regions = Region.all
|
||||
end
|
||||
end
|
@ -5,13 +5,18 @@ class Event < ActiveRecord::Base
|
||||
|
||||
default_scope { where moderated: 1 }
|
||||
|
||||
scope :future, -> {
|
||||
where('start_time >= now() and end_time <= ?', Date.today + 30)
|
||||
.order(:start_time)
|
||||
}
|
||||
scope :year, -> year {
|
||||
where "end_time >= ? and start_time < ?",
|
||||
"#{year}-1-1", "#{year.to_i+1}-1-1"
|
||||
}
|
||||
scope :month, -> year, month {
|
||||
where "end_time >= ? and start_time < ?",
|
||||
"#{year}-#{month.to_i-1}-1", "#{year}-#{month.to_i+2}-1"
|
||||
where 'end_time >= ? and start_time <= ?',
|
||||
"#{year}-#{month.to_i-1}-23",
|
||||
"#{month == '12' ? year.to_i+1 : year}-#{month == '12' ? 1 : month.to_i+1}-7"
|
||||
}
|
||||
scope :region, -> region { where region: region }
|
||||
scope :tag, -> tag { where "tags like ?", "%#{tag}%" }
|
||||
|
@ -1,3 +1,5 @@
|
||||
class Region < ActiveRecord::Base
|
||||
has_many :lugs, foreign_key: :region
|
||||
|
||||
default_scope order(:name)
|
||||
end
|
||||
|
@ -38,5 +38,7 @@
|
||||
|
||||
.formats
|
||||
=t '.calendar_in'
|
||||
= link_to 'rss', events_url(:rss)
|
||||
, iCal ou calendrier Google
|
||||
= link_to('rss', events_url(:rss))+','
|
||||
= link_to 'iCal', events_url(:rss)
|
||||
ou
|
||||
= link_to 'calendrier Google', events_url(:rss)
|
||||
|
@ -24,7 +24,7 @@ xml.tag! 'rdf:RDF', 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
|
||||
for event in @events
|
||||
xml.item 'rdf:about' => event_url(event) do
|
||||
xml.title "#{event.city}: #{event.title}, #{l event.start_time.to_date, format: :long}"
|
||||
xml.title "#{event.city}: #{event.title}, le #{l event.start_time.to_date, format: :long}"
|
||||
xml.link event_url event
|
||||
xml.tag! 'dc:identifier', "#{event.id}@agendadulibre.org"
|
||||
xml.tag! 'dc:date', event.start_time
|
||||
|
@ -59,7 +59,7 @@
|
||||
%footer.bottom
|
||||
%nav
|
||||
= link_to t('.propose'), new_event_path
|
||||
= link_to t('.rss'), events_url(:rss)
|
||||
= link_to t('.rss'), regions_url
|
||||
= link_to t('.ical'), users_url
|
||||
= link_to t('.map'), users_url
|
||||
= link_to t('.tags'), users_url
|
||||
|
25
app/views/regions/index.html.haml
Normal file
25
app/views/regions/index.html.haml
Normal file
@ -0,0 +1,25 @@
|
||||
%h2=t '.title'
|
||||
|
||||
%p Chaque flux RSS liste les évènements pour les 30 prochains jours en cours dans une région donnée. En vous abonnant à un flux régional, vous recevrez des informations sur les évènements de votre région à portée locale, mais également les évènements à portée nationale comme les RMLL.
|
||||
|
||||
%table.list
|
||||
%tr
|
||||
%td=t :all, scope: 'activerecord.attributes.region.name_values'
|
||||
%td= link_to :rss, events_path(format: :rss, region: :all)
|
||||
|
||||
- @regions.each do |region|
|
||||
%tr
|
||||
%td= region.name
|
||||
%td= link_to :rss, events_path(format: :rss, region: region.id)
|
||||
|
||||
:markdown
|
||||
Quelques fonctionnalités intéressantes des flux RSS :
|
||||
|
||||
* Vous pouvez limiter les évènements d'un flux RSS à un certain tag, en
|
||||
passant le paramètre `tag`. Cela permet par exemple de récupérer un flux RSS
|
||||
des évènements organisés uniquement par votre association, à partir du moment
|
||||
où vous pensez à marquer tous vos évènements avec un tag précis.
|
||||
Exemple: `http://www.agendadulibre.org/rss.php?tag=toulibre`.
|
||||
* Vous pouvez modifier la limite aux 30 prochains jours des flux RSS en
|
||||
utilisant le paramètre `daylimit`.
|
||||
Exemple: `http://www.agendadulibre.org/rss.php?region=6&daylimit=42`
|
@ -4,4 +4,4 @@
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register_alias "text/html", :iphone
|
||||
|
||||
#Mime::Type.register "text/xml", :rss
|
||||
Mime::Type.register "text/xml", :rss
|
||||
|
@ -50,6 +50,9 @@ fr:
|
||||
url: URL
|
||||
contact: Contact
|
||||
submitter: Soumetteur
|
||||
region:
|
||||
name_values:
|
||||
all: Toutes les régions
|
||||
|
||||
helpers:
|
||||
submit:
|
||||
@ -102,3 +105,6 @@ fr:
|
||||
form:
|
||||
save: Valider
|
||||
visualise: Visualiser
|
||||
regions:
|
||||
index:
|
||||
title: Liste des flux RSS
|
||||
|
@ -1,4 +1,5 @@
|
||||
AgendaDuLibreRails::Application.routes.draw do
|
||||
resources :regions, only: :index
|
||||
resources :events
|
||||
resources :users
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user