* feat: #3498 Display episode's published_at * feat: #3498 Move methods to decorator * feat: #3498 Add check if published_at present * feat: #3498 Add testcase for showing published_at * Fix build failure #3498 https://travis-ci.com/thepracticaldev/dev.to/builds/130734935 * feat: #3498 Fix testcase failed on Travis 130738295 * feat: #3498 Address comments on PR #4272 * feat: #3498 Delete unused * feat: #3498 Refactor the use of decorate
35 lines
1.1 KiB
Ruby
35 lines
1.1 KiB
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.available.order("title asc")
|
|
@podcast_episodes = PodcastEpisodeDecorator.decorate_collection(PodcastEpisode.
|
|
available.
|
|
includes(:podcast).order("published_at desc").first(20))
|
|
|
|
if params[:q].blank?
|
|
surrogate_keys = ["podcast_episodes_all"] + @podcast_episodes.map(&:record_key)
|
|
set_surrogate_key_header(surrogate_keys)
|
|
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
|