Skip to content

Commit f882f55

Browse files
gordonleacockcbeer
authored andcommitted
Add icons to collection/component show page breadcrumbs #801 (#847)
1 parent 41b12ba commit f882f55

19 files changed

+77
-30
lines changed

.codeclimate.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
version: "2"
32
exclude_patterns:
43
- "app/assets/javascripts/arclight/context_navigation.js"

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ AllCops:
1717
Metrics/ModuleLength:
1818
Exclude:
1919
- 'app/helpers/arclight_helper.rb'
20+
- 'app/models/concerns/arclight/solr_document.rb'
2021

2122
Metrics/BlockLength:
2223
Exclude:

app/assets/stylesheets/arclight/modules/layout.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
background-color: transparent;
99
margin-bottom: 0;
1010
padding: 0;
11+
.breadcrumb-item + .breadcrumb-item::before {
12+
content: '';
13+
}
1114
}
1215

1316
.al-show-actions-box {

app/assets/stylesheets/arclight/modules/search_results.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ article.document {
146146
padding-right: 0 !important;
147147
}
148148

149+
.breadcrumb .media .col, h1.media .col {
150+
flex-basis: auto;
151+
}
152+
153+
.breadcrumb .media svg, h1.media svg {
154+
fill: $gray-600;
155+
}
156+
149157
.breadcrumb-links a {
150158
color: $body-color;
151159
}

app/helpers/arclight_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,14 @@ def hierarchy_component_context?
180180

181181
# determine which icon to show in search results header
182182
# these icon names will need to be updated when the icons are determined
183-
def document_header_icon(document)
183+
def document_or_parent_icon(document)
184184
case document.level&.downcase
185185
when 'collection'
186186
'collection'
187187
when 'file'
188188
'file'
189+
when 'series', 'subseries'
190+
'folder'
189191
else
190192
'container'
191193
end

app/models/arclight/parent.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ module Arclight
55
# Logic containing information about Solr_Ead "Parent"
66
# https://github.com/awead/solr_ead/blob/8cf7ffaa66e0e4c9c0b12f5646d6c2e20984cd99/lib/solr_ead/behaviors.rb#L54-L57
77
class Parent
8-
attr_reader :id, :label, :eadid
9-
def initialize(id:, label:, eadid:)
8+
attr_reader :id, :label, :eadid, :level
9+
def initialize(id:, label:, eadid:, level:)
1010
@id = id
1111
@label = label
1212
@eadid = eadid
13+
@level = level
1314
end
1415

1516
##

app/models/arclight/parents.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ module Arclight
55
# Object for parsing and formalizing Solr_Ead "Parents"
66
# https://github.com/awead/solr_ead/blob/8cf7ffaa66e0e4c9c0b12f5646d6c2e20984cd99/lib/solr_ead/behaviors.rb#L54-L57
77
class Parents
8-
attr_reader :ids, :labels
9-
def initialize(ids:, labels:, eadid:)
8+
attr_reader :ids, :labels, :levels
9+
def initialize(ids:, labels:, eadid:, levels:)
1010
@ids = ids
1111
@labels = labels
1212
@eadid = eadid
13+
@levels = levels
1314
end
1415

1516
def eadid
@@ -19,7 +20,7 @@ def eadid
1920
##
2021
# @return [Array[Arclight::Parent]]
2122
def as_parents
22-
Hash[ids.zip(labels)].map { |k, v| Arclight::Parent.new(id: k, label: v, eadid: eadid) }
23+
ids.map.with_index { |_id, idx| Arclight::Parent.new(id: ids[idx], label: labels[idx], eadid: eadid, level: levels[idx]) }
2324
end
2425

2526
##
@@ -28,7 +29,8 @@ def self.from_solr_document(document)
2829
ids = document.parent_ids
2930
labels = document.parent_labels
3031
eadid = document.eadid
31-
new(ids: ids, labels: labels, eadid: eadid)
32+
levels = document.parent_levels
33+
new(ids: ids, labels: labels, eadid: eadid, levels: levels)
3234
end
3335
end
3436
end

app/models/concerns/arclight/solr_document.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ def parent_labels
2020
fetch('parent_unittitles_ssm', [])
2121
end
2222

23+
def parent_levels
24+
fetch('parent_levels_ssm', [])
25+
end
26+
2327
def parent_document
2428
self.class.new fetch('parent').fetch('docs', []).first
2529
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<%= blacklight_icon document_header_icon(document) %>
1+
<%= blacklight_icon document_or_parent_icon(document) %>

app/views/catalog/_arclight_index_compact_default.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="documentHeader row">
22
<div class="col-auto">
3-
<%= blacklight_icon document_header_icon(document) %>
3+
<%= blacklight_icon document_or_parent_icon(document) %>
44
</div>
55
<div class="col col-no-left-padding col-no-right-padding">
66
<div class="d-flex justify-content-between">

0 commit comments

Comments
 (0)