arclight 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.all-contributorsrc +450 -0
  3. data/.babelrc +3 -0
  4. data/.codeclimate.yml +5 -0
  5. data/.eslintrc +3 -0
  6. data/.rubocop.yml +19 -0
  7. data/.rubocop_todo.yml +15 -135
  8. data/.travis.yml +2 -2
  9. data/CONTRIBUTORS.md +79 -0
  10. data/README.md +21 -24
  11. data/Rakefile +0 -1
  12. data/app/assets/images/blacklight/bookmark.svg +1 -0
  13. data/app/assets/images/blacklight/collection.svg +5 -0
  14. data/app/assets/images/blacklight/compact.svg +1 -25
  15. data/app/assets/images/blacklight/container.svg +5 -0
  16. data/app/assets/images/blacklight/ead.svg +1 -0
  17. data/app/assets/images/blacklight/file.svg +5 -0
  18. data/app/assets/images/blacklight/folder.svg +1 -0
  19. data/app/assets/images/blacklight/list.svg +1 -0
  20. data/app/assets/images/blacklight/minus.svg +1 -0
  21. data/app/assets/images/blacklight/online.svg +5 -0
  22. data/app/assets/images/blacklight/pdf.svg +1 -0
  23. data/app/assets/images/blacklight/plus.svg +1 -0
  24. data/app/assets/images/blacklight/repository.svg +1 -0
  25. data/app/assets/javascripts/arclight/arclight.js +1 -3
  26. data/app/assets/javascripts/arclight/collection_navigation.js +36 -53
  27. data/app/assets/javascripts/arclight/collection_scrollspy.js +1 -1
  28. data/app/assets/javascripts/arclight/context_navigation.js +374 -0
  29. data/app/assets/javascripts/arclight/truncator.js.erb +8 -2
  30. data/app/assets/stylesheets/arclight/application.scss +3 -1
  31. data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +23 -0
  32. data/app/assets/stylesheets/arclight/modules/context_navigation.scss +75 -0
  33. data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +28 -35
  34. data/app/assets/stylesheets/arclight/modules/highlights.scss +2 -1
  35. data/app/assets/stylesheets/arclight/modules/layout.scss +128 -14
  36. data/app/assets/stylesheets/arclight/modules/mastheads.scss +27 -5
  37. data/app/assets/stylesheets/arclight/modules/repositories.scss +1 -5
  38. data/app/assets/stylesheets/arclight/modules/repository_card.scss +6 -7
  39. data/app/assets/stylesheets/arclight/modules/search_results.scss +145 -24
  40. data/app/assets/stylesheets/arclight/modules/show_collection.scss +38 -59
  41. data/app/assets/stylesheets/arclight/responsive.scss +13 -0
  42. data/app/assets/stylesheets/arclight/variables.scss +21 -1
  43. data/app/controllers/concerns/arclight/ead_format_helpers.rb +225 -0
  44. data/app/controllers/concerns/arclight/field_config_helpers.rb +23 -7
  45. data/app/factories/blacklight_field_configuration_factory.rb +1 -0
  46. data/app/helpers/arclight_helper.rb +197 -35
  47. data/app/models/arclight/document_downloads.rb +125 -0
  48. data/app/models/arclight/parent.rb +4 -2
  49. data/app/models/arclight/parents.rb +6 -4
  50. data/app/models/arclight/requests/aeon_external_request.rb +42 -0
  51. data/app/models/arclight/requests/aeon_web_ead.rb +47 -0
  52. data/app/models/arclight/requests/google_form.rb +2 -2
  53. data/app/models/concerns/arclight/catalog.rb +14 -2
  54. data/app/models/concerns/arclight/search_behavior.rb +27 -12
  55. data/app/models/concerns/arclight/solr_document.rb +29 -7
  56. data/app/views/arclight/_requests.html.erb +7 -0
  57. data/app/views/arclight/repositories/_in_person_repository.html.erb +1 -1
  58. data/app/views/arclight/repositories/_repository.html.erb +2 -2
  59. data/app/views/arclight/repositories/_repository_contact.html.erb +9 -0
  60. data/app/views/arclight/repositories/index.html.erb +3 -0
  61. data/app/views/arclight/repositories/show.html.erb +5 -4
  62. data/app/views/arclight/requests/_aeon_external_request_endpoint.html.erb +9 -0
  63. data/app/views/arclight/requests/_aeon_web_ead.html.erb +7 -0
  64. data/app/views/arclight/requests/_google_form.html.erb +2 -1
  65. data/app/views/arclight/viewers/_oembed.html.erb +2 -1
  66. data/app/views/catalog/_access_contents.html.erb +15 -0
  67. data/app/views/catalog/_arclight_abstract_or_scope.html.erb +5 -0
  68. data/app/views/catalog/_arclight_bookmark_control.html.erb +38 -0
  69. data/app/views/catalog/_arclight_document_header_icon.html.erb +1 -0
  70. data/app/views/catalog/_arclight_index_compact_default.html.erb +18 -11
  71. data/app/views/catalog/_arclight_index_default.html.erb +45 -0
  72. data/app/views/catalog/_arclight_index_group_document_compact_default.html.erb +19 -0
  73. data/app/views/catalog/_arclight_index_group_document_default.html.erb +18 -0
  74. data/app/views/catalog/_arclight_online_content_indicator.html.erb +1 -3
  75. data/app/views/catalog/_collection_contents.html.erb +2 -10
  76. data/app/views/catalog/_collection_context.html.erb +15 -0
  77. data/app/views/catalog/_collection_context_nav.html.erb +12 -0
  78. data/app/views/catalog/_collection_online_contents.html.erb +3 -3
  79. data/app/views/catalog/_component_context.html.erb +5 -0
  80. data/app/views/catalog/_containers.html.erb +3 -0
  81. data/app/views/catalog/_context_sidebar.html.erb +2 -2
  82. data/app/views/catalog/_document_downloads.html.erb +14 -0
  83. data/app/views/catalog/_group.html.erb +21 -0
  84. data/app/views/catalog/_group_header_compact_default.html.erb +15 -0
  85. data/app/views/catalog/_group_header_default.html.erb +20 -0
  86. data/app/views/catalog/_group_toggle.html.erb +10 -0
  87. data/app/views/catalog/_home.html.erb +1 -1
  88. data/app/views/catalog/_index_breadcrumb_default.html.erb +5 -2
  89. data/app/views/catalog/_index_collection_context_default.html.erb +53 -0
  90. data/app/views/catalog/_index_header.html.erb +3 -3
  91. data/app/views/catalog/_index_online_contents_default.html.erb +1 -1
  92. data/app/views/catalog/_online_content_label.html.erb +5 -0
  93. data/app/views/catalog/_search_form.html.erb +34 -0
  94. data/app/views/catalog/_search_results.html.erb +1 -4
  95. data/app/views/catalog/_show_actions_box_default.html.erb +27 -0
  96. data/app/views/catalog/_show_breadcrumbs_default.html.erb +5 -20
  97. data/app/views/catalog/_show_collection.html.erb +42 -24
  98. data/app/views/catalog/_show_default.html.erb +63 -35
  99. data/app/views/catalog/_show_upper_metadata_default.html.erb +1 -1
  100. data/app/views/catalog/_sort_and_per_page.html.erb +8 -0
  101. data/app/views/catalog/_within_collection_dropdown.html.erb +26 -0
  102. data/app/views/shared/_breadcrumbs.html.erb +4 -4
  103. data/app/views/shared/_context_sidebar.html.erb +2 -2
  104. data/app/views/shared/_header_navbar.html.erb +13 -17
  105. data/app/views/shared/_show_breadcrumbs.html.erb +27 -0
  106. data/arclight.gemspec +5 -6
  107. data/config/i18n-tasks.yml +2 -1
  108. data/config/locales/arclight.en.yml +54 -21
  109. data/config/repositories.yml +0 -0
  110. data/lib/arclight/engine.rb +22 -12
  111. data/lib/arclight/hash_absolute_xpath.rb +11 -7
  112. data/lib/arclight/level_label.rb +46 -0
  113. data/lib/arclight/normalized_date.rb +2 -2
  114. data/lib/arclight/normalized_id.rb +1 -0
  115. data/lib/arclight/normalized_title.rb +1 -0
  116. data/lib/arclight/repository.rb +58 -5
  117. data/lib/arclight/traject/ead2_config.rb +178 -159
  118. data/lib/arclight/traject/nokogiri_namespaceless_reader.rb +22 -0
  119. data/lib/arclight/version.rb +1 -1
  120. data/lib/arclight/viewers/oembed.rb +1 -0
  121. data/lib/arclight/year_range.rb +9 -1
  122. data/lib/generators/arclight/install_generator.rb +5 -1
  123. data/lib/generators/arclight/templates/catalog_controller.rb +128 -100
  124. data/lib/generators/arclight/templates/config/downloads.yml +12 -0
  125. data/lib/generators/arclight/templates/config/repositories.yml +20 -2
  126. data/lib/generators/arclight/update_generator.rb +1 -1
  127. data/lib/tasks/index.rake +18 -20
  128. data/package.json +8 -1
  129. data/solr/conf/schema.xml +51 -292
  130. data/solr/conf/solrconfig.xml +40 -125
  131. data/tasks/arclight.rake +1 -0
  132. data/vendor/assets/javascripts/responsiveTruncator.js +2 -2
  133. metadata +71 -44
  134. data/app/assets/javascripts/arclight/collection_context.js +0 -18
  135. data/app/assets/javascripts/arclight/component_ancestors.js +0 -56
  136. data/app/assets/javascripts/arclight/search_results.js +0 -15
  137. data/app/assets/stylesheets/arclight/modules/sidebar.scss +0 -21
  138. data/app/views/catalog/_collection_count.html.erb +0 -7
  139. data/app/views/catalog/_collection_downloads.html.erb +0 -15
  140. data/app/views/catalog/_collection_overview.html.erb +0 -7
  141. data/app/views/catalog/_component_contents.html.erb +0 -16
  142. data/app/views/catalog/_component_overview.html.erb +0 -40
  143. data/app/views/catalog/_index_header_hierarchy_default.html.erb +0 -42
  144. data/app/views/catalog/_index_hierarchy_default.html.erb +0 -28
  145. data/app/views/catalog/_results_histogram.html.erb +0 -15
  146. data/app/views/catalog/_show_component_sidebar.html.erb +0 -12
  147. data/app/views/catalog/_show_sidebar.html.erb +0 -22
  148. data/lib/arclight/custom_component.rb +0 -99
  149. data/lib/arclight/custom_document.rb +0 -93
  150. data/lib/arclight/indexer.rb +0 -9
  151. data/lib/arclight/shared_indexing_behavior.rb +0 -97
  152. data/lib/arclight/shared_terminology_behavior.rb +0 -65
  153. data/lib/arclight/solr_ead_indexer_ext.rb +0 -155
@@ -0,0 +1,8 @@
1
+ <% # overidden from Blacklight to handle our responsive needs %>
2
+ <div id="sortAndPerPage" class="sort-pagination clearfix">
3
+ <div>
4
+ <%= render partial: "paginate_compact", object: @response if show_pagination? %>
5
+ </div>
6
+ <%= render partial: 'group_toggle' unless current_page?(controller: 'bookmarks') %>
7
+ <%= render_results_collection_tools wrapping_class: "search-widgets float-md-right" %>
8
+ </div>
@@ -0,0 +1,26 @@
1
+ <div class="input-group within-collection-dropdown flex-nowrap flex-shrink-1 mb-2 mb-md-0 mr-md-2">
2
+ <span class="input-group-prepend">
3
+ <label class="input-group-text" for="within_collection">
4
+ <%= t('arclight.within_collection_dropdown.label_html') %>
5
+ </label>
6
+ </span>
7
+ <select
8
+ id="within_collection"
9
+ class="custom-select search-field rounded-right"
10
+ <%= 'name="f[collection_sim][]"'.html_safe if within_collection_context? %>
11
+ >
12
+ <option
13
+ <%= "selected" unless within_collection_context? %>
14
+ value=""
15
+ >
16
+ <%= t('arclight.within_collection_dropdown.all_collections') %>
17
+ </option>
18
+ <option
19
+ value="<%= Array(params.dig(:f, :collection_sim)).first || @document && @document.collection_name %>"
20
+ <%= 'selected' if within_collection_context? %>
21
+ <%= 'disabled' unless within_collection_context? %>
22
+ >
23
+ <%= t('arclight.within_collection_dropdown.this_collection') %>
24
+ </option>
25
+ </select>
26
+ </div>
@@ -1,15 +1,15 @@
1
- <div class='al-search-breadcrumb'>
1
+ <nav class='al-search-breadcrumb' role='navigation' aria-label=<%= t('arclight.breadcrumbs.aria_label') %> >
2
2
  <%= link_to t('arclight.routes.home'), root_path %>
3
- <%= t('arclight.breadcrumb_separator') %>
3
+ <span aria-hidden="true"><%= t('arclight.breadcrumb_separator') %></span>
4
4
  <% if collection_active? %>
5
5
  <%= t('arclight.routes.collections') %>
6
6
  <% elsif on_repositories_index? %>
7
7
  <%= t('arclight.routes.repositories') %>
8
8
  <% elsif on_repositories_show? %>
9
9
  <%= link_to t('arclight.routes.repositories'), arclight_engine.repositories_path %>
10
- <%= t('arclight.breadcrumb_separator') %>
10
+ <span aria-hidden="true"><%= t('arclight.breadcrumb_separator') %></span>
11
11
  <%= @repository.name %>
12
12
  <% else %>
13
13
  <%= t('arclight.routes.search_results') %>
14
14
  <% end %>
15
- </div>
15
+ </nav>
@@ -1,6 +1,6 @@
1
- <% unless blacklight_config.show.context_sidebar_items.nil? %>
1
+ <% unless blacklight_config.show.context_access_tab_items.nil? %>
2
2
  <div id="accordion" role="tablist" aria-multiselectable="true">
3
- <% items = blacklight_config.show.context_sidebar_items.select { |i| fields_have_content?(@document, i) } %>
3
+ <% items = blacklight_config.show.context_access_tab_items.select { |i| fields_have_content?(@document, i) } %>
4
4
  <% items.each_with_index do |item, index| %>
5
5
  <%= render partial: 'context_card', locals: { document: @document, field_accessor: item, card_index: index} %>
6
6
  <% end %>
@@ -21,16 +21,17 @@
21
21
  </div>
22
22
 
23
23
  <div class="col-md-4 nav-links d-flex justify-content-end" >
24
- <span class="navbar-nav" aria-label="browse" role="navigation">
24
+ <ul class="navbar-nav" aria-label="browse" role="navigation">
25
25
  <%= render 'shared/main_menu_links' %>
26
- </span>
26
+ </ul>
27
27
  </div>
28
28
  </div>
29
- </div>
30
- <div class='row justify-content-md-center'>
31
- <div class='col-md-6 col-sm-12'>
32
- <div class='navbar-search'>
33
- <%= render_search_bar %>
29
+
30
+ <div class='row justify-content-md-center'>
31
+ <div class='col-12'>
32
+ <div class='navbar-search'>
33
+ <%= render_search_bar %>
34
+ </div>
34
35
  </div>
35
36
  </div>
36
37
  </div>
@@ -40,25 +41,20 @@
40
41
  <div class="container">
41
42
  <div class="row align-items-center">
42
43
  <div class="col-md-8" >
43
- <h1><%= t('arclight.masthead_heading') %></h1>
44
+ <span class="h1"><%= t('arclight.masthead_heading') %></span>
44
45
  </div>
45
46
 
46
47
  <div class="col-md-4 nav-links d-flex justify-content-end" >
47
- <span class="navbar-nav" aria-label="browse" role="navigation">
48
+ <ul class="navbar-nav" aria-label="browse" role="navigation">
48
49
  <%= render 'shared/main_menu_links' %>
49
- </span>
50
+ </ul>
50
51
  </div>
51
52
  </div>
52
53
  </div>
53
54
  </div>
54
- <div class="navbar-search navbar navbar-expand-sm bg-faded">
55
+ <div class="navbar-search navbar">
55
56
  <div class="<%= container_classes %>">
56
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
57
- <span class="navbar-toggler-icon"></span>
58
- </button>
59
- <div class="collapse navbar-collapse" id="navbarSupportedContent">
60
- <%= render_search_bar %>
61
- </div>
57
+ <%= render_search_bar %>
62
58
  </div>
63
59
  </div>
64
60
  <% end %>
@@ -0,0 +1,27 @@
1
+ <% parents = Arclight::Parents.from_solr_document(document).as_parents %>
2
+ <nav aria-label="breadcrumb">
3
+ <ol class="breadcrumb">
4
+ <li class="breadcrumb-home-link">
5
+ <%= link_to t('arclight.routes.home'), root_path %>
6
+ </li>
7
+ <li class="media breadcrumb-item breadcrumb-item-1">
8
+ <% if document.repository_config.present? %>
9
+ <span class="media-body" aria-hidden="true"><%= blacklight_icon :repository, classes: 'al-repository-content-icon' %></span>
10
+ <span class="col"><%= link_to(document.repository_config.name, arclight_engine.repository_path(document.repository_config.slug)) %></span>
11
+ <% else %>
12
+ <span class="media-body" aria-hidden="true"><%= blacklight_icon :repository, classes: 'al-repository-content-icon' %></span><span class="col"><%= t('arclight.show_breadcrumb_label') %></span>
13
+ <% end %>
14
+ </li>
15
+ <% parents.each_with_index.map do |parent, index| %>
16
+ <%= content_tag :li, class: "breadcrumb-item breadcrumb-item-#{index + 1} media" do %>
17
+ <span class="media-body" aria-hidden="true"><%= blacklight_icon document_or_parent_icon(parent) %></span>
18
+ <span class="col"><%= link_to parent.label, solr_document_path(parent.global_id) %></span>
19
+ <% end %>
20
+ <% end %>
21
+ </ol>
22
+
23
+ <%= content_tag :h1, class: "breadcrumb-item breadcrumb-item-#{parents.length + 2} media" do %>
24
+ <span class="media-body" aria-hidden="true"><%= blacklight_icon document_or_parent_icon(document) %></span>
25
+ <span class="col"><%= document.normalized_title %></span>
26
+ <% end %>
27
+ </nav>
data/arclight.gemspec CHANGED
@@ -1,7 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
2
 
4
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
5
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
5
  require 'arclight/version'
7
6
 
@@ -23,21 +22,21 @@ Gem::Specification.new do |spec|
23
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
23
  spec.require_paths = ['lib']
25
24
 
26
- spec.add_dependency 'blacklight', '~> 7.0', '>= 7.0.1'
25
+ spec.add_dependency 'blacklight', '~> 7.2'
27
26
  spec.add_dependency 'blacklight_range_limit', '~> 7.1'
28
27
  spec.add_dependency 'rails', '~> 5.0'
29
- spec.add_dependency 'solr_ead'
28
+ spec.add_dependency 'sprockets-bumble_d'
30
29
  spec.add_dependency 'traject', '~> 3.0'
31
- spec.add_dependency 'traject_plus'
30
+ spec.add_dependency 'traject_plus', '~> 1.2'
32
31
 
33
32
  spec.add_development_dependency 'bundler', '> 1.14'
34
33
  spec.add_development_dependency 'capybara'
35
34
  spec.add_development_dependency 'engine_cart'
36
35
  spec.add_development_dependency 'i18n-tasks'
37
36
  spec.add_development_dependency 'rake', '~> 12.0'
37
+ spec.add_development_dependency 'rspec-rails', '~> 3.0'
38
38
  spec.add_development_dependency 'rubocop', '~> 0.74.0'
39
39
  spec.add_development_dependency 'rubocop-rspec', '~> 1.35'
40
- spec.add_development_dependency 'rspec-rails', '~> 3.0'
41
40
  spec.add_development_dependency 'selenium-webdriver'
42
41
  spec.add_development_dependency 'simplecov'
43
42
  spec.add_development_dependency 'solr_wrapper'
@@ -96,7 +96,8 @@ ignore_missing:
96
96
  - '{blacklight}.*'
97
97
 
98
98
  ## Consider these keys used:
99
- # ignore_unused:
99
+ ignore_unused:
100
+ - '{blacklight}.*'
100
101
  # - 'activerecord.attributes.*'
101
102
  # - '{devise,kaminari,will_paginate}.*'
102
103
  # - 'simple_form.{yes,no}'
@@ -2,13 +2,14 @@
2
2
  en:
3
3
  arclight:
4
4
  breadcrumb_separator: " » "
5
- date_range_histogram:
6
- hide: Hide date distribution
7
- show: Show date distribution
5
+ breadcrumbs:
6
+ aria_label: breadcrumb
8
7
  hierarchy:
9
8
  scope_and_contents: Scope and Contents
9
+ scope_note: 'Scope note: '
10
10
  view_all: View
11
11
  masthead_heading: Archival Collections at Institution
12
+ repositories: Repositories
12
13
  request:
13
14
  container: Request
14
15
  routes:
@@ -16,46 +17,64 @@ en:
16
17
  home: Home
17
18
  repositories: Repositories
18
19
  search_results: Search results
20
+ search:
21
+ collections_header: Collections
22
+ repository_header: 'Collections : [%{repository}]'
23
+ show_breadcrumb_label: Repository
19
24
  truncation:
20
25
  view_less: view less ▼
21
26
  view_more: view more ▶
22
27
  views:
28
+ home:
29
+ title: Archival Collections at Institution - Arclight
23
30
  index:
24
- collection_search:
25
- count: collection
26
- number_of_children:
27
- one: 1 child
28
- other: "%{count} children"
29
- zero: No children
30
- online_content_indicator: online content
31
+ all_group_results: view all %{count}
32
+ all_results: All results
33
+ group_by_collection: Grouped by collection
34
+ group_results: Group results
35
+ group_results_count:
36
+ one: 1 result
37
+ other: "%{count} results"
38
+ zero: 0 results
39
+ number_of_components:
40
+ one: component
41
+ other: components
42
+ top_group_results:
43
+ one: Top %{count} result
44
+ other: Top %{count} results
31
45
  repositories:
32
46
  number_of_collections:
33
47
  one: 1 collection
34
48
  other: "%{count} collections"
35
49
  zero: No collections
50
+ show: "%{name} - Arclight"
51
+ title: Repositories - Arclight
36
52
  view_all_collections: View all of our collections
37
53
  view_more: View more
38
54
  show:
55
+ access: Access
56
+ collapse: Collapse
39
57
  collection_id: 'Collection ID: %{id}'
40
- context_sidebar:
41
- cite_field: How to cite this collection
42
- component_terms_field: Terms & Conditions
43
- in_person_field: In person
44
- terms_field: Terms & Conditions
58
+ context: Collection context
59
+ context_nav:
60
+ title: Collection context navigation
45
61
  download:
46
62
  default: Download
47
- ead: Collection EAD (%{size})
48
- pdf: Collection PDF (%{size})
49
- navigation_sidebar:
50
- title: Navigation overview
63
+ ead: Download EAD
64
+ pdf: Download finding aid
65
+ download_with_size:
66
+ default: Download (%{size})
67
+ ead: Download EAD (%{size})
68
+ pdf: Download finding aid (%{size})
69
+ expand: Expand
70
+ has_content: Contents
51
71
  no_contents: No content inventory
52
- no_online_content: No online content
53
72
  online_content: Online content
73
+ online_content_upper: ONLINE CONTENT
54
74
  our_collections: Our Collections
55
75
  overview: Overview
56
76
  sections:
57
77
  access_field: Access and Use
58
- admin_info_field: Administrative Information
59
78
  background_field: Background
60
79
  collection_context_field: Collection Context
61
80
  component_field: About this %{level}
@@ -64,3 +83,17 @@ en:
64
83
  related_field: Related
65
84
  scope_and_arrangement_field: Scope and Arrangement
66
85
  summary_field: Summary
86
+ tablist_nav: Context
87
+ within_collection_dropdown:
88
+ all_collections: all collections
89
+ label_html: Search<span class="sr-only"> within</span>
90
+ this_collection: this collection
91
+ blacklight:
92
+ entry_name:
93
+ grouped:
94
+ collection_ssi: collection
95
+ search:
96
+ pagination_info:
97
+ pages:
98
+ one: "<strong>%{start_num}</strong> - <strong>%{end_num}</strong> of <strong>%{total_num} %{entry_name}</strong>"
99
+ other: "<strong>%{start_num}</strong> - <strong>%{end_num}</strong> of <strong>%{total_num} %{entry_name}</strong>"
File without changes
@@ -1,34 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'sprockets/bumble_d'
3
4
  require 'blacklight'
4
- require 'solr_ead'
5
5
  require 'traject'
6
+ require 'active_model'
6
7
  require 'arclight/exceptions'
7
8
  require 'arclight/normalized_date'
8
9
  require 'arclight/normalized_id'
9
10
  require 'arclight/normalized_title'
10
11
  require 'arclight/digital_object'
11
- require 'arclight/shared_indexing_behavior'
12
- require 'arclight/shared_terminology_behavior'
13
- require 'arclight/custom_document'
14
- require 'arclight/custom_component'
15
- require 'arclight/solr_ead_indexer_ext'
16
- require 'arclight/indexer'
17
12
  require 'arclight/viewer'
18
13
 
19
14
  module Arclight
20
15
  ##
21
16
  # This is the defining class for the Arclight Rails Engine
22
17
  class Engine < ::Rails::Engine
18
+ extend ::Sprockets::BumbleD::DSL
19
+
20
+ # We're not sure this is right, but we aren't doing module imports
21
+ # at the moment anyway
22
+ register_umd_globals :arclight,
23
+ 'blacklight' => 'Blacklight'
24
+
23
25
  config.viewer_class = Arclight::Viewers::OEmbed
24
26
  config.oembed_resource_exclude_patterns = [/\.pdf$/, /\.ppt$/]
25
27
 
26
28
  Arclight::Engine.config.catalog_controller_field_accessors = %i[
27
29
  summary_field
28
30
  access_field
31
+ contact_field
29
32
  background_field
30
33
  related_field
31
- admin_info_field
32
34
  terms_field
33
35
  cite_field
34
36
  indexed_terms_field
@@ -39,6 +41,18 @@ module Arclight
39
41
  component_indexed_terms_field
40
42
  ]
41
43
 
44
+ Arclight::Engine.config.catalog_controller_group_query_params = {
45
+ group: true,
46
+ 'group.field': 'collection_ssi',
47
+ 'group.ngroups': true,
48
+ 'group.limit': 3,
49
+ fl: '*,parent:[subquery]',
50
+ 'parent.fl': '*',
51
+ 'parent.q': '{!term f=collection_sim v=$row.collection_ssi}',
52
+ 'parent.fq': '{!term f=level_sim v="Collection"}',
53
+ 'parent.defType': 'lucene'
54
+ }
55
+
42
56
  initializer 'arclight.fields' do
43
57
  Arclight::Engine.config.catalog_controller_field_accessors.each do |field|
44
58
  Blacklight::Configuration.define_field_access field
@@ -48,9 +62,5 @@ module Arclight
48
62
  initializer 'arclight.helpers' do
49
63
  ActionView::Base.send :include, ArclightHelper
50
64
  end
51
-
52
- initializer 'arclight.views' do
53
- Blacklight::Configuration.default_values[:view].hierarchy
54
- end
55
65
  end
56
66
  end
@@ -24,17 +24,12 @@ module Arclight
24
24
  end
25
25
 
26
26
  def to_hexdigest
27
- self.class.hash_algorithm.hexdigest(absolute_xpath)
27
+ self.class.hash_algorithm.hexdigest(absolute_xpath).prepend('al_')
28
28
  end
29
29
 
30
30
  def absolute_xpath
31
31
  ancestor_tree = node.ancestors.map do |ancestor|
32
- if ancestor.name =~ COMPONENT_NODE_NAME_REGEX
33
- index = component_siblings_for_node(ancestor).index(ancestor)
34
- "#{ancestor.name}#{index}"
35
- else
36
- ancestor.name
37
- end
32
+ ancestor_name_and_index(ancestor)
38
33
  end
39
34
 
40
35
  "#{[ancestor_tree.reverse, node.name].flatten.join('/')}#{current_index}"
@@ -53,5 +48,14 @@ module Arclight
53
48
  def siblings
54
49
  @siblings ||= component_siblings_for_node(node)
55
50
  end
51
+
52
+ def ancestor_name_and_index(ancestor)
53
+ if ancestor.name =~ COMPONENT_NODE_NAME_REGEX
54
+ index = component_siblings_for_node(ancestor).index(ancestor)
55
+ "#{ancestor.name}#{index}"
56
+ else
57
+ ancestor.name
58
+ end
59
+ end
56
60
  end
57
61
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Arclight
4
+ ##
5
+ # A utility class to return a human-readable label for an EAD @level code.
6
+ # Can use the value from @otherlevel if provided.
7
+ # Examples from @level: recordgrp = "Record Group"
8
+ # collection = "Collection"
9
+ # subseries = "Subseries"
10
+ # otherlevel = (text provided in @otherlevel)
11
+ class LevelLabel
12
+ # @param [String] `level` from the collection or component @level
13
+ # @param [String] `other_level` from the collection or component @otherlevel
14
+ def initialize(level, other_level = nil)
15
+ @level = level
16
+ @other_level = other_level if other_level.present?
17
+ end
18
+
19
+ # @return [String] the human-readable label
20
+ def to_s
21
+ human_readable_level
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :level, :other_level
27
+
28
+ CUSTOM_LEVEL_LABELS = {
29
+ recordgrp: 'Record Group',
30
+ subgrp: 'Subgroup'
31
+ }.freeze
32
+
33
+ def human_readable_level
34
+ if level == 'otherlevel'
35
+ alternative_level
36
+ elsif level.present?
37
+ CUSTOM_LEVEL_LABELS.fetch(level.to_sym, level.capitalize).to_s
38
+ end
39
+ end
40
+
41
+ def alternative_level
42
+ alternative_level = other_level if other_level
43
+ alternative_level.present? ? alternative_level.capitalize : 'Other'
44
+ end
45
+ end
46
+ end