Add 'related_videos' to video params

pull/352/head
Omar Roth 6 years ago
parent 276662a147
commit 2630dc8dcd

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

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

Loading…
Cancel
Save