From 0b226fb94f4e5e9709d79f92e0e11cb703b50c36 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 27 Nov 2023 16:16:12 -0600 Subject: [PATCH] Remove dead code --- README.md | 28 +--------------------------- app/viewers/embed/viewer_factory.rb | 15 --------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/README.md b/README.md index 7230ce435..3a577e9a6 100644 --- a/README.md +++ b/README.md @@ -64,30 +64,4 @@ Example: `https://embed.stanford.edu/embed.json?url=http://purl.stanford.edu/zw2 The rich HTML payload that is supplied via the oEmbed API is an iframe. This means that all consumers will be embedding an iframe into their page. Given this fact, generating links will require explicit targets if they are not intended to internally replace embed content. Given this, there are two patterns that can be used. For links intended to download files, a `target="_blank"` can be used (effectively opening a new tab for the download which is immediately closed). When using `target="_blank"` add `rel="noopener noreferrer"` **particularly** when linking externally (although this should be reserved for linking to internal resources when possible). See [this blog post](https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/) for an explanation. *Note: This does not apply to WebAuth links.* -For links that are intended to navigate the users browser away from the current page (e.g. the links to Memento/GeoBlacklight/etc.) then `target="_parent"` should be used to give the link the default browser behavior. [More about link targets](http://www.w3schools.com/tags/att_a_target.asp). - -### Console Example - - $ viewer = Embed.registered_viewers.first - => Embed::DemoViewer - $ request = Embed::Request.new({url: 'http://purl.stanford.edu/bb112fp0199'}) - => # - $ viewer.new(request) - => # your viewer instance - - -### Customizing the Embed Panel - -Viewers can customize the embed panel. To do this, create a template in `app/views/embed/embed-this`, to provide the HTML for the embed panel. - -See File viewers for an example. - - -### Adding a Download Panel -Viewers can add their own download panel. To do this, create a component in `app/components/embed/download`, to provide the HTML for the download panel. - -In order to enable the download panel you need to provide a method in your viewer class. This method lets the footer logic know that the viewer will provide a download panel and it should render the Download button. - - def show_download? - true - end +For links that are intended to navigate the users browser away from the current page (e.g. the links to Memento/GeoBlacklight/etc.) then `target="_parent"` should be used to give the link the default browser behavior. [More about link targets](http://www.w3schools.com/tags/att_a_target.asp). \ No newline at end of file diff --git a/app/viewers/embed/viewer_factory.rb b/app/viewers/embed/viewer_factory.rb index 7a43682f7..b8b72b22e 100644 --- a/app/viewers/embed/viewer_factory.rb +++ b/app/viewers/embed/viewer_factory.rb @@ -31,20 +31,5 @@ def viewer_class # rubocop:disable Metrics/CyclomaticComplexity, Metrics/MethodL Embed::Viewer::WasSeed end end - - # @return [Symbol] the type of object to display - def object_type - @request.purl_object.type.to_sym - end - - def default_viewer - Embed::Viewer::File - end - - def registered_viewer(type:) - @registered_viewer ||= Embed.registered_viewers.detect do |type_class| - type_class.supported_types.include?(type) - end - end end end