arclight 0.0.1 → 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 +22 -0
- data/.github/workflows/ruby.yml +51 -0
- data/.gitignore +7 -0
- data/.rspec +0 -1
- data/.rubocop.yml +521 -0
- data/.rubocop_todo.yml +122 -0
- data/.solr_wrapper +6 -0
- data/CONTRIBUTING.md +43 -0
- data/CONTRIBUTORS.md +79 -0
- data/Gemfile +41 -0
- data/LICENSE.txt +1 -0
- data/README.md +100 -12
- data/Rakefile +13 -3
- data/app/assets/images/arclight/logo.png +0 -0
- 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 -0
- 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 -0
- 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 +14 -0
- data/app/assets/stylesheets/arclight/build.scss +4 -0
- data/app/assets/stylesheets/arclight/modules/collection_search.scss +3 -0
- data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +155 -0
- data/app/assets/stylesheets/arclight/modules/highlights.scss +11 -0
- data/app/assets/stylesheets/arclight/modules/icons.scss +20 -0
- data/app/assets/stylesheets/arclight/modules/layout.scss +220 -0
- data/app/assets/stylesheets/arclight/modules/mastheads.scss +42 -0
- data/app/assets/stylesheets/arclight/modules/repositories.scss +25 -0
- data/app/assets/stylesheets/arclight/modules/repository_card.scss +9 -0
- data/app/assets/stylesheets/arclight/modules/search_form.scss +9 -0
- data/app/assets/stylesheets/arclight/modules/search_results.scss +250 -0
- data/app/assets/stylesheets/arclight/modules/show_collection.scss +38 -0
- 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 -0
- 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/components/arclight/constraints_component.html.erb +7 -0
- 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 +40 -0
- 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 +108 -0
- data/app/models/arclight/document_downloads.rb +122 -0
- data/app/models/arclight/parent.rb +24 -0
- data/app/models/arclight/parents.rb +39 -0
- 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 +49 -0
- data/app/models/concerns/arclight/catalog.rb +44 -0
- data/app/models/concerns/arclight/search_behavior.rb +47 -0
- data/app/models/concerns/arclight/solr_document.rb +160 -0
- data/app/presenters/arclight/index_presenter.rb +10 -0
- data/app/presenters/arclight/show_presenter.rb +54 -0
- data/app/views/arclight/.keep +0 -0
- data/app/views/arclight/_requests.html.erb +7 -0
- data/app/views/arclight/repositories/_repository.html.erb +43 -0
- data/app/views/arclight/repositories/index.html.erb +9 -0
- data/app/views/arclight/repositories/show.html.erb +37 -0
- 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 +10 -0
- 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 +17 -0
- data/app/views/shared/_breadcrumbs.html.erb +3 -0
- data/app/views/shared/_main_menu_links.html.erb +6 -0
- data/arclight.gemspec +29 -11
- data/bin/rails +13 -0
- 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 +100 -0
- data/config/repositories.yml +0 -0
- data/config/routes.rb +6 -0
- data/docker-compose.yml +16 -0
- data/lib/arclight/digital_object.rb +27 -0
- data/lib/arclight/engine.rb +47 -0
- data/lib/arclight/exceptions.rb +19 -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 +49 -0
- data/lib/arclight/normalized_id.rb +30 -0
- data/lib/arclight/normalized_title.rb +33 -0
- data/lib/arclight/repository.rb +116 -0
- 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 +3 -1
- data/lib/arclight/year_range.rb +111 -0
- data/lib/arclight.rb +11 -1
- data/lib/generators/arclight/install_generator.rb +163 -0
- data/lib/generators/arclight/templates/arclight.scss +6 -0
- data/lib/generators/arclight/templates/catalog_controller.rb +423 -0
- data/lib/generators/arclight/templates/config/downloads.yml +25 -0
- data/lib/generators/arclight/templates/config/locales/arclight.en.yml +61 -0
- data/lib/generators/arclight/templates/config/repositories.yml +53 -0
- data/lib/generators/arclight/update_generator.rb +22 -0
- data/lib/tasks/index.rake +84 -0
- data/package.json +30 -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 +400 -0
- data/solr/conf/solrconfig.xml +328 -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 +79 -0
- data/template.rb +10 -0
- metadata +440 -20
- data/.travis.yml +0 -5
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
##
|
|
12
|
+
# @param [SolrDocument] document
|
|
13
|
+
# @param [String] ead_url
|
|
14
|
+
def initialize(document, ead_url)
|
|
15
|
+
@document = document
|
|
16
|
+
@ead_url = ead_url
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
##
|
|
20
|
+
# Url target for Aeon request params
|
|
21
|
+
def request_url
|
|
22
|
+
request_config['request_url']
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
##
|
|
26
|
+
# Constructed request URL
|
|
27
|
+
def url
|
|
28
|
+
"#{request_url}?#{form_mapping.to_query}"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# Converts mappings as a query url param into a Hash used for sending
|
|
33
|
+
# messages
|
|
34
|
+
# If a defined method is provided as a value, that method will be invoked
|
|
35
|
+
# "collection_name=entry.123" => { "collection_name" => "entry.123" }
|
|
36
|
+
# @return [Hash]
|
|
37
|
+
def form_mapping
|
|
38
|
+
form_hash = Rack::Utils.parse_nested_query(
|
|
39
|
+
request_config['request_mappings']
|
|
40
|
+
)
|
|
41
|
+
form_hash.each do |key, value|
|
|
42
|
+
respond_to?(value) && form_hash[key] = send(value)
|
|
43
|
+
end
|
|
44
|
+
form_hash
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def request_config
|
|
48
|
+
document.repository_config.request_config_for_type('aeon_web_ead')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
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 configuratino
|
|
8
|
+
class GoogleForm
|
|
9
|
+
attr_reader :document, :presenter, :document_url
|
|
10
|
+
|
|
11
|
+
delegate :collection_name, :collection_creator, :eadid, :containers, to: :document
|
|
12
|
+
|
|
13
|
+
##
|
|
14
|
+
# @param [SolrDocument] document
|
|
15
|
+
# @param [Arclight::ShowPresenter] presenter
|
|
16
|
+
# @param [String] document_url
|
|
17
|
+
def initialize(document, presenter, document_url)
|
|
18
|
+
@document = document
|
|
19
|
+
@presenter = presenter
|
|
20
|
+
@document_url = document_url
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
##
|
|
24
|
+
# Url of form to fill
|
|
25
|
+
def url
|
|
26
|
+
request_config['request_url']
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
##
|
|
30
|
+
# Converts mappings as a query url param into a Hash used for sending
|
|
31
|
+
# messages and providing pre-filled form fields
|
|
32
|
+
# "collection_name=entry.123" => { "collection_name" => "entry.123" }
|
|
33
|
+
# @return [Hash]
|
|
34
|
+
def form_mapping
|
|
35
|
+
Rack::Utils.parse_nested_query(
|
|
36
|
+
request_config['request_mappings']
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def title
|
|
41
|
+
presenter.heading
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def request_config
|
|
45
|
+
document.repository_config&.request_config_for_type('google_form')
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Arclight
|
|
4
|
+
##
|
|
5
|
+
# Arclight specific methods for the Catalog
|
|
6
|
+
module Catalog
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
before_action only: :index do
|
|
11
|
+
if (params.dig(:f, :collection) || []).any?(&:blank?)
|
|
12
|
+
params[:f][:collection].compact_blank!
|
|
13
|
+
params[:f].delete(:collection) if params[:f][:collection].blank?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
before_action only: :hierarchy do
|
|
18
|
+
blacklight_config.search_state_fields += %i[id limit offset]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Blacklight::Configuration.define_field_access :summary_field, Blacklight::Configuration::ShowField
|
|
22
|
+
Blacklight::Configuration.define_field_access :background_field, Blacklight::Configuration::ShowField
|
|
23
|
+
Blacklight::Configuration.define_field_access :related_field, Blacklight::Configuration::ShowField
|
|
24
|
+
Blacklight::Configuration.define_field_access :indexed_terms_field, Blacklight::Configuration::ShowField
|
|
25
|
+
Blacklight::Configuration.define_field_access :in_person_field, Blacklight::Configuration::ShowField
|
|
26
|
+
Blacklight::Configuration.define_field_access :cite_field, Blacklight::Configuration::ShowField
|
|
27
|
+
Blacklight::Configuration.define_field_access :contact_field, Blacklight::Configuration::ShowField
|
|
28
|
+
Blacklight::Configuration.define_field_access :component_field, Blacklight::Configuration::ShowField
|
|
29
|
+
Blacklight::Configuration.define_field_access :component_indexed_terms_field, Blacklight::Configuration::ShowField
|
|
30
|
+
Blacklight::Configuration.define_field_access :terms_field, Blacklight::Configuration::ShowField
|
|
31
|
+
Blacklight::Configuration.define_field_access :component_terms_field, Blacklight::Configuration::ShowField
|
|
32
|
+
Blacklight::Configuration.define_field_access :group_header_field, Blacklight::Configuration::IndexField
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def hierarchy
|
|
36
|
+
@response = search_service.search_results
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Overrides blacklight search state so we can exclude some parameters from being passed into the SearchState
|
|
40
|
+
def search_state
|
|
41
|
+
@search_state ||= search_state_class.new(params.except('hierarchy', 'nest_path'), blacklight_config, self)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Arclight
|
|
4
|
+
##
|
|
5
|
+
# Customized Search Behavior for Arclight
|
|
6
|
+
module SearchBehavior
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
self.default_processor_chain += %i[
|
|
11
|
+
add_highlighting
|
|
12
|
+
add_grouping
|
|
13
|
+
add_hierarchy_behavior
|
|
14
|
+
]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
|
18
|
+
def add_hierarchy_behavior(solr_parameters)
|
|
19
|
+
return unless search_state.controller&.action_name == 'hierarchy'
|
|
20
|
+
|
|
21
|
+
solr_parameters[:fq] ||= []
|
|
22
|
+
solr_parameters[:fq] << "_nest_parent_:#{blacklight_params[:id]}"
|
|
23
|
+
solr_parameters[:rows] = blacklight_params[:per_page]&.to_i || blacklight_params[:limit]&.to_i || 999_999_999
|
|
24
|
+
solr_parameters[:start] = blacklight_params[:offset] if blacklight_params[:offset]
|
|
25
|
+
solr_parameters[:sort] = 'sort_isi asc'
|
|
26
|
+
solr_parameters[:facet] = false
|
|
27
|
+
end
|
|
28
|
+
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
|
29
|
+
|
|
30
|
+
##
|
|
31
|
+
# Add highlighting
|
|
32
|
+
def add_highlighting(solr_params)
|
|
33
|
+
solr_params['hl'] = true
|
|
34
|
+
solr_params['hl.fl'] = CatalogController.blacklight_config.highlight_field
|
|
35
|
+
solr_params['hl.snippets'] = 3
|
|
36
|
+
solr_params
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
# Adds grouping parameters for Solr if enabled
|
|
41
|
+
def add_grouping(solr_params)
|
|
42
|
+
solr_params.merge!(Arclight::Engine.config.catalog_controller_group_query_params) if blacklight_params[:group] == 'true'
|
|
43
|
+
|
|
44
|
+
solr_params
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Arclight
|
|
4
|
+
##
|
|
5
|
+
# Extends Blacklight::Solr::Document to provide Arclight specific behavior
|
|
6
|
+
module SolrDocument
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
attribute :collection_id, :string, '_root_'
|
|
11
|
+
Arclight.deprecation.deprecate_methods(self, collection_id: 'Use `root` instead')
|
|
12
|
+
attribute :parent_ids, :array, 'parent_ids_ssim'
|
|
13
|
+
attribute :legacy_parent_ids, :array, 'parent_ssim'
|
|
14
|
+
Arclight.deprecation.deprecate_methods(self, legacy_parent_ids: 'Use `parent_ids` instead')
|
|
15
|
+
attribute :parent_labels, :array, 'parent_unittitles_ssm'
|
|
16
|
+
attribute :parent_levels, :array, 'parent_levels_ssm'
|
|
17
|
+
attribute :unitid, :string, 'unitid_ssm'
|
|
18
|
+
attribute :extent, :array, 'extent_ssm'
|
|
19
|
+
attribute :abstract, :string, 'abstract_html_tesm'
|
|
20
|
+
attribute :scope, :string, 'scopecontent_html_tesm'
|
|
21
|
+
attribute :creator, :string, 'creator_ssm'
|
|
22
|
+
attribute :level, :string, 'level_ssm'
|
|
23
|
+
attribute :terms, :string, 'userestrict_html_tesm'
|
|
24
|
+
# Restrictions for component sidebar
|
|
25
|
+
attribute :parent_restrictions, :string, 'parent_access_restrict_tesm'
|
|
26
|
+
# Terms for component sidebar
|
|
27
|
+
attribute :parent_terms, :string, 'parent_access_terms_tesm'
|
|
28
|
+
attribute :reference, :string, 'ref_ssm'
|
|
29
|
+
attribute :normalized_title, :string, 'normalized_title_ssm'
|
|
30
|
+
attribute :normalized_date, :string, 'normalized_date_ssm'
|
|
31
|
+
attribute :total_component_count, :string, 'total_component_count_is'
|
|
32
|
+
attribute :online_item_count, :string, 'online_item_count_is'
|
|
33
|
+
attribute :last_indexed, :date, 'timestamp'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def repository_config
|
|
37
|
+
return unless repository
|
|
38
|
+
|
|
39
|
+
@repository_config ||= Arclight::Repository.find_by(name: repository)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def parents
|
|
43
|
+
@parents ||= Arclight::Parents.from_solr_document(self).as_parents
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Get this document's EAD ID, or fall back to the collection (especially
|
|
47
|
+
# for components that may not have their own.
|
|
48
|
+
def eadid
|
|
49
|
+
first('ead_ssi')&.strip || collection&.first('ead_ssi')&.strip
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def normalized_eadid
|
|
53
|
+
Arclight::NormalizedId.new(eadid).to_s
|
|
54
|
+
end
|
|
55
|
+
Arclight.deprecation.deprecate_methods(self, normalized_eadid: 'Use `root` instead')
|
|
56
|
+
|
|
57
|
+
def repository
|
|
58
|
+
first('repository_ssm') || collection&.first('repository_ssm')
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def repository_and_unitid
|
|
62
|
+
[repository, unitid].compact.join(': ')
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @return [SolrDocument] a SolrDocument representing the EAD collection
|
|
66
|
+
# that this document belongs to
|
|
67
|
+
def collection
|
|
68
|
+
return self if collection?
|
|
69
|
+
|
|
70
|
+
@collection ||= self.class.new(self['collection']&.dig('docs', 0), @response)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def collection_name
|
|
74
|
+
collection&.normalized_title
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def collection_unitid
|
|
78
|
+
collection&.unitid
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def abstract_or_scope
|
|
82
|
+
abstract || scope
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def collection_creator
|
|
86
|
+
collection&.creator
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def online_content?
|
|
90
|
+
first('has_online_content_ssim') == 'true'
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def number_of_children
|
|
94
|
+
first('child_component_count_isi') || 0
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def children?
|
|
98
|
+
number_of_children.positive?
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def component_level
|
|
102
|
+
first('component_level_isim')
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def collection?
|
|
106
|
+
level&.parameterize == 'collection'
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def digital_objects
|
|
110
|
+
digital_objects_field = fetch('digital_objects_ssm', []).reject(&:empty?)
|
|
111
|
+
return [] if digital_objects_field.blank?
|
|
112
|
+
|
|
113
|
+
digital_objects_field.map do |object|
|
|
114
|
+
Arclight::DigitalObject.from_json(object)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def containers
|
|
119
|
+
# NOTE: Keep uppercase characters if present, but upcase the first if not already
|
|
120
|
+
containers_field = fetch('containers_ssim', []).reject(&:empty?)
|
|
121
|
+
return [] if containers_field.blank?
|
|
122
|
+
|
|
123
|
+
containers_field.map do |container|
|
|
124
|
+
container.dup.sub!(/\A./, &:upcase)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# @return [Array<String>] with embedded highlights using <em>...</em>
|
|
129
|
+
def highlights
|
|
130
|
+
highlight_field(CatalogController.blacklight_config.highlight_field)
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Factory method for constructing the Object modeling downloads
|
|
134
|
+
# @return [DocumentDownloads]
|
|
135
|
+
def downloads
|
|
136
|
+
@downloads ||= DocumentDownloads.new(self)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def ead_file
|
|
140
|
+
@ead_file ||= begin
|
|
141
|
+
files = Arclight::DocumentDownloads.new(self, collection_unitid).files
|
|
142
|
+
files.find do |file|
|
|
143
|
+
file.type == 'ead'
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def nest_path
|
|
149
|
+
self['_nest_path_']
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def root
|
|
153
|
+
self['_root_'] || self['id']
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def requestable?
|
|
157
|
+
repository_config&.request_types&.any?
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Arclight
|
|
4
|
+
# Custom presentation methods for show partial
|
|
5
|
+
class ShowPresenter < Blacklight::ShowPresenter
|
|
6
|
+
attr_accessor :field_group
|
|
7
|
+
|
|
8
|
+
delegate :collection?, to: :document
|
|
9
|
+
|
|
10
|
+
def heading
|
|
11
|
+
document.normalized_title
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def with_field_group(group)
|
|
15
|
+
if block_given?
|
|
16
|
+
old_group = field_group
|
|
17
|
+
|
|
18
|
+
begin
|
|
19
|
+
self.field_group = group
|
|
20
|
+
yield(self)
|
|
21
|
+
ensure
|
|
22
|
+
self.field_group = old_group if block_given?
|
|
23
|
+
end
|
|
24
|
+
else
|
|
25
|
+
dup.tap { |x| x.field_group = group }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# @return [Hash<String,Configuration::Field>] all the fields for this index view
|
|
32
|
+
def fields
|
|
33
|
+
if field_group
|
|
34
|
+
configuration["#{field_group}s"] || []
|
|
35
|
+
else
|
|
36
|
+
super
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def field_config(field)
|
|
41
|
+
return super unless field_group
|
|
42
|
+
|
|
43
|
+
fields.fetch(field) do
|
|
44
|
+
if defined?(Blacklight::Configuration::NullDisplayField)
|
|
45
|
+
# For Blacklight 8:
|
|
46
|
+
Blacklight::Configuration::NullDisplayField.new(field)
|
|
47
|
+
else
|
|
48
|
+
# Blacklight 7
|
|
49
|
+
Blacklight::Configuration::NullField.new(field)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<div class="mb-3 mx-auto al-repository">
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class='row'>
|
|
4
|
+
<div class='col-2 align-self-center d-none d-lg-block al-repository-thumbnail'>
|
|
5
|
+
<%= image_tag repository.thumbnail_url, alt: repository.name, class: 'img-fluid d-block mx-auto' %>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div class="col-sm-12 col-lg-10 py-3 al-repository-information">
|
|
9
|
+
<%= content_tag(params[:id] == repository.slug ? :h1 : :h2, class: 'h5 mb-3 repo-name') do %>
|
|
10
|
+
<%= link_to_unless(params[:id] == repository.slug, repository.name, arclight_engine.repository_path(repository.slug)) %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<div class='row no-gutters justify-content-center'>
|
|
13
|
+
<div class='col-12 col-sm-4 col-md-3 fw-light al-repository-contact'>
|
|
14
|
+
<address class="text-break">
|
|
15
|
+
<div class="mb-3 al-repository-street-address">
|
|
16
|
+
<%= repository.location %>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="al-repository-contact-info">
|
|
20
|
+
<%= repository.contact %>
|
|
21
|
+
</div>
|
|
22
|
+
</address>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class='col-12 col-sm mt-3 mt-sm-0 al-repository-description'>
|
|
26
|
+
<%= repository.description %>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<% if on_repositories_index? %>
|
|
30
|
+
<div class='col-12 col-lg-2 mt-3 mt-lg-0 text-center al-repository-extra'>
|
|
31
|
+
<div class='mb-1 fst-italic fw-bold'>
|
|
32
|
+
<%= t(:'arclight.views.repositories.number_of_collections', count: repository.collection_count) %>
|
|
33
|
+
</div>
|
|
34
|
+
<% if repository.collection_count&.positive? %>
|
|
35
|
+
<%= link_to(t(:'arclight.views.repositories.view_more'), arclight_engine.repository_path(repository.slug), class: 'btn btn-secondary btn-sm') %>
|
|
36
|
+
<% end %>
|
|
37
|
+
</div>
|
|
38
|
+
<% end %>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% breadcrumb :repositories %>
|
|
2
|
+
|
|
3
|
+
<h1 class="sr-only visually-hidden"><%= t('arclight.repositories') %></h1>
|
|
4
|
+
|
|
5
|
+
<div class="al-repositories">
|
|
6
|
+
<% @page_title = t('arclight.views.repositories.title') %>
|
|
7
|
+
<%= render 'shared/breadcrumbs' %>
|
|
8
|
+
<%= render @repositories %>
|
|
9
|
+
</div>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<% @page_title = t(:'arclight.views.repositories.show', name: @repository.name) %>
|
|
2
|
+
<% breadcrumb :repository, @repository %>
|
|
3
|
+
<%= render 'shared/breadcrumbs' %>
|
|
4
|
+
<%= render @repository %>
|
|
5
|
+
<div class="row al-repository-show-header">
|
|
6
|
+
<div class="col col-md-8 col-lg-9">
|
|
7
|
+
<h2 class="h4">
|
|
8
|
+
<%= t('arclight.views.show.our_collections') %>
|
|
9
|
+
</h2>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="col text-right">
|
|
12
|
+
<span class="al-repository-collections">
|
|
13
|
+
<%= link_to(t(:'arclight.views.repositories.view_all_collections'), repository_collections_path(@repository)) %>
|
|
14
|
+
</span>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="row">
|
|
19
|
+
<% @collections.each do |document| %>
|
|
20
|
+
<% doc_presenter = Arclight::IndexPresenter.new(document, self, CatalogController.blacklight_config) %>
|
|
21
|
+
<div class="col-md-12">
|
|
22
|
+
<div class='al-document-title-bar'>
|
|
23
|
+
<div class='row'>
|
|
24
|
+
<div class='col-md-10 col-lg-9'>
|
|
25
|
+
<h3 class="h5"><%= link_to doc_presenter.label, solr_document_path(document.id) %></h3>
|
|
26
|
+
<%= render Arclight::IndexMetadataFieldComponent.with_collection(doc_presenter.field_presenters.select { |p| p.field_config.repository_context }) %>
|
|
27
|
+
</div>
|
|
28
|
+
<% if document.unitid %>
|
|
29
|
+
<div class='col text-right al-collection-id'>
|
|
30
|
+
<%= t(:'arclight.views.show.collection_id', id: document.unitid) %>
|
|
31
|
+
</div>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<% end %>
|
|
37
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% aeon_external_request ||= Arclight::Requests::AeonExternalRequest.new(document, document_presenter(document)) %>
|
|
2
|
+
|
|
3
|
+
<%= form_tag aeon_external_request.url, method: :post, class: 'd-inline-block al-request-form' do |f| %>
|
|
4
|
+
<%= render(Blacklight::HiddenSearchStateComponent.new(params: aeon_external_request.form_mapping)) %>
|
|
5
|
+
<button type='submit' class='al-request-button btn btn-primary btn-sm me-1'>
|
|
6
|
+
<%= t('arclight.request.container') %>
|
|
7
|
+
</button>
|
|
8
|
+
<% end %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<% if parsed_files = document.ead_file %>
|
|
2
|
+
<% aeon_web_ead ||= Arclight::Requests::AeonWebEad.new(document, parsed_files.href) %>
|
|
3
|
+
<% aeon_web_ead_url = aeon_web_ead&.url %>
|
|
4
|
+
|
|
5
|
+
<%= link_to 'Request', aeon_web_ead_url, class: 'al-request-button btn btn-primary btn-sm me-1' %>
|
|
6
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% google_form ||= Arclight::Requests::GoogleForm.new(document, document_presenter(document), solr_document_path(document)) %>
|
|
2
|
+
|
|
3
|
+
<%= form_tag google_form.url, method: :get, class: 'd-inline-block al-request-form' do |f| %>
|
|
4
|
+
<% google_form.form_mapping.each do |key, value| %>
|
|
5
|
+
<%= hidden_field_tag value, google_form.public_send(key) %>
|
|
6
|
+
<% end %>
|
|
7
|
+
<button type='submit' class='al-request-button btn btn-primary btn-sm me-1'>
|
|
8
|
+
<%= t('arclight.request.container') %>
|
|
9
|
+
</button>
|
|
10
|
+
<% end %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<% # Override to conditionally add id="documents" on div. When documents are grouped it causes duplicate id issues %>
|
|
2
|
+
<% # https://github.com/projectblacklight/blacklight/blob/v8.1.0/app/views/catalog/_document_list.html.erb %>
|
|
3
|
+
<% # container for all documents in index list view -%>
|
|
4
|
+
<% view_config = local_assigns[:view_config] || blacklight_config&.view_config(document_index_view_type) %>
|
|
5
|
+
<div <%= 'id="documents"'.html_safe unless grouped? %> class="al-document-listings documents-<%= view_config&.key || document_index_view_type %>">
|
|
6
|
+
<% document_presenters = documents.map { |doc| document_presenter(doc) } -%>
|
|
7
|
+
<%= render view_config.document_component.with_collection(document_presenters, partials: view_config.partials, counter_offset: @response&.start || 0) %>
|
|
8
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<div class="result-type-group btn-group" role="group" aria-label="<%= t('arclight.views.index.group_results') %>">
|
|
2
|
+
<%= link_to t('arclight.views.index.all_results'),
|
|
3
|
+
search_catalog_path(search_without_group),
|
|
4
|
+
class: "btn btn-outline-secondary #{'active' unless grouped?}"
|
|
5
|
+
%>
|
|
6
|
+
<%= link_to t('arclight.views.index.group_by_collection'),
|
|
7
|
+
search_catalog_path(search_with_group),
|
|
8
|
+
class: "btn btn-outline-secondary #{'active' if grouped?}"
|
|
9
|
+
%>
|
|
10
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<p><%= params[:id] %></p>
|
|
2
|
+
<%= turbo_frame_tag "al-hierarchy-#{params[:id]}#{params[:key]}" do %>
|
|
3
|
+
<%= render partial: "paginate_compact", object: @response if show_pagination? && params[:paginate] %>
|
|
4
|
+
<% presenters = @response.documents.map{ | document | document_presenter(document) } %>
|
|
5
|
+
<% if params[:hierarchy].present? %>
|
|
6
|
+
<ul class="documents">
|
|
7
|
+
<%= render Arclight::DocumentCollectionHierarchyComponent.with_collection(presenters,
|
|
8
|
+
blacklight_config: blacklight_config,
|
|
9
|
+
nest_path: params[:nest_path]) %>
|
|
10
|
+
</ul>
|
|
11
|
+
<% else %>
|
|
12
|
+
<table class="table table-striped">
|
|
13
|
+
<%= render Arclight::DocumentCollectionContextComponent.with_collection(presenters,
|
|
14
|
+
blacklight_config: blacklight_config) %>
|
|
15
|
+
</table>
|
|
16
|
+
<% end %>
|
|
17
|
+
|
|
18
|
+
<%= render 'results_pagination' if params[:paginate] %>
|
|
19
|
+
<% end %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<% content_for(:sidebar) do %>
|
|
2
|
+
<% conf = blacklight_config.view_config(document_index_view_type) %>
|
|
3
|
+
<%= render conf.sidebar_component.new(blacklight_config: blacklight_config,
|
|
4
|
+
response: @response,
|
|
5
|
+
view_config: conf) %>
|
|
6
|
+
<% end %>
|
|
7
|
+
|
|
8
|
+
<% breadcrumb :search_results, search_state %>
|
|
9
|
+
|
|
10
|
+
<%= render 'search_results' %>
|
|
11
|
+
|
|
12
|
+
<%# override upstream to override the search results header, similar to https://github.com/projectblacklight/blacklight/pull/2831 %>
|
|
13
|
+
<%# This section can be omitted in Blacklight 8 %>
|
|
14
|
+
<% content_for(:container_header, flush: true) do -%>
|
|
15
|
+
<%= render 'search_results_header' %>
|
|
16
|
+
<%= render 'constraints' %>
|
|
17
|
+
<% end %>
|
|
@@ -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 ms-3 <%= collection_active_class %>">
|
|
5
|
+
<%= link_to t('arclight.routes.collections'), arclight_engine.collections_path, class: 'nav-link' %>
|
|
6
|
+
</li>
|