Add 'related_videos' to video params

This commit is contained in:
Omar Roth 2019-02-04 15:28:51 -06:00
parent 276662a147
commit 2630dc8dcd
2 changed files with 8 additions and 3 deletions

View File

@ -725,6 +725,7 @@ end
def process_video_params(query, preferences)
autoplay = query["autoplay"]?.try &.to_i?
continue = query["continue"]?.try &.to_i?
related_videos = query["related_videos"]?
listen = query["listen"]? && (query["listen"] == "true" || query["listen"] == "1").to_unsafe
preferred_captions = query["subtitles"]?.try &.split(",").map { |a| a.downcase }
quality = query["quality"]?
@ -737,6 +738,7 @@ def process_video_params(query, preferences)
# region ||= preferences.region
autoplay ||= preferences.autoplay.to_unsafe
continue ||= preferences.continue.to_unsafe
related_videos ||= preferences.related_videos.to_unsafe
listen ||= preferences.listen.to_unsafe
preferred_captions ||= preferences.captions
quality ||= preferences.quality
@ -747,6 +749,7 @@ def process_video_params(query, preferences)
autoplay ||= DEFAULT_USER_PREFERENCES.autoplay.to_unsafe
continue ||= DEFAULT_USER_PREFERENCES.continue.to_unsafe
related_videos ||= DEFAULT_USER_PREFERENCES.related_videos.to_unsafe
listen ||= DEFAULT_USER_PREFERENCES.listen.to_unsafe
preferred_captions ||= DEFAULT_USER_PREFERENCES.captions
quality ||= DEFAULT_USER_PREFERENCES.quality
@ -756,6 +759,7 @@ def process_video_params(query, preferences)
autoplay = autoplay == 1
continue = continue == 1
related_videos = related_videos == 1
listen = listen == 1
video_loop = video_loop == 1
@ -793,6 +797,7 @@ def process_video_params(query, preferences)
quality: quality,
raw: raw,
region: region,
related_videos: related_videos,
speed: speed,
video_end: video_end,
video_loop: video_loop,

View File

@ -110,7 +110,7 @@
</div>
</div>
<div class="pure-u-1 <% if preferences && !preferences.related_videos && !plid %>pure-u-md-4-5<% else %>pure-u-md-3-5<% end %>">
<div class="pure-u-1 <% if params[:related_videos] || plid %>pure-u-md-3-5<% else %>pure-u-md-4-5<% end %>">
<div class="h-box">
<p>
<a href="/channel/<%= video.ucid %>">
@ -141,14 +141,14 @@
</div>
</div>
</div>
<% if !preferences || preferences && preferences.related_videos || plid %>
<% if params[:related_videos] || plid %>
<div class="pure-u-1 pure-u-md-1-5">
<% if plid %>
<div id="playlist" class="h-box">
</div>
<% end %>
<% if !preferences || preferences && preferences.related_videos %>
<% if params[:related_videos] %>
<div class="h-box">
<% if !rvs.empty? %>