Class: FestivityEventsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- FestivityEventsController
- Includes:
- Festivity::Mixins::NotFound
- Defined in:
- app/controllers/festivity_events_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
caches_action :show.
- #show ⇒ Object
Instance Method Details
#index ⇒ Object
caches_action :show
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/festivity_events_controller.rb', line 8 def index order_by = params[:sort] ? params[:sort] : "start_date" @title = "#{current_site.festivity_festival_name}: Events" @events = Rails.cache.fetch("#{cache_key}", expires_in: 2.hours) do FestivityEventList.search( {dates: search_dates.join(","), categories: params[:categories]}, order_by).events end @selected_dates = params[:dates] ? params[:dates].split(",") : [] @selected_categories = params[:categories] ? params[:categories].split(",") : [] @selected_sort = order_by # If the request is AJAX, only return the event list itself, not the full page if request.xhr? render partial: "event_list" else render 'index' end end |
#show ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/festivity_events_controller.rb', line 31 def show @event = FestivityEventPage.find_by_slug_and_status_id(params[:id], Status[:published].id) if @event @page = @event @related_events = FestivityEventList.( {dates: search_dates.join(","), event_id: @event.id, categories: @event.festivity_categories.map{|cat| cat.id}}).events @title = "#{current_site.festivity_festival_name}: #{@event.title}" else file_not_found_for_site end end |