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

CTPL-239: (fix) add shelving title to holdings display #1120

Merged
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
4 changes: 4 additions & 0 deletions app/helpers/request_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ def holding_notes(holding)
holding["notes"].select { |note| note["holdingsNoteType"] != "Restriction" }
end

def shelving_title(holding)
holding["shelvingTitle"]
end

def format_items_in_use(holding)
holding["checkedOutItems"].map do |item|
concatenated = "#{item["enumeration"]} #{item["chronology"]} #{item["yearCaption"]}"
Expand Down
5 changes: 5 additions & 0 deletions app/views/request/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
<dd class="col col-md-9"><%= @request.holding["shelvingTitle"] %></dd>
<% end %>

<% if @request.holding["shelvingTitle"].present? %>
<dt class="col-12 col-md-3 text-md-right"><%= t("requesting.metadata.shelving_title") %></dt>
<dd class="col col-md-9"><%= @request.holding["shelvingTitle"] %></dd>
<% end %>

<dt class="col-12 col-md-3 text-md-right"><%= t("requesting.metadata.status") %></dt>
<dd class="col col-md-9"><%= @request.item["displayStatus"] %></dd>

Expand Down
5 changes: 5 additions & 0 deletions app/views/request_item/_holding.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<% end %></p>
</dd>

<% if shelving_title(holding).present? %>
<dt class="col-12 col-lg-4 text-lg-right"><%= t("requesting.metadata.shelving_title") %></dt>
<dd class="col-12 col-lg-8"><%= shelving_title(holding) %></dd>
<% end %>

<dt class="col-12 col-lg-4 text-lg-right"><%= t("requesting.metadata.status") %></dt>
<dd class="col-12 col-lg-8"><%= item["requestable"] ? item["displayStatus"] : "Not for loan" %></dd>

Expand Down
18 changes: 18 additions & 0 deletions spec/helpers/request_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,24 @@
end
end

describe "#shelving_title" do
context "when there is a shelving title" do
let(:holding) { {"shelvingTitle" => "G.C. Bleeck/Misc #1"} }

it "returns the shelvingTitle" do
expect(helper.shelving_title(holding)).to eq "G.C. Bleeck/Misc #1"
end
end

context "when there is no shelvingTitle" do
let(:holding) { {"shelvingTitle" => nil} }

it "returns nil" do
expect(helper.shelving_title(holding)).to be_nil
end
end
end

describe "#items_issues_in_use" do
context "when there are notes" do
let(:holding) { holdings_response["holdingsRecords"][4] }
Expand Down
Loading