From 72a194e9161536103b62c1920247ea7497687642 Mon Sep 17 00:00:00 2001 From: Josh McArthur Date: Tue, 16 Jan 2024 10:44:45 +1300 Subject: [PATCH] Add some conditionals to handle prerelease signs missing videos --- app/views/signs/_sign_of_the_day.html.haml | 2 +- app/views/signs/search.html.haml | 7 ++++--- app/views/signs/show.html.haml | 12 +++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/views/signs/_sign_of_the_day.html.haml b/app/views/signs/_sign_of_the_day.html.haml index 4a2574d44..c3a45a994 100644 --- a/app/views/signs/_sign_of_the_day.html.haml +++ b/app/views/signs/_sign_of_the_day.html.haml @@ -1,4 +1,4 @@ -- if sign.present? +- if sign.present? && sign.video .sign-of-the-day.text-center .column-block %h3= t('signs.sign_of_the_day') diff --git a/app/views/signs/search.html.haml b/app/views/signs/search.html.haml index 7317f3c12..26675f594 100644 --- a/app/views/signs/search.html.haml +++ b/app/views/signs/search.html.haml @@ -7,9 +7,10 @@ - @signs.each do |sign| .search-results__card - @query[:s] ? query_text = @query[:s].join(" ") : query_text = " " - .video-container.video--placeholder - %i.fi-play.play-button - = videojs_rails sources: { mp4: sign.video }, class: "normal", controlsList:"nodownload", controls: false, preload: "metadata", loop: true + - if sign.video + .video-container.video--placeholder + %i.fi-play.play-button + = videojs_rails sources: { mp4: sign.video }, class: "normal", controlsList:"nodownload", controls: false, preload: "metadata", loop: true -# %span.search-results--placeholder .clickable_link.small-12.small-centered %a.div_link{:href => "#{sign_url(sign.id)}"} diff --git a/app/views/signs/show.html.haml b/app/views/signs/show.html.haml index 63434b5c0..e4bef176b 100644 --- a/app/views/signs/show.html.haml +++ b/app/views/signs/show.html.haml @@ -28,11 +28,12 @@ %i.fi-plus %span.buttons-action.add-button-text Add to Vocab Sheet .videos.small-12.medium-5 - .video-container - %i.fi-play.play-button - = videojs_rails sources: { mp4: @sign.video }, class: "main_video video", controlsList:"nodownload", controls: true, preload: "metadata", loop: true - = play_video_button('signs.show.in_slow_motion', nil, class: 'float-left slow') - = play_video_button('signs.show.at_normal_speed', nil, class: 'float-left normal') + - if @sign.video + .video-container + %i.fi-play.play-button + = videojs_rails sources: { mp4: @sign.video }, class: "main_video video", controlsList:"nodownload", controls: true, preload: "metadata", loop: true + = play_video_button('signs.show.in_slow_motion', nil, class: 'float-left slow') + = play_video_button('signs.show.at_normal_speed', nil, class: 'float-left normal') .glosses-container.glosses.small-12.float-left %h2.main_gloss= @sign.gloss_main %h2.secondary_gloss= @sign.gloss_secondary @@ -44,6 +45,7 @@ .examples-container.clearfix.videos.small-12.small-centered.medium-5.medium-uncentered %h3= t('signs.show.usage_examples') - @sign.examples.each do |example| + - next unless example.video .typography.videos .video-container %i.fi-play.play-button