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

Remove dead code #1831

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 1 addition & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'})
=> #<Embed::Request>
$ 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).
15 changes: 0 additions & 15 deletions app/viewers/embed/viewer_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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