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

Taking only future events for the ical format

parent 95edd455
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -14,8 +14,8 @@ class EventsController < ApplicationController
def index
respond_to do |format|
format.html
format.json { @events = @events.future }
format.ics { @events = @events.future }
format.json { @events = @events.future }
format.rss { @events = filter_for_rss }
format.xml
end
......
......@@ -44,7 +44,6 @@ class Event < ApplicationRecord
scope :moderated, ->(*) { where moderated: true }
scope :unmoderated, ->(*) { where moderated: false }
scope :last_year, -> { where '? <= end_time', 1.year.ago }
scope :past, -> { where 'start_time <= ?', Time.zone.now }
scope :future, -> { where '? <= end_time', Time.zone.now }
scope :daylimit, ->(nb) { where 'end_time <= ?', nb.to_i.days.from_now }
......
......@@ -6,5 +6,5 @@
= link_to event do
%strong.city{ title: event.address }= event.city
= event.title
- if event.repeat > 0
- if event.repeat.positive?
%em.fa.fa-repeat{ title: event.schedule }
......@@ -21,13 +21,13 @@
- else
-# One month calendar
- params[:start_date] ||= Time.zone.today.beginning_of_month
:ruby
params[:start_date] ||= Time.zone.today.beginning_of_month
set_meta_tags(
prev: url_for(start_date: params[:start_date].to_date - 1.month),
next: url_for(start_date: params[:start_date].to_date + 1.month)
)
- @events = @events.month params[:start_date]
@events = @events.month params[:start_date]
= month_calendar events: @events do |date, events|
- capture_haml do
.day_number= date.day
......
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