Meilleure gestion des traductions pour les dates
This commit is contained in:
parent
665fc69b14
commit
c31ed7e0a2
10
Gemfile.lock
10
Gemfile.lock
@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: git://github.com/gregbell/active_admin.git
|
||||
revision: 35f2f8a934fe3fc3f35bac9d7e8b624d9236e04d
|
||||
revision: 83059dc2894b7d887cb1a6061fbde741bd4d1854
|
||||
specs:
|
||||
activeadmin (1.0.0.pre)
|
||||
arbre (~> 1.0, >= 1.0.2)
|
||||
@ -133,7 +133,7 @@ GEM
|
||||
em-websocket (~> 0.5)
|
||||
guard (~> 2.0)
|
||||
multi_json (~> 1.8)
|
||||
guard-minitest (2.3.1)
|
||||
guard-minitest (2.3.2)
|
||||
guard (~> 2.0)
|
||||
minitest (>= 3.0)
|
||||
guard-rubocop (1.1.0)
|
||||
@ -193,7 +193,7 @@ GEM
|
||||
parser (2.2.0.pre.4)
|
||||
ast (>= 1.1, < 3.0)
|
||||
slop (~> 3.4, >= 3.4.5)
|
||||
polyamorous (1.0.0)
|
||||
polyamorous (1.1.0)
|
||||
activerecord (>= 3.0)
|
||||
polyglot (0.3.5)
|
||||
powerpack (0.0.9)
|
||||
@ -226,12 +226,12 @@ GEM
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.0.0)
|
||||
rake (10.3.2)
|
||||
ransack (1.2.3)
|
||||
ransack (1.3.0)
|
||||
actionpack (>= 3.0)
|
||||
activerecord (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
i18n
|
||||
polyamorous (~> 1.0.0)
|
||||
polyamorous (~> 1.1)
|
||||
rb-fsevent (0.9.4)
|
||||
rb-inotify (0.9.5)
|
||||
ffi (>= 0.5.0)
|
||||
|
@ -11,7 +11,12 @@ header.calendar-header
|
||||
|
||||
.city:after
|
||||
content: ':'
|
||||
margin-right: -1px
|
||||
|
||||
p.full_address
|
||||
span:after
|
||||
content: ','
|
||||
span:last-child:after
|
||||
content: ''
|
||||
|
||||
body.events.index table
|
||||
width: 90%
|
||||
|
@ -24,6 +24,19 @@ module EventsHelper
|
||||
}
|
||||
end
|
||||
|
||||
def display_date(event = @event)
|
||||
if event.same_day?
|
||||
t 'date.formats.same_day',
|
||||
date: l(event.start_time.to_date, format: :long),
|
||||
start: l(event.start_time, format: :hours),
|
||||
end: l(event.end_time, format: :hours)
|
||||
else
|
||||
t 'date.formats.period',
|
||||
start: l(event.start_time, format: :at),
|
||||
end: l(event.end_time, format: :at)
|
||||
end
|
||||
end
|
||||
|
||||
def wrap(s, width = 78)
|
||||
s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ xml.rdf :RDF,
|
||||
xml.item 'rdf:about' => event_url(event) do
|
||||
title = event.city
|
||||
title += ": #{event.title}"
|
||||
xml.title title + ", le #{l event.start_time.to_date, format: :long}"
|
||||
xml.title title + ", #{l event.start_time.to_date, format: :long}"
|
||||
xml.link event_url event
|
||||
domain = root_url.gsub(/www/, '').gsub(/http.?:../, '').gsub(/:.*/, '')
|
||||
xml.dc :identifier, "#{event.id}@#{domain}"
|
||||
|
@ -32,21 +32,13 @@
|
||||
|
||||
%h3=t '.dateAndPlace'
|
||||
|
||||
%p
|
||||
- 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}.
|
||||
- else
|
||||
Du
|
||||
=l @event.start_time, format: :at
|
||||
au
|
||||
#{l @event.end_time, format: :at}.
|
||||
%p= display_date
|
||||
|
||||
%p
|
||||
= raw [@event.address.present? ? @event.address : nil,
|
||||
link_to(@event.city, "http://fr.wikipedia.org/wiki/#{url_encode @event.city}"),
|
||||
link_to(@event.related_region.try(:name),
|
||||
"http://fr.wikipedia.org/wiki/#{url_encode @event.related_region.name}")].compact.join(', ')
|
||||
%p.full_address
|
||||
%span= @event.address
|
||||
%span= link_to @event.city, "http://fr.wikipedia.org/wiki/#{url_encode @event.city}"
|
||||
%span= link_to @event.related_region.try(:name),
|
||||
"http://fr.wikipedia.org/wiki/#{url_encode @event.related_region.name}"
|
||||
|
||||
- if @event.latitude && @event.longitude
|
||||
#map(latitude="#{@event.latitude}" longitude="#{@event.longitude}")
|
||||
|
@ -22,15 +22,7 @@
|
||||
- @events.each do |event|
|
||||
%tr
|
||||
%td= event.title
|
||||
%td
|
||||
- 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}
|
||||
- else
|
||||
Du
|
||||
=l event.start_time, format: :at
|
||||
au
|
||||
=l event.end_time, format: :at
|
||||
%td= display_date event
|
||||
%td= event.city
|
||||
%td= event.related_region.name
|
||||
%td= time_ago_in_words event.submission_time
|
||||
|
@ -2,36 +2,24 @@
|
||||
=t '.title'
|
||||
%em= params[:id]
|
||||
|
||||
%p=raw t '.future', count: @events_future.count
|
||||
%ul
|
||||
- if @events_future.any?
|
||||
%p=raw t '.future', count: @events_future.count
|
||||
%ul
|
||||
- @events_future.find_each do |event|
|
||||
%li
|
||||
%div
|
||||
= link_to event do
|
||||
%em.city= event.city
|
||||
= event.title
|
||||
- if event.same_day?
|
||||
le
|
||||
=l event.start_time.to_date, format: :long
|
||||
- else
|
||||
du
|
||||
=l event.start_time.to_date, format: :long
|
||||
au
|
||||
=l event.end_time.to_date, format: :long
|
||||
= display_date event
|
||||
|
||||
%p=raw t '.past', count: @events_past.count
|
||||
%ul
|
||||
- if @events_past.any?
|
||||
%p=raw t '.past', count: @events_past.count
|
||||
%ul
|
||||
- @events_past.find_each do |event|
|
||||
%li
|
||||
%div
|
||||
= link_to event do
|
||||
%em.city= event.city
|
||||
= event.title
|
||||
- if event.same_day?
|
||||
le
|
||||
=l event.start_time.to_date, format: :long
|
||||
- else
|
||||
du
|
||||
=l event.start_time.to_date, format: :long
|
||||
au
|
||||
=l event.end_time.to_date, format: :long
|
||||
= display_date event
|
||||
|
@ -11,6 +11,8 @@ fr:
|
||||
formats:
|
||||
long: "%A %d %B %Y"
|
||||
month: "%B %Y"
|
||||
period: Du %{start} au %{end}.
|
||||
same_day: Le %{date} de %{start} au %{end}.
|
||||
time:
|
||||
formats:
|
||||
at: "%A %d %B %Y à %Hh%M"
|
||||
|
Loading…
Reference in New Issue
Block a user