From b3cf070dba8d0d3eb168765139a40900e110462d Mon Sep 17 00:00:00 2001
From: CEdwardsBlasikiewicz
Date: Thu, 17 Oct 2024 08:47:29 +1100
Subject: [PATCH 1/2] move shelving title below call number
---
app/views/request/new.html.erb | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/app/views/request/new.html.erb b/app/views/request/new.html.erb
index 4aa3af84..54698859 100644
--- a/app/views/request/new.html.erb
+++ b/app/views/request/new.html.erb
@@ -43,11 +43,6 @@
<%= link_to @request.item["holdingAvailabilityUrl"], @request.item["holdingAvailabilityUrl"] %>
<% end %>
- <% if @request.holding["shelvingTitle"].present? %>
- <%= t("requesting.metadata.shelving_title") %>
- <%= @request.holding["shelvingTitle"] %>
- <% end %>
-
<%= t("requesting.metadata.call_number") %>
<%= @request.item["effectiveCallNumberComponents"]["callNumber"] %>
@@ -56,6 +51,11 @@
<% end %>
+ <% if @request.holding["shelvingTitle"].present? %>
+ <%= t("requesting.metadata.shelving_title") %>
+ <%= @request.holding["shelvingTitle"] %>
+ <% end %>
+
<%= t("requesting.metadata.status") %>
<%= @request.item["displayStatus"] %>
From e1b7ca5b40692664442786bff63f6a4f5a256653 Mon Sep 17 00:00:00 2001
From: CEdwardsBlasikiewicz
Date: Mon, 21 Oct 2024 11:15:39 +1100
Subject: [PATCH 2/2] Move shelvingTitle display
---
app/helpers/request_helper.rb | 4 ++++
app/views/request_item/_holding.html.erb | 5 +++++
spec/helpers/request_helper_spec.rb | 18 ++++++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/app/helpers/request_helper.rb b/app/helpers/request_helper.rb
index 0c89d977..05b5b948 100644
--- a/app/helpers/request_helper.rb
+++ b/app/helpers/request_helper.rb
@@ -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"]}"
diff --git a/app/views/request_item/_holding.html.erb b/app/views/request_item/_holding.html.erb
index 59aca73d..7945abca 100644
--- a/app/views/request_item/_holding.html.erb
+++ b/app/views/request_item/_holding.html.erb
@@ -23,6 +23,11 @@
<% end %>
+ <% if shelving_title(holding).present? %>
+ <%= t("requesting.metadata.shelving_title") %>
+ <%= shelving_title(holding) %>
+ <% end %>
+
<%= t("requesting.metadata.status") %>
<%= item["requestable"] ? item["displayStatus"] : "Not for loan" %>
diff --git a/spec/helpers/request_helper_spec.rb b/spec/helpers/request_helper_spec.rb
index 0154ed2b..c92bc7a5 100644
--- a/spec/helpers/request_helper_spec.rb
+++ b/spec/helpers/request_helper_spec.rb
@@ -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] }