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

Move all embed to the frontend #4578

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ GEM
base64 (0.2.0)
bcrypt (3.1.20)
bcrypt_pbkdf (1.1.1)
bcrypt_pbkdf (1.1.1-arm64-darwin)
bcrypt_pbkdf (1.1.1-x86_64-darwin)
benchmark (0.4.0)
bibtex-ruby (6.1.0)
latex-decode (~> 0.0)
Expand Down
22 changes: 22 additions & 0 deletions app/components/record/item/embed_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Record
module Item
class EmbedComponent < ViewComponent::Base
def initialize(druid:)
@druid = druid
super
end

attr_reader :druid

def call
tag.div(data: { behavior: "purl-embed", embed_url: })
end

def embed_url
"#{Settings.PURL_EMBED_PROVIDER}.json?hide_title=true&url=#{Settings.PURL_EMBED_RESOURCE}#{druid}"
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="purl-embed-viewer row">
<div class="col-md-12">
<h2>Digital content</h2>
<div data-behavior="purl-embed" data-embed-url="<%= embed_path(document.druid) %>"></div>
<%= render Record::Item::EmbedComponent.new(druid: document.druid) %>
<%= helpers.iiif_drag_n_drop(document.iiif_manifest) if document.iiif_manifest %>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<% if document.druid && document.published_content? %>
<h2>Digital content</h2>
<div class="purl-embed-viewer">
<div data-behavior="purl-embed" data-embed-url="<%= embed_path(document.druid) %>"></div>
<%= render Record::Item::EmbedComponent.new(druid: document.druid) %>
<%= helpers.iiif_drag_n_drop(document.iiif_manifest) if document.iiif_manifest %>
</div>
<% end %>
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/embed_controller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions config/initializers/zeitwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@
inflect.acronym 'IP'
inflect.acronym 'MHLD'
end

Rails.autoloaders.each do |autoloader|
autoloader.inflector.inflect(
"purl_embed" => "PURLEmbed"
)
end
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@

resource :quick_reports, only: [:create]

resources :embed, only: :show

resources :lib_guides, only: :index

resources :browse, only: :index
Expand Down
2 changes: 0 additions & 2 deletions config/settings/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
HOSTNAME: "TEST-HOST"
HOURS_API:
enabled: false
# Test needs to be under http otherwise jquery cannot be loaded
PURL_EMBED_PROVIDER: 'http://embed.stanford.edu/embed'
SU_AFFILIATIONS:
- test-stanford:test
EXHIBITS_ACCESS_PANEL:
Expand Down
25 changes: 0 additions & 25 deletions lib/purl_embed.rb

This file was deleted.

25 changes: 0 additions & 25 deletions spec/controllers/embed_controller_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
require 'rails_helper'

RSpec.describe "Librarian View Customization", :js do
let(:embed) { double('embed-response') }

it "MARC records should display" do
visit solr_document_path('28')

Expand All @@ -23,8 +21,6 @@
end

it "MODS records should display" do
expect(embed).to receive(:html).and_return("")
expect(PURLEmbed).to receive(:new).and_return(embed)
visit solr_document_path('35')

within(".tech-details") do
Expand Down
46 changes: 0 additions & 46 deletions spec/lib/purl_embed_spec.rb

This file was deleted.