Skip to content

Commit

Permalink
Merge pull request #1156 from nla/ctpl-199-update-picture-requesting
Browse files Browse the repository at this point in the history
CTPL-199: update picture requesting
  • Loading branch information
CEdwardsBlasikiewicz authored Nov 28, 2024
2 parents b21ec7f + e7e5970 commit 7416641
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/controllers/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def new
"serials"
elsif item["itemCategory"] == "map"
"maps"
elsif item["itemCategory"] == "picture"
"pictures"
else
"monographs"
end
Expand Down
26 changes: 26 additions & 0 deletions app/views/request/_pictures_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<div class="row">
<div class="col-12 col-lg-8">
<%= form_with(url: solr_document_request_path,
model: request,
method: :post,
data: {
"form-validation-target": "form"
}) do |f| %>
<%= hidden_field :request, :holdings_id %>
<%= hidden_field :request, :item_id %>

<div class="mb-3 row">
<%= f.label :notes, t("requesting.label.call_numbers"), class: "col-md-3 col-form-label text-md-right" %>
<div class="col-sm-6">
<%= f.text_area :notes, class: "form-control", maxlength: 100 %>
</div>
<span id="notes-help" class="form-text text-muted col-sm-3"><%= t("requesting.help.notes") %></span>
</div>

<div class="mb-3 row">
<div class="offset-md-3 col-sm-6 pe-0"><%= f.submit t("requesting.btn_request"), class: "btn btn-primary" %></div>
<div class="col-sm-3"></div>
</div>
<% end %>
</div>
</div>
9 changes: 9 additions & 0 deletions app/views/request/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
<p class="col-12 col-lg-8"><%= t("requesting.prompt_2", contact_us: Rails.application.config_for(:catalogue).contact_us_url).html_safe %></p>
<% elsif @request_form == "maps" %>
<p class="col-12 col-lg-8"><%= t("requesting.map_prompt").html_safe %></p>
<% elsif @request_form == "pictures" %>
<p class="col-12 col-lg-8"><%= t("requesting.picture_prompt").html_safe %></p>
<p class="col-12 col-lg-8"><%= t("requesting.picture_prompt_2").html_safe %></p>
<% if @finding_aids_link == "collection finding aid" %>
<p class="col-12 col-lg-8"><%= t("requesting.picture_prompt_4_no_fa").html_safe %></p>
<% else %>
<p class="col-12 col-lg-8"><%= t("requesting.picture_prompt_4_fa", finding_aid: @finding_aids_link).html_safe %></p>
<% end %>
<p class="col-12 col-lg-8"><%= t("requesting.picture_prompt_5", contact_us: Rails.application.config_for(:catalogue).contact_us_url).html_safe %></p>
<% end %>
</div>
<section id="request-details"
Expand Down
9 changes: 9 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ en:
serials:
required: "Additional information is required to complete your request. Please provide information on either the Year, or Volume/No or Day or Month that you are requesting."
dependent: "Additional information is required to complete your request. Please provide information on either the Year or Volume/No that you are requesting."
pictures:
required: ""
dependent: ""
metadata:
item_requested: "Item Requested:"
collect_from: "Collect From:"
Expand All @@ -115,6 +118,11 @@ en:
multi_box_prompt_2: "You can use one request for up to five consecutive boxes. Use a separate request for non-consecutive boxes/series/folders/items."
multi_box_prompt_3: "If available, use the %{finding_aid} to select your box number, or a series/folder/item number and enter them below. If you need assistance with this please <a href=\"%{contact_us}\">contact us.</a>"
map_prompt: "<strong>You have requested a map series containing many map sheets. Please use the fields below to tell our staff which map sheet or sheets you would like to request. If you do not know which sheet, enter a place name.</strong>"
picture_prompt: "<strong>You are requesting a multiple item collection. Please use the fields below to tell our staff which item or items you would like to request.</strong>"
picture_prompt_2: "You can use one request for up to five consecutive items. Use a separate request for non-consecutive items."
picture_prompt_4_no_fa: "To determine the items you would like to request, use the linked item records in the Related Records section of the catalogue record to identify the call number of the item or items for example: PIC Drawer PM 7348 #PIC/P721/1 OR PIC Glass Plate #PIC/13562/99-103 OR Album 947."
picture_prompt_4_fa: "To determine the items you would like to request, use the %{finding_aid} to identify the call number of the item or items, for example: PIC Drawer PM 7348 #PIC/P721/1 OR PIC Glass Plate #PIC/13562/99-103 OR Album 947."
picture_prompt_5: "If you need assistance with this please <a href=\"%{contact_us}\">contact us.</a>"
collection_finding_aid: "collection finding aid"
btn_request: "Request"
btn_select: "Select"
Expand All @@ -126,6 +134,7 @@ en:
volume: "Volume/No:"
enumeration: "Day or month:"
notes: "Notes:"
call_numbers: "Call numbers:"
box_number: "Box number:"
series_number: "Series number:"
folder_item_number: "Folder/Item number:"
Expand Down
55 changes: 55 additions & 0 deletions spec/features/requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,61 @@
expect(page).to have_css("label", text: I18n.t("requesting.label.notes"))
end
end

context "when requesting a picture" do
let(:instance_id) { "d63dc349-8153-5ff6-a33c-f3ec13faa0f0" }
let(:holdings_id) { "13341598-814f-5407-893b-cc76f339f123" }
let(:item_id) { "3556c738-2a32-5b11-b86e-2e5db34bbe1e" }
let(:solr_document_id) { "2921885" }
let(:document) { SolrDocument.new(id: solr_document_id, marc_ss: map_marc, folio_instance_id_ssim: [instance_id], title_tsim: ["Photographs for The Australian homestead [picture] / Wesley Stacey"], format: ["Picture"], finding_aid_url_ssim: ["https://nla.gov.au/nla.obj-144094084/findingaid"]) }

before do
holdings_response = IO.read("spec/files/catalogue_services/picture.json")

WebMock.stub_request(:get, /catservices.test\/catalogue-services\/folio\/instance\/(.*)/)
.with(
headers: {
"Accept" => "*/*",
"Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
}
)
.to_return(status: 200, body: holdings_response, headers: {"Content-Type" => "application/json"})
end

it "renders the requesting prompt" do
visit solr_document_request_new_path(
solr_document_id: solr_document_id,
instance: instance_id,
holdings: holdings_id,
item: item_id
)

expect(page.html).to include(I18n.t("requesting.picture_prompt"))
end

it "renders the picture form" do
visit solr_document_request_new_path(
solr_document_id: solr_document_id,
instance: instance_id,
holdings: holdings_id,
item: item_id
)

expect(page).to have_css("label", text: I18n.t("requesting.label.call_numbers"))
end

context "when there is a finding aid url" do
it "links to the finding aid" do
visit solr_document_request_new_path(
solr_document_id: solr_document_id,
instance: instance_id,
holdings: holdings_id,
item: item_id
)
expect(page).to have_link("collection finding aid", href: "https://nla.gov.au/nla.obj-144094084/findingaid")
end
end
end
end

describe "GET /success" do
Expand Down
53 changes: 53 additions & 0 deletions spec/files/catalogue_services/picture.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"instanceId": "d63dc349-8153-5ff6-a33c-f3ec13faa0f0",
"holdingsRecords": [
{
"id": "13341598-814f-5407-893b-cc76f339f123",
"instanceId": "d63dc349-8153-5ff6-a33c-f3ec13faa0f0",
"permanentLocationId": "2801984c-f9f1-452e-b267-ddf511a985a8",
"effectiveLocationId": "2801984c-f9f1-452e-b267-ddf511a985a8",
"callNumber": "PIC Drawer PM 2766-3034 #PIC/8508/1-269",
"holdingsStatements": [],
"holdingsStatementsForIndexes": [],
"holdingsStatementsForSupplements": [],
"discoverySuppress": false,
"itemRecords": [
{
"id": "3556c738-2a32-5b11-b86e-2e5db34bbe1e",
"holdingsRecordId": "13341598-814f-5407-893b-cc76f339f123",
"barcode": "990004013219",
"effectiveLocationId": "2801984c-f9f1-452e-b267-ddf511a985a8",
"effectiveLocationDisplayName": "Special Collections Reading Room",
"effectiveCallNumberComponents": {
"callNumber": "PIC Drawer PM 2766-3034 #PIC/8508/1-269"
},
"status": {
"name": "Available",
"date": "2023-06-28T03:31:57.329+00:00"
},
"pickupLocation": {
"id": "d1624450-96b9-48ac-9457-47d7d4924c66",
"name": "Special Collections Reading Room",
"code": "SCRR-SP",
"discoveryDisplayName": "Special Collections Reading Room",
"pickupLocation": true,
"holdShelfExpiryPeriod": {
"duration": 6,
"intervalId": "Days"
}
},
"materialTypeId": "237cc266-f677-4b8e-aaae-846ed7e66361",
"permanentLoanTypeId": "ec500417-ea68-484f-858d-e8f6166e6237",
"yearCaption": [],
"enumeration": "FOR REQUESTS, USE THE REQUEST OPTION BELOW",
"itemCategory": "picture",
"discoverySuppress": false,
"requestable": true,
"displayStatus": "Available"
}
],
"notes": [],
"checkedOutItems": []
}
]
}

0 comments on commit 7416641

Please sign in to comment.