arclight 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc +12 -0
- data/.gitignore +5 -0
- data/.rubocop.yml +66 -0
- data/.solr_wrapper +5 -0
- data/.travis.yml +30 -2
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +36 -0
- data/LICENSE.txt +1 -0
- data/README.md +85 -12
- data/Rakefile +14 -3
- data/app/assets/images/blacklight/compact.svg +25 -0
- data/app/assets/images/blacklight/logo.png +0 -0
- data/app/assets/javascripts/arclight/arclight.js +9 -0
- data/app/assets/javascripts/arclight/collection_context.js +18 -0
- data/app/assets/javascripts/arclight/collection_navigation.js +114 -0
- data/app/assets/javascripts/arclight/collection_scrollspy.js +6 -0
- data/app/assets/javascripts/arclight/component_ancestors.js +56 -0
- data/app/assets/javascripts/arclight/oembed_viewer.js +39 -0
- data/app/assets/javascripts/arclight/truncator.js.erb +23 -0
- data/app/assets/stylesheets/arclight/application.scss +13 -0
- data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +3 -0
- data/app/assets/stylesheets/arclight/modules/collection_search.scss +3 -0
- data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +174 -0
- data/app/assets/stylesheets/arclight/modules/highlights.scss +10 -0
- data/app/assets/stylesheets/arclight/modules/layout.scss +33 -0
- data/app/assets/stylesheets/arclight/modules/mastheads.scss +60 -0
- data/app/assets/stylesheets/arclight/modules/repositories.scss +29 -0
- data/app/assets/stylesheets/arclight/modules/repository_card.scss +54 -0
- data/app/assets/stylesheets/arclight/modules/search_results.scss +75 -0
- data/app/assets/stylesheets/arclight/modules/show_collection.scss +78 -0
- data/app/assets/stylesheets/arclight/modules/sidebar.scss +16 -0
- data/app/assets/stylesheets/arclight/variables.scss +2 -0
- data/app/controllers/arclight/repositories_controller.rb +40 -0
- data/app/controllers/concerns/arclight/field_config_helpers.rb +86 -0
- data/app/factories/blacklight_field_configuration_factory.rb +29 -0
- data/app/helpers/arclight_helper.rb +173 -0
- data/app/models/arclight/parent.rb +24 -0
- data/app/models/arclight/parents.rb +34 -0
- data/app/models/arclight/requests/google_form.rb +44 -0
- data/app/models/concerns/arclight/catalog.rb +22 -0
- data/app/models/concerns/arclight/search_behavior.rb +46 -0
- data/app/models/concerns/arclight/solr_document.rb +131 -0
- data/app/presenters/arclight/index_presenter.rb +10 -0
- data/app/presenters/arclight/show_presenter.rb +27 -0
- data/app/views/arclight/.keep +0 -0
- data/app/views/arclight/repositories/_in_person_repository.html.erb +19 -0
- data/app/views/arclight/repositories/_repository.html.erb +62 -0
- data/app/views/arclight/repositories/index.html.erb +4 -0
- data/app/views/arclight/repositories/show.html.erb +38 -0
- data/app/views/arclight/requests/_google_form.html.erb +11 -0
- data/app/views/arclight/viewers/_oembed.html.erb +7 -0
- data/app/views/catalog/_arclight_document_index_header.html.erb +13 -0
- data/app/views/catalog/_arclight_document_index_header_hierarchy_default.html.erb +0 -0
- 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 +15 -0
- data/app/views/catalog/_arclight_document_show_header_collection.html.erb +12 -0
- data/app/views/catalog/_arclight_index_compact_default.html.erb +15 -0
- data/app/views/catalog/_arclight_online_content_indicator.html.erb +5 -0
- data/app/views/catalog/_arclight_rangelimit.html.erb +24 -0
- data/app/views/catalog/_arclight_viewer_default.html.erb +1 -0
- data/app/views/catalog/_collection_contents.html.erb +12 -0
- data/app/views/catalog/_collection_count.html.erb +7 -0
- data/app/views/catalog/_collection_downloads.html.erb +17 -0
- data/app/views/catalog/_collection_online_contents.html.erb +17 -0
- data/app/views/catalog/_collection_overview.html.erb +7 -0
- data/app/views/catalog/_component_overview.html.erb +46 -0
- data/app/views/catalog/_context_card.html.erb +27 -0
- data/app/views/catalog/_context_sidebar.html.erb +8 -0
- data/app/views/catalog/_custom_metadata.html.erb +16 -0
- data/app/views/catalog/_home.html.erb +1 -0
- data/app/views/catalog/_index_breadcrumb_default.html.erb +3 -0
- data/app/views/catalog/_index_default.html.erb +17 -0
- data/app/views/catalog/_index_header.html.erb +7 -0
- data/app/views/catalog/_index_header_hierarchy_default.html.erb +42 -0
- data/app/views/catalog/_index_header_online_contents_default.html.erb +1 -0
- data/app/views/catalog/_index_hierarchy_default.html.erb +28 -0
- data/app/views/catalog/_index_online_contents_default.html.erb +6 -0
- data/app/views/catalog/_results_histogram.html.erb +10 -0
- data/app/views/catalog/_search_results.html.erb +31 -0
- data/app/views/catalog/_search_results_repository.html.erb +6 -0
- data/app/views/catalog/_search_within_form.html.erb +16 -0
- data/app/views/catalog/_show_breadcrumbs_default.html.erb +7 -0
- data/app/views/catalog/_show_collection.html.erb +40 -0
- data/app/views/catalog/_show_component_sidebar.html.erb +12 -0
- data/app/views/catalog/_show_default.html.erb +32 -0
- data/app/views/catalog/_show_header.html.erb +5 -0
- data/app/views/catalog/_show_sidebar.html.erb +30 -0
- data/app/views/catalog/index.html.erb +8 -0
- data/app/views/layouts/catalog_result.html.erb +7 -0
- data/app/views/shared/_breadcrumbs.html.erb +15 -0
- data/app/views/shared/_context_sidebar.html.erb +8 -0
- data/app/views/shared/_header_navbar.html.erb +54 -0
- data/app/views/shared/_main_menu_links.html.erb +6 -0
- data/arclight.gemspec +17 -4
- data/bin/rails +13 -0
- data/config/locales/arclight.en.yml +65 -0
- data/config/routes.rb +6 -0
- data/lib/arclight.rb +5 -0
- data/lib/arclight/custom_component.rb +98 -0
- data/lib/arclight/custom_document.rb +93 -0
- data/lib/arclight/digital_object.rb +26 -0
- data/lib/arclight/engine.rb +55 -0
- data/lib/arclight/exceptions.rb +18 -0
- data/lib/arclight/indexer.rb +9 -0
- data/lib/arclight/normalized_date.rb +45 -0
- data/lib/arclight/normalized_id.rb +25 -0
- data/lib/arclight/normalized_title.rb +30 -0
- data/lib/arclight/repository.rb +91 -0
- data/lib/arclight/shared_indexing_behavior.rb +97 -0
- data/lib/arclight/shared_terminology_behavior.rb +65 -0
- data/lib/arclight/solr_ead_indexer_ext.rb +159 -0
- data/lib/arclight/version.rb +3 -1
- data/lib/arclight/viewer.rb +45 -0
- data/lib/arclight/viewers/oembed.rb +56 -0
- data/lib/arclight/year_range.rb +102 -0
- data/lib/generators/arclight/install_generator.rb +63 -0
- data/lib/generators/arclight/templates/arclight.js +2 -0
- data/lib/generators/arclight/templates/arclight.scss +3 -0
- data/lib/generators/arclight/templates/catalog_controller.rb +347 -0
- data/lib/generators/arclight/templates/config/downloads.yml +13 -0
- data/lib/generators/arclight/templates/config/repositories.yml +42 -0
- data/lib/generators/arclight/update_generator.rb +22 -0
- data/lib/tasks/index.rake +87 -0
- data/package.json +24 -0
- data/solr/conf/_rest_managed.json +3 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +631 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +393 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/stopwords_en.txt +58 -0
- data/solr/conf/synonyms.txt +31 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/tasks/arclight.rake +68 -0
- data/template.rb +15 -0
- data/vendor/assets/javascripts/responsiveTruncator.js +69 -0
- data/vendor/assets/javascripts/stickyfill.js +480 -0
- metadata +301 -6
@@ -0,0 +1,6 @@
|
|
1
|
+
<li class="nav-item <%= repositories_active_class %>">
|
2
|
+
<%= link_to t('arclight.routes.repositories'), arclight_engine.repositories_path, class: 'nav-link' %>
|
3
|
+
</li>
|
4
|
+
<li class="nav-item <%= collection_active_class %>">
|
5
|
+
<%= link_to t('arclight.routes.collections'), arclight_engine.collections_path, class: 'nav-link' %>
|
6
|
+
</li>
|
data/arclight.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
lib = File.expand_path('../lib', __FILE__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -7,8 +8,8 @@ require 'arclight/version'
|
|
7
8
|
Gem::Specification.new do |spec|
|
8
9
|
spec.name = 'arclight'
|
9
10
|
spec.version = Arclight::VERSION
|
10
|
-
spec.authors = ['Jack Reed']
|
11
|
-
spec.email = ['phillipjreed@gmail.com']
|
11
|
+
spec.authors = ['Darren Hardy', 'Jessie Keck', 'Gordon Leacock', 'Jack Reed']
|
12
|
+
spec.email = ['drh@stanford.edu', 'jessie.keck@gmail.com', 'gordonl@umich.edu', 'phillipjreed@gmail.com']
|
12
13
|
|
13
14
|
spec.summary = ''
|
14
15
|
spec.description = ''
|
@@ -22,7 +23,19 @@ Gem::Specification.new do |spec|
|
|
22
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
24
|
spec.require_paths = ['lib']
|
24
25
|
|
26
|
+
spec.add_dependency 'blacklight'
|
27
|
+
spec.add_dependency 'blacklight_range_limit'
|
28
|
+
spec.add_dependency 'rails', '~> 5.0'
|
29
|
+
spec.add_dependency 'solr_ead'
|
30
|
+
|
25
31
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
26
|
-
spec.add_development_dependency '
|
27
|
-
spec.add_development_dependency '
|
32
|
+
spec.add_development_dependency 'capybara'
|
33
|
+
spec.add_development_dependency 'coveralls'
|
34
|
+
spec.add_development_dependency 'engine_cart'
|
35
|
+
spec.add_development_dependency 'poltergeist'
|
36
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 0.48.1'
|
38
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.15.0'
|
39
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
40
|
+
spec.add_development_dependency 'solr_wrapper'
|
28
41
|
end
|
data/bin/rails
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/arclight/engine', __FILE__)
|
7
|
+
|
8
|
+
# Set up gems listed in the Gemfile.
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
11
|
+
|
12
|
+
require 'rails/all'
|
13
|
+
require 'rails/engine/commands'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
en:
|
2
|
+
arclight:
|
3
|
+
masthead_heading: 'Archival Collections at Institution'
|
4
|
+
date_range_histogram:
|
5
|
+
show_hide: 'Show/hide date distribution'
|
6
|
+
hierarchy:
|
7
|
+
view_all: 'View'
|
8
|
+
scope_and_contents: 'Scope and Contents'
|
9
|
+
request:
|
10
|
+
container: 'Request container(s)'
|
11
|
+
routes:
|
12
|
+
home: 'Home'
|
13
|
+
collections: 'Collections'
|
14
|
+
repositories: 'Repositories'
|
15
|
+
search_results: 'Search results'
|
16
|
+
views:
|
17
|
+
index:
|
18
|
+
number_of_children:
|
19
|
+
zero: 'No children'
|
20
|
+
one: '1 child'
|
21
|
+
other: '%{count} children'
|
22
|
+
collection_search:
|
23
|
+
count: 'collection'
|
24
|
+
online_content_indicator: 'online content'
|
25
|
+
show:
|
26
|
+
collection_id: 'Collection ID: %{id}'
|
27
|
+
overview: 'Overview'
|
28
|
+
online_content: 'Online content'
|
29
|
+
no_online_content: 'No online content'
|
30
|
+
no_contents: 'No content inventory'
|
31
|
+
search_within: 'Search within this collection'
|
32
|
+
navigation_sidebar:
|
33
|
+
title: 'Navigation overview'
|
34
|
+
context_sidebar:
|
35
|
+
in_person_field: 'In person'
|
36
|
+
terms_field: 'Terms & Conditions'
|
37
|
+
cite_field: 'How to cite this collection'
|
38
|
+
component_terms_field: "Terms & Conditions"
|
39
|
+
sections:
|
40
|
+
summary_field: 'Summary'
|
41
|
+
access_field: 'Access and Use'
|
42
|
+
background_field: 'Background'
|
43
|
+
scope_and_arrangement_field: 'Scope and Arrangement'
|
44
|
+
related_field: 'Related'
|
45
|
+
indexed_terms_field: 'Indexed Terms'
|
46
|
+
admin_info_field: 'Administrative Information'
|
47
|
+
component_field: 'About this %{level}'
|
48
|
+
component_indexed_terms_field: 'Indexed Terms'
|
49
|
+
collection_context_field: 'Collection Context'
|
50
|
+
our_collections: 'Our Collections'
|
51
|
+
download:
|
52
|
+
default: 'Download'
|
53
|
+
pdf: 'Collection PDF (%{size})'
|
54
|
+
ead: 'Collection EAD (%{size})'
|
55
|
+
repositories:
|
56
|
+
number_of_collections:
|
57
|
+
zero: 'No collections'
|
58
|
+
one: '1 collection'
|
59
|
+
other: '%{count} collections'
|
60
|
+
view_more: 'View more'
|
61
|
+
view_all_collections: 'View all of our collections'
|
62
|
+
breadcrumb_separator: ' » '
|
63
|
+
truncation:
|
64
|
+
view_more: 'view more ▶'
|
65
|
+
view_less: 'view less ▼'
|
data/config/routes.rb
ADDED
data/lib/arclight.rb
CHANGED
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
##
|
5
|
+
# An Arclight custom component indexing code
|
6
|
+
class CustomComponent < SolrEad::Component
|
7
|
+
extend Arclight::SharedTerminologyBehavior
|
8
|
+
include Arclight::SharedIndexingBehavior
|
9
|
+
use_terminology SolrEad::Component
|
10
|
+
|
11
|
+
# we extend the terminology to provide additional fields and/or indexing strategies
|
12
|
+
# than `solr_ead` provides as-is. in many cases we're doing redundant indexing, but
|
13
|
+
# we're trying to modify the `solr_ead` gem as little as possible
|
14
|
+
extend_terminology do |t|
|
15
|
+
# identifiers
|
16
|
+
t.level(path: 'c/@level', index_as: %i[displayable]) # machine-readable for string `level_ssm`
|
17
|
+
t.otherlevel(path: 'c/@otherlevel', index_as: %i[displayable])
|
18
|
+
t.ref_(path: '/c/@id', index_as: %i[displayable])
|
19
|
+
|
20
|
+
# facets
|
21
|
+
t.creator(path: "c/did/origination[@label='creator']/*/text()", index_as: %i[displayable facetable symbol])
|
22
|
+
t.places(path: 'c/controlaccess/geogname/text()', index_as: %i[displayable facetable symbol])
|
23
|
+
|
24
|
+
add_unitid(t, 'c/')
|
25
|
+
add_extent(t, 'c/')
|
26
|
+
add_dates(t, 'c/')
|
27
|
+
add_searchable_notes(t, 'c/')
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_solr(solr_doc = {})
|
31
|
+
super
|
32
|
+
solr_doc['id'] = Arclight::NormalizedId.new(solr_doc['id']).to_s
|
33
|
+
solr_doc['creator_sort'] = creator.to_a.join(', ') if creator.present?
|
34
|
+
add_component_fields(solr_doc)
|
35
|
+
solr_doc
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def add_component_fields(solr_doc)
|
41
|
+
component_field_definitions.each do |field|
|
42
|
+
# we want to use `set_field` rather than `insert_field` since we may be overriding fields
|
43
|
+
Solrizer.set_field(solr_doc, field[:name], field[:value], field[:index_as])
|
44
|
+
end
|
45
|
+
add_date_ranges(solr_doc)
|
46
|
+
add_normalized_title(solr_doc)
|
47
|
+
resolve_repository(solr_doc)
|
48
|
+
add_digital_content(prefix: 'c/did', solr_doc: solr_doc)
|
49
|
+
end
|
50
|
+
|
51
|
+
def component_field_definitions
|
52
|
+
[
|
53
|
+
{ name: 'level', value: formatted_level, index_as: :facetable },
|
54
|
+
{ name: 'names', value: names, index_as: :symbol },
|
55
|
+
{ name: 'access_subjects', value: access_subjects, index_as: :symbol },
|
56
|
+
{ name: 'containers', value: containers, index_as: :symbol },
|
57
|
+
{ name: 'has_online_content', value: online_content?, index_as: :symbol }
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def resolve_repository(solr_doc)
|
62
|
+
repository = solr_doc[Solrizer.solr_name('repository', :displayable)]
|
63
|
+
%i[displayable facetable].each do |index_as|
|
64
|
+
Solrizer.set_field(solr_doc, 'repository', repository_as_configured(repository), index_as)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see http://eadiva.com/2/c/
|
69
|
+
def formatted_level
|
70
|
+
# terminology definitions for level yield Arrays and in this case single values
|
71
|
+
# TODO: OM changes the behavior of `level = level.first` such that it always returns `nil`
|
72
|
+
# so need our own local variable here
|
73
|
+
actual_level = level.first.to_s if level.respond_to? :first
|
74
|
+
|
75
|
+
if actual_level == 'otherlevel'
|
76
|
+
alternative_level = otherlevel.first.to_s if otherlevel.respond_to? :first
|
77
|
+
alternative_level.present? ? alternative_level : 'Other'
|
78
|
+
elsif actual_level.present?
|
79
|
+
actual_level.capitalize
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def names
|
84
|
+
names_array(%w[corpname famname name persname], parent: 'c')
|
85
|
+
end
|
86
|
+
|
87
|
+
def access_subjects
|
88
|
+
subjects_array(%w[subject function occupation genreform], parent: 'c')
|
89
|
+
end
|
90
|
+
|
91
|
+
def containers
|
92
|
+
contains = search('//container').to_a
|
93
|
+
contains.map do |c|
|
94
|
+
"#{c.attributes['type'].try(:value)} #{c.text}".strip
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
##
|
5
|
+
# An Arclight custom document indexing code
|
6
|
+
class CustomDocument < SolrEad::Document
|
7
|
+
extend Arclight::SharedTerminologyBehavior
|
8
|
+
include Arclight::SharedIndexingBehavior
|
9
|
+
use_terminology SolrEad::Document
|
10
|
+
|
11
|
+
# we extend the terminology to provide additional fields and/or indexing strategies
|
12
|
+
# than `solr_ead` provides as-is. in many cases we're doing redundant indexing, but
|
13
|
+
# we're trying to modify the `solr_ead` gem as little as possible
|
14
|
+
extend_terminology do |t|
|
15
|
+
# facets
|
16
|
+
t.repository(path: 'archdesc/did/repository/corpname/text() | archdesc/did/repository/name/text()', index_as: %i[displayable facetable])
|
17
|
+
t.creator(path: "archdesc/did/origination[@label='creator']/*/text()", index_as: %i[displayable facetable symbol])
|
18
|
+
t.creator_persname(path: "archdesc/did/origination[@label='creator']/persname/text()", index_as: %i[displayable facetable symbol])
|
19
|
+
t.creator_corpname(path: "archdesc/did/origination[@label='creator']/corpname/text()", index_as: %i[displayable facetable symbol])
|
20
|
+
t.creator_famname(path: "archdesc/did/origination[@label='creator']/famname/text()", index_as: %i[displayable facetable symbol])
|
21
|
+
t.function(path: 'archdesc/controlaccess/function/text()', index_as: %i[displayable facetable])
|
22
|
+
t.occupation(path: 'archdesc/controlaccess/occupation/text()', index_as: %i[displayable facetable])
|
23
|
+
t.places(path: 'archdesc/controlaccess/geogname/text()', index_as: %i[displayable facetable symbol])
|
24
|
+
|
25
|
+
add_unitid(t, 'archdesc/')
|
26
|
+
add_extent(t, 'archdesc/')
|
27
|
+
add_dates(t, 'archdesc/')
|
28
|
+
add_searchable_notes(t, 'archdesc/')
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_solr(solr_doc = {})
|
32
|
+
super
|
33
|
+
solr_doc['id'] = Arclight::NormalizedId.new(eadid.first).to_s
|
34
|
+
solr_doc['creator_sort'] = creator.to_a.join(', ') if creator.present?
|
35
|
+
add_document_fields(solr_doc)
|
36
|
+
solr_doc
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def add_document_fields(solr_doc)
|
42
|
+
arclight_field_definitions.each do |field|
|
43
|
+
# we want to use `set_field` rather than `insert_field` since we may be overriding fields
|
44
|
+
Solrizer.set_field(solr_doc, field[:name], field[:value], field[:index_as])
|
45
|
+
end
|
46
|
+
|
47
|
+
add_date_ranges(solr_doc)
|
48
|
+
add_digital_content(prefix: 'ead/archdesc', solr_doc: solr_doc)
|
49
|
+
add_normalized_titles(solr_doc)
|
50
|
+
end
|
51
|
+
|
52
|
+
def add_normalized_titles(solr_doc)
|
53
|
+
title = add_normalized_title(solr_doc)
|
54
|
+
Solrizer.set_field(solr_doc, 'collection', title, :facetable)
|
55
|
+
Solrizer.set_field(solr_doc, 'collection', title, :displayable)
|
56
|
+
end
|
57
|
+
|
58
|
+
def arclight_field_definitions
|
59
|
+
[
|
60
|
+
{ name: 'level', value: 'collection', index_as: :displayable },
|
61
|
+
{ name: 'level', value: 'Collection', index_as: :facetable },
|
62
|
+
{ name: 'names', value: names, index_as: :symbol },
|
63
|
+
{ name: 'access_subjects', value: access_subjects, index_as: :symbol },
|
64
|
+
{ name: 'creators', value: creators, index_as: :symbol },
|
65
|
+
{ name: 'has_online_content', value: online_content?, index_as: :symbol },
|
66
|
+
{ name: 'repository', value: repository_as_configured(repository), index_as: :displayable },
|
67
|
+
{ name: 'repository', value: repository_as_configured(repository), index_as: :facetable },
|
68
|
+
{ name: 'names_coll', value: names_coll, index_as: :symbol }
|
69
|
+
]
|
70
|
+
end
|
71
|
+
|
72
|
+
def names
|
73
|
+
[corpname, famname, name, persname].flatten.compact.uniq - repository
|
74
|
+
end
|
75
|
+
|
76
|
+
def names_coll
|
77
|
+
names_array(%w[corpname famname name persname], parent: 'archdesc')
|
78
|
+
end
|
79
|
+
|
80
|
+
def creators
|
81
|
+
[creator_persname, creator_corpname, creator_famname].flatten.compact.uniq - repository
|
82
|
+
end
|
83
|
+
|
84
|
+
# Combine subjets into one group from
|
85
|
+
# <controlaccess/><subject></subject>
|
86
|
+
# <controlaccess/><function></function>
|
87
|
+
# <controlaccess/><genreform></genreform>
|
88
|
+
# <controlaccess/><occupation></occupation>
|
89
|
+
def access_subjects
|
90
|
+
subjects_array(%w[subject function occupation genreform], parent: 'archdesc')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
##
|
5
|
+
# Plain ruby class to model serializing/deserializing digital object data
|
6
|
+
class DigitalObject
|
7
|
+
attr_reader :label, :href
|
8
|
+
def initialize(label:, href:)
|
9
|
+
@label = label.present? ? label : href
|
10
|
+
@href = href
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_json(*)
|
14
|
+
{ label: label, href: href }.to_json
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.from_json(json)
|
18
|
+
object_data = JSON.parse(json)
|
19
|
+
new(label: object_data['label'], href: object_data['href'])
|
20
|
+
end
|
21
|
+
|
22
|
+
def ==(other)
|
23
|
+
href == other.href && label == other.label
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'blacklight'
|
4
|
+
require 'solr_ead'
|
5
|
+
require 'arclight/exceptions'
|
6
|
+
require 'arclight/normalized_date'
|
7
|
+
require 'arclight/normalized_id'
|
8
|
+
require 'arclight/normalized_title'
|
9
|
+
require 'arclight/digital_object'
|
10
|
+
require 'arclight/shared_indexing_behavior'
|
11
|
+
require 'arclight/shared_terminology_behavior'
|
12
|
+
require 'arclight/custom_document'
|
13
|
+
require 'arclight/custom_component'
|
14
|
+
require 'arclight/solr_ead_indexer_ext'
|
15
|
+
require 'arclight/indexer'
|
16
|
+
require 'arclight/viewer'
|
17
|
+
|
18
|
+
module Arclight
|
19
|
+
##
|
20
|
+
# This is the defining class for the Arclight Rails Engine
|
21
|
+
class Engine < ::Rails::Engine
|
22
|
+
config.viewer_class = Arclight::Viewers::OEmbed
|
23
|
+
config.oembed_resource_exclude_patterns = [/\.pdf$/, /\.ppt$/]
|
24
|
+
|
25
|
+
Arclight::Engine.config.catalog_controller_field_accessors = %i[
|
26
|
+
summary_field
|
27
|
+
access_field
|
28
|
+
background_field
|
29
|
+
related_field
|
30
|
+
admin_info_field
|
31
|
+
terms_field
|
32
|
+
cite_field
|
33
|
+
indexed_terms_field
|
34
|
+
in_person_field
|
35
|
+
component_field
|
36
|
+
online_field
|
37
|
+
component_terms_field
|
38
|
+
component_indexed_terms_field
|
39
|
+
]
|
40
|
+
|
41
|
+
initializer 'arclight.fields' do
|
42
|
+
Arclight::Engine.config.catalog_controller_field_accessors.each do |field|
|
43
|
+
Blacklight::Configuration.define_field_access field
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
initializer 'arclight.helpers' do
|
48
|
+
ActionView::Base.send :include, ArclightHelper
|
49
|
+
end
|
50
|
+
|
51
|
+
initializer 'arclight.views' do
|
52
|
+
Blacklight::Configuration.default_values[:view].hierarchy
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Arclight
|
4
|
+
module Exceptions
|
5
|
+
# Id's must be present on all documents and components
|
6
|
+
class IDNotFound < StandardError
|
7
|
+
def message
|
8
|
+
'id must be present for all documents and components'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
# Unittitle or unitdate must be present on all documents and components
|
12
|
+
class TitleNotFound < StandardError
|
13
|
+
def message
|
14
|
+
'<unittitle/> or <unitdate/> must be present for all documents and components'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|