Skip to content
Extraits de code Groupes Projets
Valider c0059b68 rédigé par echarp's avatar echarp
Parcourir les fichiers

Le flux rss utilise la vue html pour constituer la description des événements

parent 21635d2c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -47,6 +47,9 @@ table.calendar ...@@ -47,6 +47,9 @@ table.calendar
color: #544f32 color: #544f32
font-size: 0.8em font-size: 0.8em
margin-top: -1px margin-top: -1px
.event
a:link, a:visited
color: #8F4900
&.future &.future
border-color: rgb(150, 207, 255) border-color: rgb(150, 207, 255)
background-color: #C6E5FF background-color: #C6E5FF
......
class Region < ActiveRecord::Base class Region < ActiveRecord::Base
has_many :lugs, foreign_key: :region has_many :lugs, foreign_key: :region
default_scope order(:name) default_scope { order(:name) }
end end
...@@ -28,31 +28,11 @@ xml.tag! 'rdf:RDF', 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ...@@ -28,31 +28,11 @@ xml.tag! 'rdf:RDF', 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml.link event_url event xml.link event_url event
xml.tag! 'dc:identifier', "#{event.id}@agendadulibre.org" xml.tag! 'dc:identifier', "#{event.id}@agendadulibre.org"
xml.tag! 'dc:date', event.start_time xml.tag! 'dc:date', event.start_time
xml.tag! 'georss:point', City.find_all_by_majname(event.city.upcase).collect { |c| "#{c.latitude} #{c.longitude}" }.first city = City.find_by_majname event.city.gsub('-', ' ').upcase
xml.tag! 'georss:point', "#{city.latitude} #{city.longitude}" rescue nil
content = "<h2><em>#{event.city}</em>: #{event.title}</h2> @event = event
<h3>Date et lieu</h3>" content = render file: '/events/show.html', locals: { rss: true }
if event.same_day?
content += "
<p>Le #{l event.start_time.to_date, format: :long},
de #{l event.start_time, format: :hours} à #{l event.end_time, format: :hours}.</p>
<p>À <em>#{link_to event.city, 'http://fr.wikipedia.org/wiki/'+event.city}</em>,
#{link_to event.region.name, 'http://fr.wikipedia.org/wiki/'+event.region.name}</p>"
else
content += "
<p>Du #{l event.start_time, format: :at} au #{l event.end_time, format: :at}.</p>"
end
content += "
<h3>Description</h3>
#{event.description}
<h3>Informations</h3>
<p>Site Web: <a href=\"#{event.url}\">#{event.url}</a></p>
<p>Contact: #{mail_to event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT '), event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT ')}</p>
"
if (event.tags && event.tags.present?)
content += "<p>Tags: #{event.tags.split.collect { |tag| link_to tag, events_url(tag: tag) }.join(', ')}</p>"
end
xml.description strip_tags(content) xml.description strip_tags(content)
xml.tag! 'content:encoded', content xml.tag! 'content:encoded', content
......
%p#notice= notice - if request.format == 'text/html'
%p#notice= notice
- if @event.id
#lug-list #lug-list
%h1=t '.lug-list' %h1=t '.lug-list'
- if @event.region - if @event.region
...@@ -14,13 +14,11 @@ ...@@ -14,13 +14,11 @@
= link_to t('.add_to_calendar'), root_url = link_to t('.add_to_calendar'), root_url
%h2 %h2
%em %em= @event.city
= @event.city \:
\:
= @event.title = @event.title
%h3 %h3 Date et lieu
Date et lieu
%p %p
- if @event.same_day? - if @event.same_day?
...@@ -34,8 +32,7 @@ ...@@ -34,8 +32,7 @@
%p %p
À À
%em %em= link_to(@event.city, "http://fr.wikipedia.org/wiki/#{@event.city}") + ','
= link_to(@event.city, "http://fr.wikipedia.org/wiki/#{@event.city}") + ','
= link_to @event.region.name, "http://fr.wikipedia.org/wiki/#{@event.region.name}" rescue nil = link_to @event.region.name, "http://fr.wikipedia.org/wiki/#{@event.region.name}" rescue nil
%h3 Description %h3 Description
...@@ -52,5 +49,4 @@ ...@@ -52,5 +49,4 @@
- if (@event.tags && @event.tags.present?) - if (@event.tags && @event.tags.present?)
%p %p
Tags: Tags:
- @event.tags.split.each do |tag| =raw @event.tags.split.collect { |tag| link_to tag, events_url(tag: tag) }.join(', ')
= link_to tag, events_url(tag: tag)
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone # Mime::Type.register_alias "text/html", :iphone
Mime::Type.register "text/xml", :rss Mime::Type.register_alias "text/xml", :rss
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter