Skip to content

Commit ad6b922

Browse files
committed
Add dynamic eyebrow support for records
Why are these changes being introduced: * Initial implementation only had placeholder text for the eyebrow above the title in search results. * Dynamic eyebrow support for Timdex and Primo records was requested. Relevant ticket(s): * https://mitlibraries.atlassian.net/browse/USE-221 How does this address that need: * Adds eyebrow to Timdex and Primo record normalization. * Updates search result partials to display eyebrow if present. Document any side effects to this change: * These are unlikely to be the final values for the eyebrows, but they provide a starting point for further refinement based on feedback.
1 parent 73fef07 commit ad6b922

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

app/models/normalize_primo_record.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def normalize
1111
api: 'primo',
1212
title:,
1313
creators:,
14+
eyebrow:,
1415
source:,
1516
year:,
1617
format:,
@@ -63,6 +64,14 @@ def creators
6364
author_list.uniq
6465
end
6566

67+
def eyebrow
68+
if alma_record?
69+
'MIT Libraries Catalog'
70+
else
71+
'Central Discovery Index'
72+
end
73+
end
74+
6675
def source
6776
'Primo'
6877
end

app/models/normalize_timdex_record.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def normalize
1111
api: 'timdex',
1212
title:,
1313
creators:,
14+
eyebrow:,
1415
source:,
1516
year:,
1617
format:,
@@ -45,6 +46,12 @@ def creators
4546
.map { |creator| { 'value' => creator['value'], 'link' => nil } }
4647
end
4748

49+
# Currently just using source as eyebrow.
50+
# This will likely change to remap the source to more user-friendly values.
51+
def eyebrow
52+
source
53+
end
54+
4855
def source
4956
return 'Unknown source' unless @record['source']
5057

app/views/search/_result.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li class="result use">
22
<div class="result-content">
3-
<p class="eyebrow">Eyebrow Text</p>
3+
<p class="eyebrow"><%= result[:eyebrow] %></p>
44
<h3 class="record-title">
55
<span class="sr">Title: </span>
66
<%= link_to_result(result) %>

app/views/search/_result_primo.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li class="result primo">
22
<div class="result-content">
3-
<p class="eyebrow">Eyebrow Text</p>
3+
<p class="eyebrow"><%= result[:eyebrow] %></p>
44
<h3 class="record-title">
55
<span class="sr">Title: </span>
66
<% if result[:links]&.find { |link| link['kind'] == 'full record' } %>

0 commit comments

Comments
 (0)