docbrown/app/controllers/events_controller.rb
Andy Zhao cd9f6d9ada [Done] Add BDEFGI Policies and Specs (#487)
* Add comment for public controllers

* Add block policy and specs

* Add policy for authorizing dashboard

* Add follow policy and specs

* Refactor a tiny bit

* Prevent banned users from following anything

* Add a note for email sub controller about auth

* Add image upload policies

* Add policy for github repos

* Fix typo and use correct github repo variable

* Fix image uploader and use regular params

* Add authenticate_user before action back in

* Rename test

* Update slack bot message formatting and fix reported URL
2018-06-26 09:23:07 -04:00

15 lines
470 B
Ruby

class EventsController < ApplicationController
before_action :set_cache_control_headers, only: [:index]
# No authorization required for entirely public controller
def index
@events = Event.in_the_future_and_published.sort_by(&:starts_at)
@past_events = Event.in_the_past_and_published.sort_by(&:starts_at)
set_surrogate_key_header "events_index_page"
@past_events.reverse!
end
def show
@event = Event.find_by(slug: params[:id])
end
end