arclight 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.all-contributorsrc +450 -0
- data/.babelrc +3 -0
- data/.codeclimate.yml +5 -0
- data/.eslintrc +3 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +15 -135
- data/.travis.yml +2 -2
- data/CONTRIBUTORS.md +79 -0
- data/README.md +21 -24
- data/Rakefile +0 -1
- data/app/assets/images/blacklight/bookmark.svg +1 -0
- data/app/assets/images/blacklight/collection.svg +5 -0
- data/app/assets/images/blacklight/compact.svg +1 -25
- data/app/assets/images/blacklight/container.svg +5 -0
- data/app/assets/images/blacklight/ead.svg +1 -0
- data/app/assets/images/blacklight/file.svg +5 -0
- data/app/assets/images/blacklight/folder.svg +1 -0
- data/app/assets/images/blacklight/list.svg +1 -0
- data/app/assets/images/blacklight/minus.svg +1 -0
- data/app/assets/images/blacklight/online.svg +5 -0
- data/app/assets/images/blacklight/pdf.svg +1 -0
- data/app/assets/images/blacklight/plus.svg +1 -0
- data/app/assets/images/blacklight/repository.svg +1 -0
- data/app/assets/javascripts/arclight/arclight.js +1 -3
- data/app/assets/javascripts/arclight/collection_navigation.js +36 -53
- data/app/assets/javascripts/arclight/collection_scrollspy.js +1 -1
- data/app/assets/javascripts/arclight/context_navigation.js +374 -0
- data/app/assets/javascripts/arclight/truncator.js.erb +8 -2
- data/app/assets/stylesheets/arclight/application.scss +3 -1
- data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +23 -0
- data/app/assets/stylesheets/arclight/modules/context_navigation.scss +75 -0
- data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +28 -35
- data/app/assets/stylesheets/arclight/modules/highlights.scss +2 -1
- data/app/assets/stylesheets/arclight/modules/layout.scss +128 -14
- data/app/assets/stylesheets/arclight/modules/mastheads.scss +27 -5
- data/app/assets/stylesheets/arclight/modules/repositories.scss +1 -5
- data/app/assets/stylesheets/arclight/modules/repository_card.scss +6 -7
- data/app/assets/stylesheets/arclight/modules/search_results.scss +145 -24
- data/app/assets/stylesheets/arclight/modules/show_collection.scss +38 -59
- data/app/assets/stylesheets/arclight/responsive.scss +13 -0
- data/app/assets/stylesheets/arclight/variables.scss +21 -1
- data/app/controllers/concerns/arclight/ead_format_helpers.rb +225 -0
- data/app/controllers/concerns/arclight/field_config_helpers.rb +23 -7
- data/app/factories/blacklight_field_configuration_factory.rb +1 -0
- data/app/helpers/arclight_helper.rb +197 -35
- data/app/models/arclight/document_downloads.rb +125 -0
- data/app/models/arclight/parent.rb +4 -2
- data/app/models/arclight/parents.rb +6 -4
- data/app/models/arclight/requests/aeon_external_request.rb +42 -0
- data/app/models/arclight/requests/aeon_web_ead.rb +47 -0
- data/app/models/arclight/requests/google_form.rb +2 -2
- data/app/models/concerns/arclight/catalog.rb +14 -2
- data/app/models/concerns/arclight/search_behavior.rb +27 -12
- data/app/models/concerns/arclight/solr_document.rb +29 -7
- data/app/views/arclight/_requests.html.erb +7 -0
- data/app/views/arclight/repositories/_in_person_repository.html.erb +1 -1
- data/app/views/arclight/repositories/_repository.html.erb +2 -2
- data/app/views/arclight/repositories/_repository_contact.html.erb +9 -0
- data/app/views/arclight/repositories/index.html.erb +3 -0
- data/app/views/arclight/repositories/show.html.erb +5 -4
- data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +9 -0
- data/app/views/arclight/requests/_aeon_web_ead.html.erb +7 -0
- data/app/views/arclight/requests/_google_form.html.erb +2 -1
- data/app/views/arclight/viewers/_oembed.html.erb +2 -1
- data/app/views/catalog/_access_contents.html.erb +15 -0
- data/app/views/catalog/_arclight_abstract_or_scope.html.erb +5 -0
- data/app/views/catalog/_arclight_bookmark_control.html.erb +38 -0
- data/app/views/catalog/_arclight_document_header_icon.html.erb +1 -0
- data/app/views/catalog/_arclight_index_compact_default.html.erb +18 -11
- data/app/views/catalog/_arclight_index_default.html.erb +45 -0
- data/app/views/catalog/_arclight_index_group_document_compact_default.html.erb +19 -0
- data/app/views/catalog/_arclight_index_group_document_default.html.erb +18 -0
- data/app/views/catalog/_arclight_online_content_indicator.html.erb +1 -3
- data/app/views/catalog/_collection_contents.html.erb +2 -10
- data/app/views/catalog/_collection_context.html.erb +15 -0
- data/app/views/catalog/_collection_context_nav.html.erb +12 -0
- data/app/views/catalog/_collection_online_contents.html.erb +3 -3
- data/app/views/catalog/_component_context.html.erb +5 -0
- data/app/views/catalog/_containers.html.erb +3 -0
- data/app/views/catalog/_context_sidebar.html.erb +2 -2
- data/app/views/catalog/_document_downloads.html.erb +14 -0
- data/app/views/catalog/_group.html.erb +21 -0
- data/app/views/catalog/_group_header_compact_default.html.erb +15 -0
- data/app/views/catalog/_group_header_default.html.erb +20 -0
- data/app/views/catalog/_group_toggle.html.erb +10 -0
- data/app/views/catalog/_home.html.erb +1 -1
- data/app/views/catalog/_index_breadcrumb_default.html.erb +5 -2
- data/app/views/catalog/_index_collection_context_default.html.erb +53 -0
- data/app/views/catalog/_index_header.html.erb +3 -3
- data/app/views/catalog/_index_online_contents_default.html.erb +1 -1
- data/app/views/catalog/_online_content_label.html.erb +5 -0
- data/app/views/catalog/_search_form.html.erb +34 -0
- data/app/views/catalog/_search_results.html.erb +1 -4
- data/app/views/catalog/_show_actions_box_default.html.erb +27 -0
- data/app/views/catalog/_show_breadcrumbs_default.html.erb +5 -20
- data/app/views/catalog/_show_collection.html.erb +42 -24
- data/app/views/catalog/_show_default.html.erb +63 -35
- data/app/views/catalog/_show_upper_metadata_default.html.erb +1 -1
- data/app/views/catalog/_sort_and_per_page.html.erb +8 -0
- data/app/views/catalog/_within_collection_dropdown.html.erb +26 -0
- data/app/views/shared/_breadcrumbs.html.erb +4 -4
- data/app/views/shared/_context_sidebar.html.erb +2 -2
- data/app/views/shared/_header_navbar.html.erb +13 -17
- data/app/views/shared/_show_breadcrumbs.html.erb +27 -0
- data/arclight.gemspec +5 -6
- data/config/i18n-tasks.yml +2 -1
- data/config/locales/arclight.en.yml +54 -21
- data/config/repositories.yml +0 -0
- data/lib/arclight/engine.rb +22 -12
- data/lib/arclight/hash_absolute_xpath.rb +11 -7
- data/lib/arclight/level_label.rb +46 -0
- data/lib/arclight/normalized_date.rb +2 -2
- data/lib/arclight/normalized_id.rb +1 -0
- data/lib/arclight/normalized_title.rb +1 -0
- data/lib/arclight/repository.rb +58 -5
- data/lib/arclight/traject/ead2_config.rb +178 -159
- data/lib/arclight/traject/nokogiri_namespaceless_reader.rb +22 -0
- data/lib/arclight/version.rb +1 -1
- data/lib/arclight/viewers/oembed.rb +1 -0
- data/lib/arclight/year_range.rb +9 -1
- data/lib/generators/arclight/install_generator.rb +5 -1
- data/lib/generators/arclight/templates/catalog_controller.rb +128 -100
- data/lib/generators/arclight/templates/config/downloads.yml +12 -0
- data/lib/generators/arclight/templates/config/repositories.yml +20 -2
- data/lib/generators/arclight/update_generator.rb +1 -1
- data/lib/tasks/index.rake +18 -20
- data/package.json +8 -1
- data/solr/conf/schema.xml +51 -292
- data/solr/conf/solrconfig.xml +40 -125
- data/tasks/arclight.rake +1 -0
- data/vendor/assets/javascripts/responsiveTruncator.js +2 -2
- metadata +71 -44
- data/app/assets/javascripts/arclight/collection_context.js +0 -18
- data/app/assets/javascripts/arclight/component_ancestors.js +0 -56
- data/app/assets/javascripts/arclight/search_results.js +0 -15
- data/app/assets/stylesheets/arclight/modules/sidebar.scss +0 -21
- data/app/views/catalog/_collection_count.html.erb +0 -7
- data/app/views/catalog/_collection_downloads.html.erb +0 -15
- data/app/views/catalog/_collection_overview.html.erb +0 -7
- data/app/views/catalog/_component_contents.html.erb +0 -16
- data/app/views/catalog/_component_overview.html.erb +0 -40
- data/app/views/catalog/_index_header_hierarchy_default.html.erb +0 -42
- data/app/views/catalog/_index_hierarchy_default.html.erb +0 -28
- data/app/views/catalog/_results_histogram.html.erb +0 -15
- data/app/views/catalog/_show_component_sidebar.html.erb +0 -12
- data/app/views/catalog/_show_sidebar.html.erb +0 -22
- data/lib/arclight/custom_component.rb +0 -99
- data/lib/arclight/custom_document.rb +0 -93
- data/lib/arclight/indexer.rb +0 -9
- data/lib/arclight/shared_indexing_behavior.rb +0 -97
- data/lib/arclight/shared_terminology_behavior.rb +0 -65
- data/lib/arclight/solr_ead_indexer_ext.rb +0 -155
@@ -0,0 +1,125 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
##
|
5
|
+
# Model the Download links that can be configured (via YAML) for a collection
|
6
|
+
# or container
|
7
|
+
class DocumentDownloads
|
8
|
+
attr_reader :document
|
9
|
+
|
10
|
+
def initialize(document, id = nil)
|
11
|
+
@document = document
|
12
|
+
@id = id
|
13
|
+
end
|
14
|
+
|
15
|
+
# Accessor for the ID
|
16
|
+
# @return [String]
|
17
|
+
def id
|
18
|
+
@id || document.unitid
|
19
|
+
end
|
20
|
+
|
21
|
+
# Factory method for the File objects
|
22
|
+
# @return [Array<Arclight::DocumentDownloads::File>]
|
23
|
+
def files
|
24
|
+
data = self.class.config[id] || self.class.config['default']
|
25
|
+
disabled = data.delete('disabled')
|
26
|
+
return [] if disabled
|
27
|
+
|
28
|
+
@files ||= data.map do |file_type, file_data|
|
29
|
+
self.class.file_class.new(type: file_type, data: file_data, document: document)
|
30
|
+
end.compact
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_partial_path
|
34
|
+
'catalog/document_downloads'
|
35
|
+
end
|
36
|
+
|
37
|
+
class << self
|
38
|
+
def config
|
39
|
+
@config ||= begin
|
40
|
+
YAML.safe_load(::File.read(config_filename))
|
41
|
+
rescue Errno::ENOENT
|
42
|
+
{}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def config_filename
|
47
|
+
Rails.root.join('config', 'downloads.yml')
|
48
|
+
end
|
49
|
+
|
50
|
+
# Accessor for the File Class
|
51
|
+
# @return [Class]
|
52
|
+
def file_class
|
53
|
+
File
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
##
|
58
|
+
# Model a single file configured in downloads.yml
|
59
|
+
class File
|
60
|
+
attr_reader :type, :document
|
61
|
+
def initialize(type:, data:, document:)
|
62
|
+
@type = type
|
63
|
+
@data = data
|
64
|
+
@document = document
|
65
|
+
end
|
66
|
+
|
67
|
+
def href
|
68
|
+
return data['href'] if data['href']
|
69
|
+
|
70
|
+
format_template
|
71
|
+
end
|
72
|
+
|
73
|
+
def size
|
74
|
+
return data['size'] if data['size']
|
75
|
+
|
76
|
+
document.send(data['size_accessor'].to_sym) if data['size_accessor']
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
attr_reader :data
|
82
|
+
|
83
|
+
def format_template
|
84
|
+
return unless template
|
85
|
+
|
86
|
+
template % template_interpolations
|
87
|
+
end
|
88
|
+
|
89
|
+
def template
|
90
|
+
data['template']
|
91
|
+
end
|
92
|
+
|
93
|
+
def template_interpolations
|
94
|
+
escaped_document_interpolations.merge(custom_interpolations).symbolize_keys
|
95
|
+
end
|
96
|
+
|
97
|
+
def custom_interpolations
|
98
|
+
{ 'repository_id' => document.repository_config&.slug }
|
99
|
+
end
|
100
|
+
|
101
|
+
def template_variables
|
102
|
+
data['template'].scan(/%{(\w+)}/).flatten.uniq
|
103
|
+
end
|
104
|
+
|
105
|
+
def escaped_document_interpolations
|
106
|
+
non_custom_template_variables.map do |method_name|
|
107
|
+
[method_name, escape_non_url_doc_value(document.send(method_name))]
|
108
|
+
end.to_h
|
109
|
+
end
|
110
|
+
|
111
|
+
def escape_non_url_doc_value(value)
|
112
|
+
value = Array.wrap(value).first || '' # Handle single values/arrays and nil
|
113
|
+
return value if value.start_with?(/https?:/)
|
114
|
+
|
115
|
+
CGI.escape(value)
|
116
|
+
end
|
117
|
+
|
118
|
+
def non_custom_template_variables
|
119
|
+
template_variables.reject do |v|
|
120
|
+
custom_interpolations.keys.include?(v)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -5,11 +5,12 @@ module Arclight
|
|
5
5
|
# Logic containing information about Solr_Ead "Parent"
|
6
6
|
# https://github.com/awead/solr_ead/blob/8cf7ffaa66e0e4c9c0b12f5646d6c2e20984cd99/lib/solr_ead/behaviors.rb#L54-L57
|
7
7
|
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:)
|
10
10
|
@id = id
|
11
11
|
@label = label
|
12
12
|
@eadid = eadid
|
13
|
+
@level = level
|
13
14
|
end
|
14
15
|
|
15
16
|
##
|
@@ -18,6 +19,7 @@ module Arclight
|
|
18
19
|
# @return [String]
|
19
20
|
def global_id
|
20
21
|
return id if eadid == id
|
22
|
+
|
21
23
|
"#{eadid}#{id}"
|
22
24
|
end
|
23
25
|
end
|
@@ -5,11 +5,12 @@ module Arclight
|
|
5
5
|
# Object for parsing and formalizing Solr_Ead "Parents"
|
6
6
|
# https://github.com/awead/solr_ead/blob/8cf7ffaa66e0e4c9c0b12f5646d6c2e20984cd99/lib/solr_ead/behaviors.rb#L54-L57
|
7
7
|
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:)
|
10
10
|
@ids = ids
|
11
11
|
@labels = labels
|
12
12
|
@eadid = eadid
|
13
|
+
@levels = levels
|
13
14
|
end
|
14
15
|
|
15
16
|
def eadid
|
@@ -19,7 +20,7 @@ module Arclight
|
|
19
20
|
##
|
20
21
|
# @return [Array[Arclight::Parent]]
|
21
22
|
def as_parents
|
22
|
-
|
23
|
+
ids.map.with_index { |_id, idx| Arclight::Parent.new(id: ids[idx], label: labels[idx], eadid: eadid, level: levels[idx]) }
|
23
24
|
end
|
24
25
|
|
25
26
|
##
|
@@ -28,7 +29,8 @@ module Arclight
|
|
28
29
|
ids = document.parent_ids
|
29
30
|
labels = document.parent_labels
|
30
31
|
eadid = document.eadid
|
31
|
-
|
32
|
+
levels = document.parent_levels
|
33
|
+
new(ids: ids, labels: labels, eadid: eadid, levels: levels)
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
module Requests
|
5
|
+
##
|
6
|
+
# This class should be used to turn configuration into a URL and
|
7
|
+
# POST form specifically aimed at Aeon's external request
|
8
|
+
# endpoint (https://support.atlas-sys.com/hc/en-us/articles/360011820054-External-Request-Endpoint)
|
9
|
+
class AeonExternalRequest
|
10
|
+
def initialize(document, presenter)
|
11
|
+
@document = document
|
12
|
+
@presenter = presenter
|
13
|
+
end
|
14
|
+
|
15
|
+
def config
|
16
|
+
@config ||= @document.repository_config.request_config_for_type('aeon_external_request_endpoint')
|
17
|
+
end
|
18
|
+
|
19
|
+
def url
|
20
|
+
"#{config['request_url']}?#{url_params}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def form_mapping
|
24
|
+
static_mappings.merge(dynamic_mappings)
|
25
|
+
end
|
26
|
+
|
27
|
+
def static_mappings
|
28
|
+
config['request_mappings']['static']
|
29
|
+
end
|
30
|
+
|
31
|
+
def dynamic_mappings
|
32
|
+
config['request_mappings']['accessor'].transform_values do |v|
|
33
|
+
@document.send(v.to_sym)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def url_params
|
38
|
+
config['request_mappings']['url_params'].to_query
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
module Requests
|
5
|
+
##
|
6
|
+
# This object relies on the ability to respond to attributes passed in as
|
7
|
+
# query parameters from the form mapping configuration
|
8
|
+
class AeonWebEad
|
9
|
+
attr_reader :document, :ead_url
|
10
|
+
##
|
11
|
+
# @param [Blacklight::SolrDocument] document
|
12
|
+
# @param [String] ead_url
|
13
|
+
def initialize(document, ead_url)
|
14
|
+
@document = document
|
15
|
+
@ead_url = ead_url
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Url target for Aeon request params
|
20
|
+
def request_url
|
21
|
+
document.repository_config.request_url_for_type('aeon_web_ead')
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Constructed request URL
|
26
|
+
def url
|
27
|
+
"#{request_url}?#{form_mapping.to_query}"
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Converts mappings as a query url param into a Hash used for sending
|
32
|
+
# messages
|
33
|
+
# If a defined method is provided as a value, that method will be invoked
|
34
|
+
# "collection_name=entry.123" => { "collection_name" => "entry.123" }
|
35
|
+
# @return [Hash]
|
36
|
+
def form_mapping
|
37
|
+
form_hash = Rack::Utils.parse_nested_query(
|
38
|
+
document.repository_config.request_mappings_for_type('aeon_web_ead')
|
39
|
+
)
|
40
|
+
form_hash.each do |key, value|
|
41
|
+
respond_to?(value) && form_hash[key] = send(value)
|
42
|
+
end
|
43
|
+
form_hash
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -22,7 +22,7 @@ module Arclight
|
|
22
22
|
##
|
23
23
|
# Url of form to fill
|
24
24
|
def url
|
25
|
-
document.repository_config
|
25
|
+
document.repository_config&.request_url_for_type('google_form')
|
26
26
|
end
|
27
27
|
|
28
28
|
##
|
@@ -32,7 +32,7 @@ module Arclight
|
|
32
32
|
# @return [Hash]
|
33
33
|
def form_mapping
|
34
34
|
Rack::Utils.parse_nested_query(
|
35
|
-
document.repository_config
|
35
|
+
document.repository_config&.request_mappings_for_type('google_form')
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
@@ -4,18 +4,30 @@ module Arclight
|
|
4
4
|
##
|
5
5
|
# Arclight specific methods for the Catalog
|
6
6
|
module Catalog
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
included do
|
10
|
+
before_action only: :index do
|
11
|
+
if (params.dig(:f, :collection_sim) || []).any?(&:blank?)
|
12
|
+
params[:f][:collection_sim].delete_if(&:blank?)
|
13
|
+
params[:f].delete(:collection_sim) if params[:f][:collection_sim].blank?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
7
18
|
##
|
8
19
|
# Overriding the Blacklight method so that the hierarchy view does not start
|
9
20
|
# a new search session
|
10
21
|
def start_new_search_session?
|
11
|
-
!%w[
|
22
|
+
!%w[online_contents collection_context].include?(params[:view]) && super
|
12
23
|
end
|
13
24
|
|
14
25
|
##
|
15
26
|
# Overriding the Blacklight method so that hierarchy does not get stored as
|
16
27
|
# the preferred view
|
17
28
|
def store_preferred_view
|
18
|
-
return if %w[
|
29
|
+
return if %w[online_contents collection_context].include?(params[:view])
|
30
|
+
|
19
31
|
super
|
20
32
|
end
|
21
33
|
end
|
@@ -11,35 +11,50 @@ module Arclight
|
|
11
11
|
add_hierarchy_max_rows
|
12
12
|
add_hierarchy_sort
|
13
13
|
add_highlighting
|
14
|
+
add_grouping
|
14
15
|
]
|
15
16
|
end
|
16
17
|
|
17
18
|
##
|
18
|
-
#
|
19
|
+
# Override Blacklight's method so that some views don't add Solr facets into the request.
|
20
|
+
def add_facetting_to_solr(solr_params)
|
21
|
+
if %w[collection_context online_contents].include? blacklight_params[:view]
|
22
|
+
return solr_params
|
23
|
+
end
|
24
|
+
|
25
|
+
super(solr_params)
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# For the collection_context views, set a higher (unlimited) maximum document return
|
19
30
|
def add_hierarchy_max_rows(solr_params)
|
20
|
-
if blacklight_params[:view]
|
31
|
+
if %w[collection_context].include? blacklight_params[:view]
|
21
32
|
solr_params[:rows] = 999_999_999
|
22
33
|
end
|
23
34
|
solr_params
|
24
35
|
end
|
25
36
|
|
26
37
|
##
|
27
|
-
# For the
|
38
|
+
# For the asynch views, set the sort order to preserve the order of components
|
28
39
|
def add_hierarchy_sort(solr_params)
|
29
|
-
solr_params[:sort] = 'sort_ii asc' if %w[
|
40
|
+
solr_params[:sort] = 'sort_ii asc' if %w[online_contents collection_context].include? blacklight_params[:view]
|
30
41
|
solr_params
|
31
42
|
end
|
32
43
|
|
33
44
|
##
|
34
|
-
#
|
45
|
+
# Add highlighting
|
35
46
|
def add_highlighting(solr_params)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
47
|
+
solr_params['hl'] = true
|
48
|
+
solr_params['hl.fl'] = 'text'
|
49
|
+
solr_params['hl.snippets'] = 3
|
50
|
+
solr_params
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Adds grouping parameters for Solr if enabled
|
55
|
+
def add_grouping(solr_params)
|
56
|
+
solr_params.merge!(Arclight::Engine.config.catalog_controller_group_query_params) if blacklight_params[:group] == 'true'
|
57
|
+
|
43
58
|
solr_params
|
44
59
|
end
|
45
60
|
end
|
@@ -5,22 +5,32 @@ module Arclight
|
|
5
5
|
# Extends Blacklight::Solr::Document to provide Arclight specific behavior
|
6
6
|
module SolrDocument
|
7
7
|
extend Blacklight::Solr::Document
|
8
|
+
include Arclight::EadFormatHelpers
|
8
9
|
|
9
10
|
def repository_config
|
10
11
|
return unless repository
|
12
|
+
|
11
13
|
@repository_config ||= Arclight::Repository.find_by(name: repository)
|
12
14
|
end
|
13
15
|
|
14
16
|
def parent_ids
|
15
|
-
fetch('
|
17
|
+
fetch('parent_ssim', [])
|
16
18
|
end
|
17
19
|
|
18
20
|
def parent_labels
|
19
21
|
fetch('parent_unittitles_ssm', [])
|
20
22
|
end
|
21
23
|
|
24
|
+
def parent_levels
|
25
|
+
fetch('parent_levels_ssm', [])
|
26
|
+
end
|
27
|
+
|
28
|
+
def parent_document
|
29
|
+
self.class.new fetch('parent').fetch('docs', []).first
|
30
|
+
end
|
31
|
+
|
22
32
|
def eadid
|
23
|
-
fetch('ead_ssi', nil)
|
33
|
+
fetch('ead_ssi', nil)&.strip
|
24
34
|
end
|
25
35
|
|
26
36
|
def unitid
|
@@ -39,12 +49,17 @@ module Arclight
|
|
39
49
|
first('collection_ssm')
|
40
50
|
end
|
41
51
|
|
52
|
+
def collection_unitid
|
53
|
+
first('collection_unitid_ssm')
|
54
|
+
end
|
55
|
+
|
42
56
|
def extent
|
43
57
|
first('extent_ssm')
|
44
58
|
end
|
45
59
|
|
46
60
|
def abstract_or_scope
|
47
|
-
first('abstract_ssm') || first('scopecontent_ssm')
|
61
|
+
value = first('abstract_ssm') || first('scopecontent_ssm')
|
62
|
+
render_html_tags(value: [value]) if value.present?
|
48
63
|
end
|
49
64
|
|
50
65
|
def creator
|
@@ -84,21 +99,21 @@ module Arclight
|
|
84
99
|
end
|
85
100
|
|
86
101
|
def terms
|
87
|
-
first('userestrict_ssm')
|
102
|
+
render_html_tags(value: [first('userestrict_ssm')])
|
88
103
|
end
|
89
104
|
|
90
105
|
# Restrictions for component sidebar
|
91
106
|
def parent_restrictions
|
92
|
-
first('parent_access_restrict_ssm')
|
107
|
+
render_html_tags(value: [first('parent_access_restrict_ssm')])
|
93
108
|
end
|
94
109
|
|
95
110
|
# Terms for component sidebar
|
96
111
|
def parent_terms
|
97
|
-
first('parent_access_terms_ssm')
|
112
|
+
render_html_tags(value: [first('parent_access_terms_ssm')])
|
98
113
|
end
|
99
114
|
|
100
115
|
def digital_objects
|
101
|
-
digital_objects_field = fetch('digital_objects_ssm', [])
|
116
|
+
digital_objects_field = fetch('digital_objects_ssm', []).reject(&:empty?)
|
102
117
|
return [] if digital_objects_field.blank?
|
103
118
|
|
104
119
|
digital_objects_field.map do |object|
|
@@ -125,7 +140,14 @@ module Arclight
|
|
125
140
|
return if highlight_response.blank? ||
|
126
141
|
highlight_response[id].blank? ||
|
127
142
|
highlight_response[id][:text].blank?
|
143
|
+
|
128
144
|
highlight_response[id][:text]
|
129
145
|
end
|
146
|
+
|
147
|
+
# Factory method for constructing the Object modeling downloads
|
148
|
+
# @return [DocumentDownloads]
|
149
|
+
def downloads
|
150
|
+
@downloads ||= DocumentDownloads.new(self)
|
151
|
+
end
|
130
152
|
end
|
131
153
|
end
|