* Change all login_as to sign_in * Unskip comment spec * Create new specs * Turn on Webdriver caching * Set logger for Omniauth in test * Update editor system spec * Fix editor approval file * Update video_controller * Update TagAdjustmentUpdateService's spec * Update users api spec * Update stories_index_spec * Remove redundant spec file * Remove residual code * Change ClassifiedListing spec * Update NotificationsIndex spec
30 lines
738 B
Ruby
30 lines
738 B
Ruby
class VideosController < ApplicationController
|
|
after_action :verify_authorized, except: %i[index]
|
|
before_action :set_cache_control_headers, only: %i[index]
|
|
|
|
def new
|
|
authorize :video
|
|
end
|
|
|
|
def index
|
|
@video_articles = Article.published.
|
|
where.not(video: [nil, ""], video_thumbnail_url: [nil, ""]).
|
|
where("score > ?", -4).
|
|
order("hotness_score DESC").
|
|
page(params[:page].to_i).per(24)
|
|
set_surrogate_key_header "videos_landing_page"
|
|
end
|
|
|
|
def create
|
|
authorize :video
|
|
@article = ArticleWithVideoCreationService.new(article_params, current_user).create!
|
|
|
|
redirect_to @article.path + "/edit"
|
|
end
|
|
|
|
private
|
|
|
|
def article_params
|
|
params.require(:article).permit(:video)
|
|
end
|
|
end
|