Taking only future events for the ical format

remotes/origin/master
echarp 4 years ago
parent 95edd455a5
commit 5807c44b70
  1. 2
      app/controllers/events_controller.rb
  2. 1
      app/models/event.rb
  3. 2
      app/views/events/_event.haml
  4. 4
      app/views/events/index.html.haml

@ -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…
Cancel
Save