Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embedded iframe for videos #34

Merged
merged 16 commits into from
May 4, 2023
Merged

embedded iframe for videos #34

merged 16 commits into from
May 4, 2023

Conversation

summer-cook
Copy link
Contributor

@summer-cook summer-cook commented Apr 28, 2023

Story

SoftServ will customize the ability for YouTube videos to appear embedded on a work show page. Videos will not be played back in Universal Viewer.

Related

Expected Behavior Before Changes

  • all works that should show a UV show them
  • users would only see either the uv viewer or default image

Expected Behavior After Changes

  • If a work has a valid video_embed link saved in its metadata, the work show page will show that video in an iframe.
  • If a work does not have a valid video_embed link saved in its metadata, but should show the universal viewer because it has files, it shows the viewer.
  • If a work does not have either video_embed metadata or files to show in the viewer, it shows the default image.

Screenshots / Video

Working youtube player image
Working vimeo player image
Form with error message for invalid url entry image

Acceptance

  • Users should be able to add a video embed link from the work-edit page in the dashboard
  • Users can see help text explaining the format for the links, as well as more in depth directions for how to find the link in the project readme
  • The field should support embed links for either youtube or vimeo links
  • The field should not support urls that are not valid youtube or vimeo links in the formats provided in the help text.
  • On the work show page, the user should be able to see the embedded video if they add a link
  • If there is no link added, the work show page will show the UV or the default image (behavior would be the same and prior to this implementation)
  • All 3 show page (cultural, scholarly, default) themes should support the video-embed viewer

Note

  • ability to import the video-embed links with bulkrax will be done in the bulkrax configuration ticket
  • this still needs to be added to the 2 other worktypes which are in flight

@summer-cook summer-cook reopened this Apr 28, 2023
private
def extract_video_embed_presence
Copy link
Contributor Author

@summer-cook summer-cook May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to set this up this way because when i was trying to use solr_document above the private methods, it was giving me an error that solr_document was private.

I also got a similar error (screenshot below) when trying to use. presenter.solr_document directly in the view. only using it /calling the private method in the presenter itself seems to have fixed that issue

Screen Shot 2023-05-02 at 9 42 25

<%# OVERRIDE here to hide broken flash messages on the dashboard edit work pages. %>
<%# regex includes only the paths for works since this is the only known place flash messages are broken. %>
<% if !controller.request.env['REQUEST_PATH'].include?('concern') %>
<%= render '/flash_msg' %>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although we originally said to remove the whole partial, that didn't really make sense since this is the flash message that is being used everywhere in the dashboard.
It is not necessarily broken everywhere in the dashboard, but it is for validations on works.
This conditional only removes the flash message if the path includes "concern" which is only on works

@summer-cook summer-cook marked this pull request as ready for review May 2, 2023 19:13
<%= render 'representative_media', presenter: @presenter, viewer: false unless @presenter.iiif_viewer? %>
<% if !@presenter.video_embed_viewer? %>
<%= render 'representative_media', presenter: @presenter, viewer: false unless @presenter.universal_viewer? %>
<% end %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<% end %>
<%= render 'representative_media', presenter: @presenter, viewer: false unless @presenter.universal_viewer? && !@presenter.video_embed_viewer? %>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this work making it a single line?

Or maybe wrap the whole block like:

Suggested change
<% end %>
<% if @presenter.video_embed_viewer? %>
<%= render 'video_embed_viewer', presenter: @presenter %>
<% else %>
<% if @presenter.iiif_viewer? %>
<div class="col-sm-12">
<%= render 'representative_media', presenter: @presenter, viewer: true %>
</div>
<% else %>
<div class="col-sm-3 text-center">
<%= render 'representative_media', presenter: @presenter, viewer: false %>
</div>
<% end %>
<% end %>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to change it to this, its way easier to read

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and maybe this is contribute back-able so it would be less confusing in hyku

<% if @presenter.video_embed_viewer? %>
<%= render 'video_embed_viewer', presenter: @presenter %>
<% end %>
<% if @presenter.universal_viewer? & !@presenter.video_embed_viewer? %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just use and if/else statement here

Copy link
Collaborator

@labradford labradford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments are just suggestions, I think it's ok to approve. I do think the conditional rendering of the UV/Video/Representative media is a bit convoluted.

Great job remembering the themes!

@summer-cook
Copy link
Contributor Author

@labradford

My comments are just suggestions, I think it's ok to approve. I do think the conditional rendering of the UV/Video/Representative media is a bit convoluted.

Great job remembering the themes!

I know, originally i wanted to just put it in the representative_media partial and be done with it, but then that ALSO required changes to the show page since there are viewer related conditionals in there too. I will test out your suggestions though, thank you!

@summer-cook
Copy link
Contributor Author

@labradford i just pushed up the show page views again with your suggestions, but had to do some weird things with the default one to get the columns to work.
let me know if you want to take a look again

<%# OVERRIDE here to hide broken flash messages on the dashboard edit work pages. %>
<%# regex includes only the paths for works since this is the only known place flash messages are broken. %>
<%= render '/flash_msg' %>
<%#= raise 'hell' %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, this should be removed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants