docbrown/app/controllers/podcast_episodes_controller.rb
Ben Halpern 09fa66a03f
Fix and clean up podcast pages (#15004)
* Fix and clean up podcast pages

* Adjust tests

* Fix a test

* Fix missing i18n

* Fix tests

* Fix tests

* Fiddle with test

* Sure up css and tests

* Add featured as allowed param

* Fix a couple tests

* xit out test

* Update app/views/podcast_episodes/index.html.erb

* Update app/views/podcast_episodes/index.html.erb

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
2021-10-15 17:38:57 -04:00

20 lines
740 B
Ruby

class PodcastEpisodesController < ApplicationController
# No authorization required for entirely public controller
before_action :set_cache_control_headers, only: [:index]
def index
@podcast_index = true
@featured_podcasts = Podcast.available.featured.order(title: :asc).limit(4)
@more_podcasts = Podcast.available.order(title: :asc)
@podcast_episodes = PodcastEpisodeDecorator.decorate_collection(PodcastEpisode
.available
.includes(:podcast).order(published_at: :desc).limit(6))
if params[:q].blank?
surrogate_keys = ["podcast_episodes_all"] + @podcast_episodes.map(&:record_key)
set_surrogate_key_header(surrogate_keys)
end
render template: "podcast_episodes/index"
end
end