Taking only future events for the ical format
This commit is contained in:
parent
95edd455a5
commit
5807c44b70
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user