Browse Source

Consultation d'événement en place

recurrent
echarp 9 years ago
parent
commit
34f9e33fa5
  1. 22
      app/assets/stylesheets/all.css.sass
  2. 29
      app/assets/stylesheets/events.css.sass
  3. 4
      app/models/event.rb
  4. 1
      app/models/region.rb
  5. 19
      app/views/events/index.rss.builder
  6. 95
      app/views/events/show.html.haml
  7. 9
      config/locales/fr.yml

22
app/assets/stylesheets/all.css.sass

@ -61,8 +61,26 @@ header.top
margin-right: 0.6em
vertical-align: middle
main h1
margin-top: 1em
main
h1
margin: 10px 5px 5px 5px
letter-spacing: 2px
h2
margin: 52px 0px 18px
h3
margin: 1.1em 0 1em
font-size: 1.2em
text-align: left
ul, ol
margin: 10px 0px 10px 35px
text-align: left
li
margin-left: 2em
line-height: 1.3em
p
margin: 0.9em 0
line-height: 1.3em
text-align: justify
footer.bottom nav
margin: 29px auto -3px

29
app/assets/stylesheets/events.css.sass

@ -1,3 +1,5 @@
@import "compass"
form.region_selector
width: 98.4%
position: absolute
@ -11,9 +13,9 @@ main form.region_selector + h2
a
font-weight: normal
&.previous-month
margin-right: 0.35em
margin-right: 0.33em
&.next-month
margin-left: 0.35em
margin-left: 0.33em
// For whole year calendar
main form.region_selector + h2 + h2
@ -89,3 +91,26 @@ table.calendar
margin: 10px auto
font-size: smaller
text-align: right
#lug-list
float: right
width: 15em
border: 1px solid #96CFFF
margin: 5em 1.2em 0px
padding: 5px
font-size: 0.7em
background-color: #D6ECFF
@include border-radius(10px)
h1
font-size: 1.22em
line-height: 1.1em
font-weight: normal
border-bottom: 1px black solid
padding-bottom: 4px
ul
text-align: left
line-height: 1.2em
margin-left: 1em
li
margin-left: 2em
line-height: 1.3em

4
app/models/event.rb

@ -11,4 +11,8 @@ class Event < ActiveRecord::Base
}
scope :region, -> region { where region: region }
scope :tag, -> tag { where "tags like ?", "%#{tag}%" }
def same_day?
start_time.to_date == end_time.to_date
end
end

1
app/models/region.rb

@ -1,2 +1,3 @@
class Region < ActiveRecord::Base
has_many :lugs, foreign_key: :region
end

19
app/views/events/index.rss.builder

@ -31,16 +31,23 @@ xml.tag! 'rdf:RDF', 'xmlns:rdf' => "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xml.tag! 'georss:point', City.find_all_by_majname(event.city.upcase).collect { |c| "#{c.latitude} #{c.longitude}" }.first
content = "<h2><em>#{event.city}</em>: #{event.title}</h2>
<h3>Date et lieu</h3>
<p>#{l event.start_time.to_date, format: :long},
de #{event.start_time.hour}h#{event.start_time.min} à #{event.end_time.hour}h#{event.end_time.min}.</p>
<p>À <em><a href=\"http://fr.wikipedia.org/wiki/#{event.city}\">#{event.city}</a></em>,
<a href=\"http://fr.wikipedia.org/wiki/#{event.region.name}\">#{event.region.name}</a></p>
<h3>Date et lieu</h3>"
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.sub('@', ' CHEZ ').sub('.', ' POINT '), event.contact.sub('@', ' CHEZ ').sub('.', ' POINT ')}</p>
<p>Contact: #{mail_to event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT '), event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT ')}</p>
"
if (event.tags && event.tags.present?)

95
app/views/events/show.html.haml

@ -1,57 +1,54 @@
%p#notice= notice
%p
%b Title:
#lug-list
%h1=t '.lug-list'
%ul
- @event.region.lugs.order(department: :asc).each do |lug|
%li
= link_to lug.name, lug.url
(#{lug.department})
%h1 Actions
= link_to t('.add_to_calendar'), root_url
%h2
%em
= @event.city
\:
= @event.title
%h3
Date et lieu
%p
%b Description:
= @event.description
%p
%b Start time:
= @event.start_time
%p
%b End time:
= @event.end_time
%p
%b City:
= @event.city
%p
%b Region:
= @event.region.name
%p
%b Locality:
= @event.locality
%p
%b Url:
= @event.url
%p
%b Contact:
= @event.contact
%p
%b Submitter:
= @event.submitter
%p
%b Moderated:
= @event.moderated
%p
%b Tags:
= @event.tags
%p
%b Secret:
= @event.secret
%p
%b Decision time:
= @event.decision_time
- if @event.same_day?
Le #{l @event.start_time.to_date, format: :long},
de #{l @event.start_time, format: :hours} à #{l @event.end_time, format: :hours}.</p>
- else
Du
=l @event.start_time, format: :at
au
#{l @event.end_time, format: :at}.
%p
%b Submission time:
= @event.submission_time
À
%em
= link_to(@event.city, "http://fr.wikipedia.org/wiki/#{@event.city}") + ','
= link_to @event.region.name, "http://fr.wikipedia.org/wiki/#{@event.region.name}"
%h3 Description
=raw @event.description
%h3 Informations
%p
%b Moderator mail:
= @event.moderator_mail_id
Site Web:
= link_to @event.url, @event.url
%p
%b Submitter mail:
= @event.submitter_mail_id
Contact:
= mail_to @event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT '), @event.contact.gsub('@', ' CHEZ ').gsub('.', ' POINT ')
= link_to 'Edit', edit_event_path(@event)
\|
= link_to 'Back', events_path
- if (@event.tags && @event.tags.present?)
%p
Tags:
- @event.tags.split.each do |tag|
= link_to tag, events_url(tag: tag)

9
config/locales/fr.yml

@ -53,7 +53,11 @@ fr:
- Vendredi
- Samedi
formats:
long: "le %A %d %B %Y"
long: "%A %d %B %Y"
time:
formats:
at: "%A %d %B %Y à %Hh%M"
hours: "%Hh%M"
layouts:
application:
@ -73,3 +77,6 @@ fr:
index:
calendar_in: Ce calendrier en
all_regions: Toutes les régions
show:
lug-list: Groupes d'utilisateurs de la région
add_to_calendar: Ajouter à mon calendrier

Loading…
Cancel
Save