docbrown/app/controllers/podcast_episodes_controller.rb
Anna Buyanova 074d50d2b7 Stories views reorganization (#1317)
* Added stories feature specs

* Structure feature specs

* Spec for the articles by tag page

* Spec for clicking "week" button on the tag page

* Reorganize stories views

* Feature spec for displaying sponsors on tag page

* Increase allowed rspec example length

* Spec for the users comments view

* Articles by tag: reeplace view code with rendering partials
2018-12-13 14:54:02 -05:00

29 lines
1,018 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
@podcasts = Podcast.order("title asc")
@podcast_episodes = PodcastEpisode.order("published_at desc").first(20)
unless params[:q].present?
set_surrogate_key_header("podcast_episodes_all " + params[:q].to_s,
@podcast_episodes.map { |e| e["record_key"] })
end
@featured_story = Article.new
@article_index = true
@list_of = "podcast-episodes"
render template: "podcast_episodes/index"
end
private
def podcast_episode_params
params.require(:podcast_episode).permit(:title,
:body,
:image,
:social_image,
:remote_social_image_url,
:quote)
end
end