-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show page should link directly to aeon when possible
- Loading branch information
1 parent
ceecb00
commit a78ac70
Showing
5 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
# ViewComponent that displays an aeon request button on the show page | ||
class AeonRequestButtonComponent < RequestButtonComponent | ||
def initialize(document:, location:) | ||
@document = document | ||
@location = location | ||
end | ||
|
||
def label | ||
'Reading Room Request' | ||
end | ||
|
||
def tooltip | ||
'Request to view in Reading Room' | ||
end | ||
|
||
def url | ||
Requests::AeonUrl.new(document: @document).to_s | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe AeonRequestButtonComponent, type: :component do | ||
before do | ||
stub_holding_locations | ||
end | ||
let(:holding) do | ||
{ "22740186070006421" => { "items" => [{ "holding_id" => "22740186070006421", "id" => "23740186060006421", "barcode" => "24680" }] } } | ||
end | ||
let(:location) do | ||
{ aeon_location: false, 'library' => { 'code' => 'eastasian' } } | ||
end | ||
let(:document) do | ||
SolrDocument.new({ id: '1234', holdings_1display: holding.to_json.to_s }) | ||
end | ||
subject { render_inline(described_class.new(document:, location:)) } | ||
it "renders a link with the appropriate classes" do | ||
expect(subject.css('a').attribute('class').to_s).to eq('request btn btn-xs btn-primary') | ||
end | ||
it 'renders the typical title tooltip' do | ||
expect(subject.css('a').attribute('title').text).to eq('Request to view in Reading Room') | ||
end | ||
it 'renders the typical request text' do | ||
expect(subject.css('a').text).to eq('Reading Room Request') | ||
end | ||
it 'includes aeon=false in the link url' do | ||
expect(subject.css('a').attribute('href').text).to include('https://lib-aeon.princeton.edu/aeon/aeon.dll/OpenURL?') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters