Libre en fête icons and banner added to the main calendar page

This commit is contained in:
echarp 2016-03-01 22:54:52 +01:00
parent ad748f04da
commit 8d7c7e7f02
5 changed files with 24 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
app/assets/images/lef.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -48,4 +48,10 @@ module EventsHelper
def wrap(s, width = 78) def wrap(s, width = 78)
s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n") s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
end end
# Select the events to display in a month, sorted
def month_events(events, date)
events.select { |e| (e.start_time.to_date..e.end_time.to_date).cover? date }
.sort_by(&:city)
end
end end

View File

@ -0,0 +1,8 @@
%li.event{ title: display_date(event) }
- if event.locality?
%em.locality.fa.fa-globe
- elsif event.tags.include? 'libre-en-fete'
= image_tag 'lef-small.png', alt: 'LEF', width: 16, height: 16
= link_to event do
%strong.city{ title: event.address }= event.city
= event.title

View File

@ -17,15 +17,7 @@
= month_calendar do |date| = month_calendar do |date|
- capture_haml do - capture_haml do
.day_number= date.day .day_number= date.day
%ul.events.fa-ul %ul.events.fa-ul= render month_events(@events, date)
- @events.select { |e| (e.start_time.to_date..e.end_time.to_date).cover? date }
- .sort_by { |e| e.city }.each do |event|
%li.event{ title: display_date(event) }
- if event.locality?
%em.locality.fa.fa-globe
= link_to event do
%strong.city{ title: event.address }= event.city
= event.title
- else - else
-# One month calendar -# One month calendar
@ -33,15 +25,7 @@
= month_calendar do |date| = month_calendar do |date|
- capture_haml do - capture_haml do
.day_number= date.day .day_number= date.day
%ul.events.fa-ul %ul.events.fa-ul= render month_events(@events, date)
- @events.select { |e| (e.start_time.to_date..e.end_time.to_date).cover? date }
- .sort_by { |e| e.city }.each do |event|
%li.event{ title: display_date(event) }
- if event.locality?
%em.locality.fa.fa-globe
= link_to event do
%strong.city{ title: event.address }= event.city
= event.title
.formats .formats
%em.fa.fa-rss %em.fa.fa-rss
@ -53,7 +37,11 @@
ical: link_to('iCal', events_path(:rss, ical: link_to('iCal', events_path(:rss,
tag: params[:tag], format: :ics, region: params[:region])) tag: params[:tag], format: :ics, region: params[:region]))
%a#banner(href='http://april.org/campagne') %a#banner(href='http://www.libre-en-fete.net')
= image_tag 'lef.png', width: '180', height: '60', alt: 'Libre en Fete'
/
%a#banner(href='http://april.org/campagne')
= image_tag 'priorite-logiciel-libre-je-soutiens-april_2_m.png', = image_tag 'priorite-logiciel-libre-je-soutiens-april_2_m.png',
width: '374', height: '48', width: '374', height: '48',
alt: 'Priorité au Logiciel Libre! Je soutiens l\'April.' alt: 'Priorité au Logiciel Libre! Je soutiens l\'April.'