arclight 0.1.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.all-contributorsrc +450 -0
- data/.codeclimate.yml +5 -0
- data/.eslintrc +14 -4
- data/.github/workflows/ruby.yml +51 -0
- data/.gitignore +2 -0
- data/.rspec +0 -1
- data/.rubocop.yml +503 -48
- data/.rubocop_todo.yml +122 -0
- data/.solr_wrapper +2 -1
- data/CONTRIBUTING.md +5 -5
- data/CONTRIBUTORS.md +79 -0
- data/Gemfile +15 -10
- data/README.md +47 -32
- 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 +4 -9
- data/app/assets/javascripts/arclight/oembed_controller.js +58 -0
- data/app/assets/javascripts/arclight/truncate_controller.js +27 -0
- data/app/assets/stylesheets/arclight/application.scss +4 -3
- data/app/assets/stylesheets/arclight/build.scss +4 -0
- data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +117 -136
- data/app/assets/stylesheets/arclight/modules/highlights.scss +3 -2
- data/app/assets/stylesheets/arclight/modules/icons.scss +20 -0
- data/app/assets/stylesheets/arclight/modules/layout.scss +203 -16
- data/app/assets/stylesheets/arclight/modules/mastheads.scss +27 -45
- data/app/assets/stylesheets/arclight/modules/repositories.scss +3 -7
- data/app/assets/stylesheets/arclight/modules/repository_card.scss +5 -50
- data/app/assets/stylesheets/arclight/modules/search_form.scss +9 -0
- data/app/assets/stylesheets/arclight/modules/search_results.scss +200 -25
- data/app/assets/stylesheets/arclight/modules/show_collection.scss +21 -61
- data/app/assets/stylesheets/arclight/modules/truncator.scss +58 -0
- data/app/assets/stylesheets/arclight/responsive.scss +13 -0
- data/app/assets/stylesheets/arclight/variables.scss +25 -2
- data/app/components/arclight/access_component.html.erb +14 -0
- data/app/components/arclight/access_component.rb +25 -0
- data/app/components/arclight/bookmark_component.html.erb +25 -0
- data/app/components/arclight/bookmark_component.rb +9 -0
- data/app/components/arclight/breadcrumb_component.rb +50 -0
- data/app/components/arclight/breadcrumbs_hierarchy_component.html.erb +34 -0
- data/app/components/arclight/breadcrumbs_hierarchy_component.rb +25 -0
- data/app/components/arclight/collection_context_component.html.erb +12 -0
- data/app/components/arclight/collection_context_component.rb +27 -0
- data/app/components/arclight/collection_info_component.html.erb +28 -0
- data/app/components/arclight/collection_info_component.rb +26 -0
- data/app/components/arclight/collection_sidebar_component.html.erb +15 -0
- data/app/components/arclight/collection_sidebar_component.rb +39 -0
- data/app/{views/catalog/_search_results_repository.html.erb → components/arclight/constraints_component.html.erb} +2 -1
- data/app/components/arclight/constraints_component.rb +17 -0
- data/app/components/arclight/document_collection_context_component.html.erb +29 -0
- data/app/components/arclight/document_collection_context_component.rb +28 -0
- data/app/components/arclight/document_collection_hierarchy_component.html.erb +50 -0
- data/app/components/arclight/document_collection_hierarchy_component.rb +62 -0
- data/app/components/arclight/document_component.html.erb +39 -0
- data/app/components/arclight/document_component.rb +49 -0
- data/app/components/arclight/document_components_hierarchy_component.html.erb +20 -0
- data/app/components/arclight/document_components_hierarchy_component.rb +34 -0
- data/app/components/arclight/document_download_component.html.erb +24 -0
- data/app/components/arclight/document_download_component.rb +71 -0
- data/app/components/arclight/embed_component.html.erb +10 -0
- data/app/components/arclight/embed_component.rb +43 -0
- data/app/components/arclight/expand_hierarchy_button_component.html.erb +5 -0
- data/app/components/arclight/expand_hierarchy_button_component.rb +16 -0
- data/app/components/arclight/group_component.html.erb +34 -0
- data/app/components/arclight/group_component.rb +23 -0
- data/app/components/arclight/header_component.html.erb +5 -0
- data/app/components/arclight/header_component.rb +10 -0
- data/app/components/arclight/index_metadata_field_component.html.erb +16 -0
- data/app/components/arclight/index_metadata_field_component.rb +20 -0
- data/app/components/arclight/masthead_component.html.erb +17 -0
- data/app/components/arclight/masthead_component.rb +10 -0
- data/app/components/arclight/metadata_section_component.html.erb +13 -0
- data/app/components/arclight/metadata_section_component.rb +22 -0
- data/app/components/arclight/oembed_viewer_component.html.erb +5 -0
- data/app/components/arclight/oembed_viewer_component.rb +16 -0
- data/app/components/arclight/online_content_filter_component.html.erb +15 -0
- data/app/components/arclight/online_content_filter_component.rb +17 -0
- data/app/components/arclight/online_status_indicator_component.rb +19 -0
- data/app/components/arclight/repository_breadcrumb_component.html.erb +10 -0
- data/app/components/arclight/repository_breadcrumb_component.rb +17 -0
- data/app/components/arclight/repository_location_component.html.erb +20 -0
- data/app/components/arclight/repository_location_component.rb +10 -0
- data/app/components/arclight/search_bar_component.html.erb +27 -0
- data/app/components/arclight/search_bar_component.rb +32 -0
- data/app/components/arclight/search_result_breadcrumbs_component.html.erb +6 -0
- data/app/components/arclight/search_result_breadcrumbs_component.rb +37 -0
- data/app/components/arclight/search_result_component.html.erb +20 -0
- data/app/components/arclight/search_result_component.rb +18 -0
- data/app/components/arclight/search_result_title_component.html.erb +15 -0
- data/app/components/arclight/search_result_title_component.rb +15 -0
- data/app/components/arclight/sidebar_component.html.erb +9 -0
- data/app/components/arclight/sidebar_component.rb +19 -0
- data/app/components/arclight/upper_metadata_layout_component.rb +10 -0
- data/app/components/blacklight/icons/bookmark_component.rb +12 -0
- data/app/components/blacklight/icons/collection_component.rb +14 -0
- data/app/components/blacklight/icons/compact_component.rb +12 -0
- data/app/components/blacklight/icons/container_component.rb +14 -0
- data/app/components/blacklight/icons/ead_component.rb +12 -0
- data/app/components/blacklight/icons/file_component.rb +14 -0
- data/app/components/blacklight/icons/folder_component.rb +12 -0
- data/app/components/blacklight/icons/online_component.rb +15 -0
- data/app/components/blacklight/icons/pdf_component.rb +12 -0
- data/app/components/blacklight/icons/repository_component.rb +12 -0
- data/app/controllers/arclight/repositories_controller.rb +4 -4
- data/app/helpers/arclight/ead_format_helpers.rb +309 -0
- data/app/helpers/arclight/field_config_helpers.rb +26 -0
- data/app/helpers/arclight_helper.rb +55 -120
- data/app/models/arclight/document_downloads.rb +122 -0
- data/app/models/arclight/parent.rb +9 -9
- data/app/models/arclight/parents.rb +9 -4
- data/app/models/arclight/requests/aeon_external_request.rb +42 -0
- data/app/models/arclight/requests/aeon_web_ead.rb +52 -0
- data/app/models/arclight/requests/google_form.rb +8 -3
- data/app/models/concerns/arclight/catalog.rb +33 -11
- data/app/models/concerns/arclight/search_behavior.rb +22 -21
- data/app/models/concerns/arclight/solr_document.rb +88 -59
- data/app/presenters/arclight/show_presenter.rb +34 -7
- data/app/views/arclight/_requests.html.erb +7 -0
- data/app/views/arclight/repositories/_repository.html.erb +22 -41
- data/app/views/arclight/repositories/index.html.erb +5 -0
- data/app/views/arclight/repositories/show.html.erb +7 -8
- data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +8 -0
- data/app/views/arclight/requests/_aeon_web_ead.html.erb +6 -0
- data/app/views/arclight/requests/_google_form.html.erb +4 -5
- data/app/views/catalog/_document_list.html.erb +8 -0
- data/app/views/catalog/_group.html.erb +4 -0
- data/app/views/catalog/_group_toggle.html.erb +10 -0
- data/app/views/catalog/_search_results_header.html.erb +3 -0
- data/app/views/catalog/hierarchy.html.erb +19 -0
- data/app/views/catalog/index.html.erb +16 -7
- data/app/views/shared/_breadcrumbs.html.erb +3 -15
- data/app/views/shared/_main_menu_links.html.erb +1 -1
- data/arclight.gemspec +22 -17
- data/config/breadcrumbs.rb +24 -0
- data/config/i18n-tasks.yml +134 -0
- data/config/importmap.rb +3 -0
- data/config/locales/arclight.en.yml +90 -55
- data/config/routes.rb +1 -1
- data/docker-compose.yml +16 -0
- data/lib/arclight/digital_object.rb +2 -1
- data/lib/arclight/engine.rb +23 -31
- data/lib/arclight/exceptions.rb +1 -0
- data/lib/arclight/hash_absolute_xpath.rb +62 -0
- data/lib/arclight/level_label.rb +46 -0
- data/lib/arclight/missing_id_strategy.rb +21 -0
- data/lib/arclight/normalized_date.rb +24 -20
- data/lib/arclight/normalized_id.rb +7 -2
- data/lib/arclight/normalized_title.rb +3 -0
- data/lib/arclight/repository.rb +72 -47
- data/lib/arclight/routes/hierarchy.rb +19 -0
- data/lib/arclight/routes.rb +8 -0
- data/lib/arclight/traject/ead2_component_config.rb +335 -0
- data/lib/arclight/traject/ead2_config.rb +316 -0
- data/lib/arclight/traject/nokogiri_namespaceless_reader.rb +22 -0
- data/lib/arclight/version.rb +1 -1
- data/lib/arclight/year_range.rb +13 -4
- data/lib/arclight.rb +6 -1
- data/lib/generators/arclight/install_generator.rb +110 -10
- data/lib/generators/arclight/templates/arclight.scss +6 -3
- data/lib/generators/arclight/templates/catalog_controller.rb +249 -173
- data/lib/generators/arclight/templates/config/downloads.yml +12 -0
- data/lib/generators/arclight/templates/config/locales/arclight.en.yml +61 -0
- data/lib/generators/arclight/templates/config/repositories.yml +42 -31
- data/lib/generators/arclight/update_generator.rb +1 -1
- data/lib/tasks/index.rake +25 -28
- data/package.json +15 -9
- data/solr/conf/schema.xml +101 -332
- data/solr/conf/solrconfig.xml +99 -164
- data/tasks/arclight.rake +22 -11
- data/template.rb +6 -11
- metadata +230 -105
- data/.travis.yml +0 -33
- data/app/assets/javascripts/arclight/collection_context.js +0 -18
- data/app/assets/javascripts/arclight/collection_navigation.js +0 -114
- data/app/assets/javascripts/arclight/collection_scrollspy.js +0 -6
- data/app/assets/javascripts/arclight/component_ancestors.js +0 -56
- data/app/assets/javascripts/arclight/oembed_viewer.js +0 -39
- data/app/assets/javascripts/arclight/truncator.js.erb +0 -23
- data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +0 -3
- data/app/assets/stylesheets/arclight/modules/sidebar.scss +0 -16
- data/app/controllers/concerns/arclight/field_config_helpers.rb +0 -86
- data/app/factories/blacklight_field_configuration_factory.rb +0 -29
- data/app/views/arclight/repositories/_in_person_repository.html.erb +0 -19
- data/app/views/arclight/viewers/_oembed.html.erb +0 -7
- data/app/views/catalog/_arclight_document_index_header.html.erb +0 -13
- data/app/views/catalog/_arclight_document_index_header_online_contents_default.html.erb +0 -0
- data/app/views/catalog/_arclight_document_show_header.html.erb +0 -15
- data/app/views/catalog/_arclight_document_show_header_collection.html.erb +0 -12
- data/app/views/catalog/_arclight_index_compact_default.html.erb +0 -15
- data/app/views/catalog/_arclight_online_content_indicator.html.erb +0 -5
- data/app/views/catalog/_arclight_rangelimit.html.erb +0 -24
- data/app/views/catalog/_arclight_viewer_default.html.erb +0 -1
- data/app/views/catalog/_collection_contents.html.erb +0 -12
- data/app/views/catalog/_collection_count.html.erb +0 -7
- data/app/views/catalog/_collection_downloads.html.erb +0 -17
- data/app/views/catalog/_collection_online_contents.html.erb +0 -17
- data/app/views/catalog/_collection_overview.html.erb +0 -7
- data/app/views/catalog/_component_overview.html.erb +0 -46
- data/app/views/catalog/_context_card.html.erb +0 -27
- data/app/views/catalog/_context_sidebar.html.erb +0 -8
- data/app/views/catalog/_custom_metadata.html.erb +0 -16
- data/app/views/catalog/_home.html.erb +0 -1
- data/app/views/catalog/_index_breadcrumb_default.html.erb +0 -3
- data/app/views/catalog/_index_default.html.erb +0 -17
- data/app/views/catalog/_index_header.html.erb +0 -7
- data/app/views/catalog/_index_header_hierarchy_default.html.erb +0 -42
- data/app/views/catalog/_index_header_online_contents_default.html.erb +0 -1
- data/app/views/catalog/_index_hierarchy_default.html.erb +0 -28
- data/app/views/catalog/_index_online_contents_default.html.erb +0 -6
- data/app/views/catalog/_results_histogram.html.erb +0 -10
- data/app/views/catalog/_search_results.html.erb +0 -31
- data/app/views/catalog/_search_within_form.html.erb +0 -16
- data/app/views/catalog/_show_breadcrumbs_default.html.erb +0 -7
- data/app/views/catalog/_show_collection.html.erb +0 -40
- data/app/views/catalog/_show_component_sidebar.html.erb +0 -12
- data/app/views/catalog/_show_default.html.erb +0 -32
- data/app/views/catalog/_show_header.html.erb +0 -5
- data/app/views/catalog/_show_sidebar.html.erb +0 -30
- data/app/views/layouts/catalog_result.html.erb +0 -7
- data/app/views/shared/_context_sidebar.html.erb +0 -8
- data/app/views/shared/_header_navbar.html.erb +0 -54
- data/lib/arclight/custom_component.rb +0 -98
- 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 -159
- data/lib/arclight/viewer.rb +0 -45
- data/lib/arclight/viewers/oembed.rb +0 -56
- data/lib/generators/arclight/templates/arclight.js +0 -2
- data/solr/conf/scripts.conf +0 -24
- data/vendor/assets/javascripts/responsiveTruncator.js +0 -69
- data/vendor/assets/javascripts/stickyfill.js +0 -480
- /data/app/assets/images/{blacklight → arclight}/logo.png +0 -0
- /data/{app/views/catalog/_arclight_document_index_header_hierarchy_default.html.erb → config/repositories.yml} +0 -0
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Arclight
|
|
4
|
-
##
|
|
5
|
-
# A mixin intended to share indexing behavior between
|
|
6
|
-
# the CustomDocument and CustomComponent classes
|
|
7
|
-
module SharedIndexingBehavior
|
|
8
|
-
# @see http://eadiva.com/2/unitdate/
|
|
9
|
-
# @return [YearRange] all of the years between the given years
|
|
10
|
-
def unitdate_for_range
|
|
11
|
-
range = YearRange.new
|
|
12
|
-
return range if normal_unit_dates.blank?
|
|
13
|
-
range << range.parse_ranges(normal_unit_dates)
|
|
14
|
-
range
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def subjects_array(elements, parent:)
|
|
18
|
-
xpath_elements = elements.map { |el| "local-name()='#{el}'" }.join(' or ')
|
|
19
|
-
subjects = search("//#{parent}/controlaccess/*[#{xpath_elements}]").to_a
|
|
20
|
-
clean_facets_array(subjects.flatten.map(&:text))
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def names_array(elements, parent:)
|
|
24
|
-
xpath_elements = elements.map { |el| "local-name()='#{el}'" }.join(' or ')
|
|
25
|
-
names = search("//#{parent}/controlaccess/*[#{xpath_elements}]").to_a
|
|
26
|
-
clean_facets_array(names.flatten.map(&:text))
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Return a cleaned array of facets without marc subfields
|
|
30
|
-
#
|
|
31
|
-
# E.g. clean_facets_array(
|
|
32
|
-
# ['FacetValue1 |z FacetValue2','FacetValue3']
|
|
33
|
-
# ) => ['FacetValue1 -- FacetValue2', 'FacetValue3']
|
|
34
|
-
def clean_facets_array(facets_array)
|
|
35
|
-
Array(facets_array).map { |text| fix_subfield_demarcators(text) }.compact.uniq
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# Replace MARC style subfield demarcators
|
|
39
|
-
#
|
|
40
|
-
# Usage: fix_subfield_demarcators("Subject 1 |z Sub-Subject 2") => "Subject 1 -- Sub-Subject 2"
|
|
41
|
-
def fix_subfield_demarcators(value)
|
|
42
|
-
value.gsub(/\|\w{1}/, '--')
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Wrap OM's find_by_xpath for convenience
|
|
46
|
-
def search(path)
|
|
47
|
-
find_by_xpath(path) # rubocop:disable DynamicFindBy
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
# If a repository slug is provided via an environment variable `REPOSITORY_ID`,
|
|
51
|
-
# then use that to lookup the name rather than the parsed out name from the EAD
|
|
52
|
-
# @param [String] `repository` the default repository name
|
|
53
|
-
def repository_as_configured(repository)
|
|
54
|
-
slug = ENV['REPOSITORY_ID']
|
|
55
|
-
if slug.present?
|
|
56
|
-
begin
|
|
57
|
-
Arclight::Repository.find_by(slug: slug).name
|
|
58
|
-
rescue => e
|
|
59
|
-
raise "The repository slug '#{slug}' was given but it is not found in the Repository configuration data: #{e}"
|
|
60
|
-
end
|
|
61
|
-
else
|
|
62
|
-
repository
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def add_digital_content(prefix:, solr_doc:)
|
|
67
|
-
dao = ng_xml.xpath("#{prefix}/dao").to_a
|
|
68
|
-
return if dao.blank?
|
|
69
|
-
field_name = Solrizer.solr_name('digital_objects', :displayable)
|
|
70
|
-
solr_doc[field_name] = digital_objects(dao)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def digital_objects(objects)
|
|
74
|
-
objects.map do |dao|
|
|
75
|
-
label = dao.attributes['title'].try(:value) || dao.xpath('daodesc/p').try(:text)
|
|
76
|
-
href = (dao.attributes['href'] || dao.attributes['xlink:href']).try(:value)
|
|
77
|
-
Arclight::DigitalObject.new(label: label, href: href).to_json
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
def add_date_ranges(solr_doc)
|
|
82
|
-
Solrizer.insert_field(solr_doc, 'date_range', unitdate_for_range.years, :facetable)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def add_normalized_title(solr_doc)
|
|
86
|
-
dates = Arclight::NormalizedDate.new(unitdate_inclusive.first, unitdate_bulk.first, unitdate_other.first).to_s
|
|
87
|
-
title = Arclight::NormalizedTitle.new(solr_doc['title_ssm'].try(:first), dates).to_s
|
|
88
|
-
solr_doc['normalized_title_ssm'] = [title]
|
|
89
|
-
solr_doc['normalized_date_ssm'] = [dates]
|
|
90
|
-
title
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def online_content?
|
|
94
|
-
search('//dao[@href]').present?
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
end
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Arclight
|
|
4
|
-
##
|
|
5
|
-
# An extendable mixin intended to share terminology behavior between
|
|
6
|
-
# the CustomDocument and CustomComponent classes
|
|
7
|
-
module SharedTerminologyBehavior
|
|
8
|
-
def add_unitid(t, prefix)
|
|
9
|
-
t.unitid(path: prefix + 'did/unitid', index_as: %i[displayable searchable])
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def add_extent(t, prefix)
|
|
13
|
-
t.extent(path: prefix + 'did/physdesc/extent', index_as: %i[displayable searchable])
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# date indexing
|
|
17
|
-
def add_dates(t, prefix)
|
|
18
|
-
t.normal_unit_dates(path: prefix + 'did/unitdate/@normal')
|
|
19
|
-
t.unitdate_bulk(path: prefix + 'did/unitdate[@type=\'bulk\']', index_as: %i[displayable])
|
|
20
|
-
t.unitdate_inclusive(path: prefix + 'did/unitdate[@type=\'inclusive\']', index_as: %i[displayable])
|
|
21
|
-
t.unitdate_other(path: prefix + 'did/unitdate[not(@type)]', index_as: %i[displayable])
|
|
22
|
-
t.unitdate(path: prefix + 'did/unitdate', index_as: %i[displayable])
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def add_searchable_notes(t, prefix) # rubocop: disable Metrics/MethodLength
|
|
26
|
-
# various searchable notes
|
|
27
|
-
%i[
|
|
28
|
-
accessrestrict
|
|
29
|
-
accruals
|
|
30
|
-
acqinfo
|
|
31
|
-
altformavail
|
|
32
|
-
appraisal
|
|
33
|
-
arrangement
|
|
34
|
-
bibliography
|
|
35
|
-
bioghist
|
|
36
|
-
custodhist
|
|
37
|
-
fileplan
|
|
38
|
-
note
|
|
39
|
-
odd
|
|
40
|
-
originalsloc
|
|
41
|
-
otherfindaid
|
|
42
|
-
phystech
|
|
43
|
-
prefercite
|
|
44
|
-
processinfo
|
|
45
|
-
relatedmaterial
|
|
46
|
-
scopecontent
|
|
47
|
-
separatedmaterial
|
|
48
|
-
userestrict
|
|
49
|
-
].each do |k|
|
|
50
|
-
# many of the notes support various markup so we want everything but the heading
|
|
51
|
-
t.send(k, path: "#{prefix}#{k}/*[local-name()!=\"head\"]", index_as: %i[displayable searchable])
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
# various searchable notes in the did
|
|
55
|
-
%i[
|
|
56
|
-
abstract
|
|
57
|
-
materialspec
|
|
58
|
-
physloc
|
|
59
|
-
].each do |k|
|
|
60
|
-
t.send(k, path: "#{prefix}did/#{k}", index_as: %i[displayable searchable])
|
|
61
|
-
end
|
|
62
|
-
t.did_note(path: "#{prefix}did/note", index_as: %i[displayable searchable]) # conflicts with top-level note
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Arclight
|
|
4
|
-
##
|
|
5
|
-
# An module to extend SolrEad::Indexer behaviors to allow us to add
|
|
6
|
-
# or override behaviors that require knowledge of the entire XML document.
|
|
7
|
-
module SolrEadIndexerExt
|
|
8
|
-
def additional_component_fields(node, addl_fields = {})
|
|
9
|
-
solr_doc = super
|
|
10
|
-
|
|
11
|
-
add_count_of_child_compontents(node, solr_doc)
|
|
12
|
-
add_ancestral_titles(node, solr_doc)
|
|
13
|
-
add_ancestral_ids(node, solr_doc)
|
|
14
|
-
|
|
15
|
-
add_collection_creator_to_component(node, solr_doc)
|
|
16
|
-
|
|
17
|
-
add_self_or_parents_restrictions(node, solr_doc)
|
|
18
|
-
|
|
19
|
-
add_self_or_parents_terms(node, solr_doc)
|
|
20
|
-
|
|
21
|
-
solr_doc
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def delete_all
|
|
25
|
-
solr.delete_by_query('*:*')
|
|
26
|
-
solr.commit
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
# Note that we need to redo what solr_ead does for ids due to our normalization process
|
|
32
|
-
def add_ancestral_ids(node, solr_doc)
|
|
33
|
-
@parent_id_name ||= Solrizer.solr_name('parent', :stored_sortable)
|
|
34
|
-
@parent_ids_field_name ||= Solrizer.solr_name('parent', :displayable)
|
|
35
|
-
@parent_ids_search_field_name ||= Solrizer.solr_name('parent', :searchable)
|
|
36
|
-
|
|
37
|
-
ids = ancestral_ids(node)
|
|
38
|
-
solr_doc[@parent_ids_field_name] = ids
|
|
39
|
-
solr_doc[@parent_ids_search_field_name] = ids
|
|
40
|
-
solr_doc[@parent_id_name] = ids.last
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Note that we need to redo what solr_ead does for titles due to our normalization process
|
|
44
|
-
def add_ancestral_titles(node, solr_doc)
|
|
45
|
-
@parent_titles_field_name ||= Solrizer.solr_name('parent_unittitles', :displayable)
|
|
46
|
-
@parent_titles_search_field_name ||= Solrizer.solr_name('parent_unittitles', :searchable)
|
|
47
|
-
@collection_facet_name ||= Solrizer.solr_name('collection', :facetable)
|
|
48
|
-
@collection_name ||= Solrizer.solr_name('collection', :displayable)
|
|
49
|
-
|
|
50
|
-
titles = ancestral_titles(node)
|
|
51
|
-
solr_doc[@parent_titles_field_name] = titles
|
|
52
|
-
solr_doc[@parent_titles_search_field_name] = titles
|
|
53
|
-
solr_doc[@collection_name] = [titles.first] # collection is always on top
|
|
54
|
-
solr_doc[@collection_facet_name] = [titles.first]
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def add_count_of_child_compontents(node, solr_doc)
|
|
58
|
-
@child_component_count_name ||= Solrizer.solr_name('child_component_count', type: :integer)
|
|
59
|
-
|
|
60
|
-
solr_doc[@child_component_count_name] = node.xpath('count(c)').to_i
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def ancestral_ids(node)
|
|
64
|
-
ancestral_visit(node, :normalized_component_id, :normalized_collection_id)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def ancestral_titles(node)
|
|
68
|
-
ancestral_visit(node, :normalized_component_title, :normalized_collection_title)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# visit each component's parent and finish with a visit on the collection
|
|
72
|
-
def ancestral_visit(node, component_fn, collection_fn, results = [])
|
|
73
|
-
while node.parent && node.parent.name == 'c'
|
|
74
|
-
parent = node.parent
|
|
75
|
-
results << send(component_fn, parent)
|
|
76
|
-
node = parent
|
|
77
|
-
end
|
|
78
|
-
results << send(collection_fn, node)
|
|
79
|
-
results.reverse
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def normalized_component_title(node)
|
|
83
|
-
data = extract_title_and_dates(node)
|
|
84
|
-
normalize_title(data)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def normalized_collection_title(node)
|
|
88
|
-
data = extract_title_and_dates(node, '//archdesc/')
|
|
89
|
-
normalize_title(data)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def normalize_title(data)
|
|
93
|
-
Arclight::NormalizedTitle.new(
|
|
94
|
-
data[:title],
|
|
95
|
-
Arclight::NormalizedDate.new(
|
|
96
|
-
data[:unitdate_inclusive],
|
|
97
|
-
data[:unitdate_bulk],
|
|
98
|
-
data[:unitdate_other]
|
|
99
|
-
).to_s
|
|
100
|
-
).to_s
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
# TODO: these xpaths should be DRY'd up -- they're in both terminologies
|
|
104
|
-
def extract_title_and_dates(node, prefix = nil)
|
|
105
|
-
data = {
|
|
106
|
-
title: node.at_xpath("#{prefix}did/unittitle"),
|
|
107
|
-
unitdate_inclusive: node.at_xpath("#{prefix}did/unitdate[@type=\"inclusive\"]"),
|
|
108
|
-
unitdate_bulk: node.at_xpath("#{prefix}did/unitdate[@type=\"bulk\"]"),
|
|
109
|
-
unitdate_other: node.at_xpath("#{prefix}did/unitdate[not(@type)]")
|
|
110
|
-
}
|
|
111
|
-
data.each do |k, v|
|
|
112
|
-
data[k] = v.text if v
|
|
113
|
-
end
|
|
114
|
-
data
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
def normalized_component_id(node)
|
|
118
|
-
Arclight::NormalizedId.new(node['id'].to_s).to_s
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
def normalized_collection_id(node)
|
|
122
|
-
Arclight::NormalizedId.new(node.document.at_xpath('//eadid').text).to_s
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
# This mimics similar behavior in Arclight::CustomDocument
|
|
126
|
-
def add_collection_creator_to_component(node, solr_doc)
|
|
127
|
-
field_name = Solrizer.solr_name('collection_creator', :displayable)
|
|
128
|
-
repository = solr_doc[Solrizer.solr_name('repository', :displayable)]
|
|
129
|
-
creators = node.xpath('//archdesc/did/origination[@label="creator"]/*/text()').map(&:text)
|
|
130
|
-
solr_doc[field_name] = creators - [repository]
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
def parent_check_list(node, root_path, element_path, results = [])
|
|
134
|
-
orginal_node = node
|
|
135
|
-
results = node.xpath("#{root_path}/#{element_path}").map(&:text)
|
|
136
|
-
# if current restriction return, else go up to parent and check
|
|
137
|
-
while node.parent.name == 'c' && results.blank?
|
|
138
|
-
parent = node.parent
|
|
139
|
-
results = parent.xpath("#{root_path}/#{element_path}").map(&:text)
|
|
140
|
-
node = parent
|
|
141
|
-
end
|
|
142
|
-
# If no parental results, check the collection
|
|
143
|
-
results = orginal_node.xpath("//archdesc/#{element_path}").map(&:text) if results.blank?
|
|
144
|
-
results.flatten # can't use with flatten! because that returns nil
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def add_self_or_parents_restrictions(node, solr_doc)
|
|
148
|
-
field_name = Solrizer.solr_name('parent_access_restrict', :displayable)
|
|
149
|
-
solr_doc[field_name] = parent_check_list(node, './', 'accessrestrict/p/text()')
|
|
150
|
-
solr_doc[field_name]
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def add_self_or_parents_terms(node, solr_doc)
|
|
154
|
-
field_name = Solrizer.solr_name('parent_access_terms', :displayable)
|
|
155
|
-
solr_doc[field_name] = parent_check_list(node, './', 'userestrict/p/text()')
|
|
156
|
-
solr_doc[field_name]
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
end
|
data/lib/arclight/viewer.rb
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'arclight/viewers/oembed'
|
|
4
|
-
|
|
5
|
-
module Arclight
|
|
6
|
-
##
|
|
7
|
-
# Arclight::Viewer provides the ability to render a configured viewer
|
|
8
|
-
# The viewer class is configured through the Arclight::Engine configuration
|
|
9
|
-
# which allows an application to implement their own viewer class.
|
|
10
|
-
# This class will receive a SolrDocument and must implement to_partial_path.
|
|
11
|
-
# See Arclight::Viewers::OEmbed for an example implementation of a viewer.
|
|
12
|
-
class Viewer
|
|
13
|
-
def self.render(document)
|
|
14
|
-
new(document).render
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def initialize(document)
|
|
18
|
-
@document = document
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def render
|
|
22
|
-
renderer.render(
|
|
23
|
-
viewer_instance.to_partial_path,
|
|
24
|
-
layout: false,
|
|
25
|
-
locals: { viewer: viewer_instance }
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
attr_reader :document
|
|
32
|
-
|
|
33
|
-
def viewer_instance
|
|
34
|
-
viewer_class.new(document)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def viewer_class
|
|
38
|
-
Arclight::Engine.config.viewer_class
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def renderer
|
|
42
|
-
ApplicationController.renderer
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Arclight
|
|
4
|
-
module Viewers
|
|
5
|
-
##
|
|
6
|
-
# A class to represent and render an oEmbed viewer.
|
|
7
|
-
# This defines a partial to be rendered and can
|
|
8
|
-
# apply any required logic to help map necessary
|
|
9
|
-
# document attributes for viewer instantiation
|
|
10
|
-
#
|
|
11
|
-
# This viewer assumes that the resource itself is requestable
|
|
12
|
-
# according the CORS policy of the site. This is because we
|
|
13
|
-
# fetch the resource and look for a link[rel="alternate"] with
|
|
14
|
-
# a type="application/json+oembed". Th oEmbed endpoint described
|
|
15
|
-
# with that link tag should be an oEmbed RICH type, and return
|
|
16
|
-
# the viewer HTML in the html key of the JSON response.
|
|
17
|
-
class OEmbed
|
|
18
|
-
attr_reader :document
|
|
19
|
-
|
|
20
|
-
def initialize(document)
|
|
21
|
-
@document = document
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def resources
|
|
25
|
-
document.digital_objects
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def embeddable?(resource)
|
|
29
|
-
resource == resources.first && embeddable_resources.include?(resource)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def attributes_for(resource)
|
|
33
|
-
return {} unless embeddable?(resource)
|
|
34
|
-
{ class: 'al-oembed-viewer', 'data-arclight-oembed': true, 'data-arclight-oembed-url': resource.href }
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def to_partial_path
|
|
38
|
-
'arclight/viewers/_oembed'
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
private
|
|
42
|
-
|
|
43
|
-
def exclude_patterns
|
|
44
|
-
Arclight::Engine.config.oembed_resource_exclude_patterns
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def embeddable_resources
|
|
48
|
-
document.digital_objects.reject do |object|
|
|
49
|
-
exclude_patterns.any? do |pattern|
|
|
50
|
-
object.href =~ pattern
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
data/solr/conf/scripts.conf
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
-
# contributor license agreements. See the NOTICE file distributed with
|
|
3
|
-
# this work for additional information regarding copyright ownership.
|
|
4
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
5
|
-
# (the "License"); you may not use this file except in compliance with
|
|
6
|
-
# the License. You may obtain a copy of the License at
|
|
7
|
-
#
|
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
#
|
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
# See the License for the specific language governing permissions and
|
|
14
|
-
# limitations under the License.
|
|
15
|
-
|
|
16
|
-
user=
|
|
17
|
-
solr_hostname=localhost
|
|
18
|
-
solr_port=8983
|
|
19
|
-
rsyncd_port=18983
|
|
20
|
-
data_dir=
|
|
21
|
-
webapp_name=solr
|
|
22
|
-
master_host=
|
|
23
|
-
master_data_dir=
|
|
24
|
-
master_status_dir=
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* jQuery Responsive Truncator Plugin
|
|
3
|
-
*
|
|
4
|
-
* https://github.com/jkeck/responsiveTruncator
|
|
5
|
-
*
|
|
6
|
-
* VERSION 0.0.2
|
|
7
|
-
*
|
|
8
|
-
**/
|
|
9
|
-
(function( $ ){
|
|
10
|
-
$.fn.responsiveTruncate = function(options){
|
|
11
|
-
var $this = this;
|
|
12
|
-
$(window).bind("resize", function(){
|
|
13
|
-
removeTruncation($this);
|
|
14
|
-
addTruncation($this);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
addTruncation($this);
|
|
18
|
-
|
|
19
|
-
function addTruncation(el){
|
|
20
|
-
el.each(function(){
|
|
21
|
-
if($(".responsiveTruncate", $(this)).length == 0){
|
|
22
|
-
var parent = $(this);
|
|
23
|
-
var fontSize = $(this).css('font-size');
|
|
24
|
-
var lineHeight = $(this).css("line-height") ? $(this).css("line-height").replace('px','') : Math.floor(parseInt(fontSize.replace('px','')) * 1.5);
|
|
25
|
-
var total_lines = Math.ceil(parent.height() / lineHeight);
|
|
26
|
-
var settings = $.extend({
|
|
27
|
-
'lines' : 3,
|
|
28
|
-
'height' : null,
|
|
29
|
-
'more' : 'more',
|
|
30
|
-
'less' : 'less'
|
|
31
|
-
}, options);
|
|
32
|
-
var truncate_height;
|
|
33
|
-
if(settings.height){
|
|
34
|
-
truncate_height = settings.height;
|
|
35
|
-
}else{
|
|
36
|
-
truncate_height = (lineHeight * settings.lines);
|
|
37
|
-
}
|
|
38
|
-
if(parent.height() > truncate_height) {
|
|
39
|
-
var orig_content = parent.html();
|
|
40
|
-
parent.html("<div style='height: " + truncate_height + "px; overflow: hidden;' class='responsiveTruncate'></div>");
|
|
41
|
-
var truncate = $(".responsiveTruncate", parent);
|
|
42
|
-
truncate.html(orig_content);
|
|
43
|
-
truncate.after("<a class='responsiveTruncatorToggle' href='#'>" + settings.more + "</a>");
|
|
44
|
-
var toggle_link = $(".responsiveTruncatorToggle", parent);
|
|
45
|
-
toggle_link.click(function(){
|
|
46
|
-
var text = toggle_link.text() == settings.more ? settings.less : settings.more;
|
|
47
|
-
toggle_link.text(text);
|
|
48
|
-
if(truncate.height() == truncate_height){
|
|
49
|
-
truncate.css({height: '100%'})
|
|
50
|
-
}else{
|
|
51
|
-
truncate.css({height: truncate_height})
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function removeTruncation(el){
|
|
61
|
-
el.each(function(){
|
|
62
|
-
if($(".responsiveTruncate", $(this)).length > 0){
|
|
63
|
-
$(this).html($(".responsiveTruncate", $(this)).html());
|
|
64
|
-
$(".responsiveTruncatorToggle", $(this)).remove();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
})( jQuery );
|