arclight 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc +12 -0
  3. data/.gitignore +5 -0
  4. data/.rubocop.yml +66 -0
  5. data/.solr_wrapper +5 -0
  6. data/.travis.yml +30 -2
  7. data/CONTRIBUTING.md +43 -0
  8. data/Gemfile +36 -0
  9. data/LICENSE.txt +1 -0
  10. data/README.md +85 -12
  11. data/Rakefile +14 -3
  12. data/app/assets/images/blacklight/compact.svg +25 -0
  13. data/app/assets/images/blacklight/logo.png +0 -0
  14. data/app/assets/javascripts/arclight/arclight.js +9 -0
  15. data/app/assets/javascripts/arclight/collection_context.js +18 -0
  16. data/app/assets/javascripts/arclight/collection_navigation.js +114 -0
  17. data/app/assets/javascripts/arclight/collection_scrollspy.js +6 -0
  18. data/app/assets/javascripts/arclight/component_ancestors.js +56 -0
  19. data/app/assets/javascripts/arclight/oembed_viewer.js +39 -0
  20. data/app/assets/javascripts/arclight/truncator.js.erb +23 -0
  21. data/app/assets/stylesheets/arclight/application.scss +13 -0
  22. data/app/assets/stylesheets/arclight/bootstrap_overrides.scss +3 -0
  23. data/app/assets/stylesheets/arclight/modules/collection_search.scss +3 -0
  24. data/app/assets/stylesheets/arclight/modules/hierarchy_and_online_contents.scss +174 -0
  25. data/app/assets/stylesheets/arclight/modules/highlights.scss +10 -0
  26. data/app/assets/stylesheets/arclight/modules/layout.scss +33 -0
  27. data/app/assets/stylesheets/arclight/modules/mastheads.scss +60 -0
  28. data/app/assets/stylesheets/arclight/modules/repositories.scss +29 -0
  29. data/app/assets/stylesheets/arclight/modules/repository_card.scss +54 -0
  30. data/app/assets/stylesheets/arclight/modules/search_results.scss +75 -0
  31. data/app/assets/stylesheets/arclight/modules/show_collection.scss +78 -0
  32. data/app/assets/stylesheets/arclight/modules/sidebar.scss +16 -0
  33. data/app/assets/stylesheets/arclight/variables.scss +2 -0
  34. data/app/controllers/arclight/repositories_controller.rb +40 -0
  35. data/app/controllers/concerns/arclight/field_config_helpers.rb +86 -0
  36. data/app/factories/blacklight_field_configuration_factory.rb +29 -0
  37. data/app/helpers/arclight_helper.rb +173 -0
  38. data/app/models/arclight/parent.rb +24 -0
  39. data/app/models/arclight/parents.rb +34 -0
  40. data/app/models/arclight/requests/google_form.rb +44 -0
  41. data/app/models/concerns/arclight/catalog.rb +22 -0
  42. data/app/models/concerns/arclight/search_behavior.rb +46 -0
  43. data/app/models/concerns/arclight/solr_document.rb +131 -0
  44. data/app/presenters/arclight/index_presenter.rb +10 -0
  45. data/app/presenters/arclight/show_presenter.rb +27 -0
  46. data/app/views/arclight/.keep +0 -0
  47. data/app/views/arclight/repositories/_in_person_repository.html.erb +19 -0
  48. data/app/views/arclight/repositories/_repository.html.erb +62 -0
  49. data/app/views/arclight/repositories/index.html.erb +4 -0
  50. data/app/views/arclight/repositories/show.html.erb +38 -0
  51. data/app/views/arclight/requests/_google_form.html.erb +11 -0
  52. data/app/views/arclight/viewers/_oembed.html.erb +7 -0
  53. data/app/views/catalog/_arclight_document_index_header.html.erb +13 -0
  54. data/app/views/catalog/_arclight_document_index_header_hierarchy_default.html.erb +0 -0
  55. data/app/views/catalog/_arclight_document_index_header_online_contents_default.html.erb +0 -0
  56. data/app/views/catalog/_arclight_document_show_header.html.erb +15 -0
  57. data/app/views/catalog/_arclight_document_show_header_collection.html.erb +12 -0
  58. data/app/views/catalog/_arclight_index_compact_default.html.erb +15 -0
  59. data/app/views/catalog/_arclight_online_content_indicator.html.erb +5 -0
  60. data/app/views/catalog/_arclight_rangelimit.html.erb +24 -0
  61. data/app/views/catalog/_arclight_viewer_default.html.erb +1 -0
  62. data/app/views/catalog/_collection_contents.html.erb +12 -0
  63. data/app/views/catalog/_collection_count.html.erb +7 -0
  64. data/app/views/catalog/_collection_downloads.html.erb +17 -0
  65. data/app/views/catalog/_collection_online_contents.html.erb +17 -0
  66. data/app/views/catalog/_collection_overview.html.erb +7 -0
  67. data/app/views/catalog/_component_overview.html.erb +46 -0
  68. data/app/views/catalog/_context_card.html.erb +27 -0
  69. data/app/views/catalog/_context_sidebar.html.erb +8 -0
  70. data/app/views/catalog/_custom_metadata.html.erb +16 -0
  71. data/app/views/catalog/_home.html.erb +1 -0
  72. data/app/views/catalog/_index_breadcrumb_default.html.erb +3 -0
  73. data/app/views/catalog/_index_default.html.erb +17 -0
  74. data/app/views/catalog/_index_header.html.erb +7 -0
  75. data/app/views/catalog/_index_header_hierarchy_default.html.erb +42 -0
  76. data/app/views/catalog/_index_header_online_contents_default.html.erb +1 -0
  77. data/app/views/catalog/_index_hierarchy_default.html.erb +28 -0
  78. data/app/views/catalog/_index_online_contents_default.html.erb +6 -0
  79. data/app/views/catalog/_results_histogram.html.erb +10 -0
  80. data/app/views/catalog/_search_results.html.erb +31 -0
  81. data/app/views/catalog/_search_results_repository.html.erb +6 -0
  82. data/app/views/catalog/_search_within_form.html.erb +16 -0
  83. data/app/views/catalog/_show_breadcrumbs_default.html.erb +7 -0
  84. data/app/views/catalog/_show_collection.html.erb +40 -0
  85. data/app/views/catalog/_show_component_sidebar.html.erb +12 -0
  86. data/app/views/catalog/_show_default.html.erb +32 -0
  87. data/app/views/catalog/_show_header.html.erb +5 -0
  88. data/app/views/catalog/_show_sidebar.html.erb +30 -0
  89. data/app/views/catalog/index.html.erb +8 -0
  90. data/app/views/layouts/catalog_result.html.erb +7 -0
  91. data/app/views/shared/_breadcrumbs.html.erb +15 -0
  92. data/app/views/shared/_context_sidebar.html.erb +8 -0
  93. data/app/views/shared/_header_navbar.html.erb +54 -0
  94. data/app/views/shared/_main_menu_links.html.erb +6 -0
  95. data/arclight.gemspec +17 -4
  96. data/bin/rails +13 -0
  97. data/config/locales/arclight.en.yml +65 -0
  98. data/config/routes.rb +6 -0
  99. data/lib/arclight.rb +5 -0
  100. data/lib/arclight/custom_component.rb +98 -0
  101. data/lib/arclight/custom_document.rb +93 -0
  102. data/lib/arclight/digital_object.rb +26 -0
  103. data/lib/arclight/engine.rb +55 -0
  104. data/lib/arclight/exceptions.rb +18 -0
  105. data/lib/arclight/indexer.rb +9 -0
  106. data/lib/arclight/normalized_date.rb +45 -0
  107. data/lib/arclight/normalized_id.rb +25 -0
  108. data/lib/arclight/normalized_title.rb +30 -0
  109. data/lib/arclight/repository.rb +91 -0
  110. data/lib/arclight/shared_indexing_behavior.rb +97 -0
  111. data/lib/arclight/shared_terminology_behavior.rb +65 -0
  112. data/lib/arclight/solr_ead_indexer_ext.rb +159 -0
  113. data/lib/arclight/version.rb +3 -1
  114. data/lib/arclight/viewer.rb +45 -0
  115. data/lib/arclight/viewers/oembed.rb +56 -0
  116. data/lib/arclight/year_range.rb +102 -0
  117. data/lib/generators/arclight/install_generator.rb +63 -0
  118. data/lib/generators/arclight/templates/arclight.js +2 -0
  119. data/lib/generators/arclight/templates/arclight.scss +3 -0
  120. data/lib/generators/arclight/templates/catalog_controller.rb +347 -0
  121. data/lib/generators/arclight/templates/config/downloads.yml +13 -0
  122. data/lib/generators/arclight/templates/config/repositories.yml +42 -0
  123. data/lib/generators/arclight/update_generator.rb +22 -0
  124. data/lib/tasks/index.rake +87 -0
  125. data/package.json +24 -0
  126. data/solr/conf/_rest_managed.json +3 -0
  127. data/solr/conf/admin-extra.html +31 -0
  128. data/solr/conf/elevate.xml +36 -0
  129. data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  130. data/solr/conf/protwords.txt +21 -0
  131. data/solr/conf/schema.xml +631 -0
  132. data/solr/conf/scripts.conf +24 -0
  133. data/solr/conf/solrconfig.xml +393 -0
  134. data/solr/conf/spellings.txt +2 -0
  135. data/solr/conf/stopwords.txt +58 -0
  136. data/solr/conf/stopwords_en.txt +58 -0
  137. data/solr/conf/synonyms.txt +31 -0
  138. data/solr/conf/xslt/example.xsl +132 -0
  139. data/solr/conf/xslt/example_atom.xsl +67 -0
  140. data/solr/conf/xslt/example_rss.xsl +66 -0
  141. data/solr/conf/xslt/luke.xsl +337 -0
  142. data/tasks/arclight.rake +68 -0
  143. data/template.rb +15 -0
  144. data/vendor/assets/javascripts/responsiveTruncator.js +69 -0
  145. data/vendor/assets/javascripts/stickyfill.js +480 -0
  146. metadata +301 -6
@@ -0,0 +1,33 @@
1
+ .al-search-breadcrumb,
2
+ .al-show-breadcrumb {
3
+ font-size: $font-size-sm;
4
+ margin-bottom: $spacer;
5
+ }
6
+
7
+ // Collapse arrow indicators
8
+ .al-toggle-view-more,
9
+ .al-toggle-view-all {
10
+ &[aria-expanded="true"] {
11
+ &::after {
12
+ content: '\25BC';
13
+ margin-left: 6px;
14
+ }
15
+ }
16
+
17
+ &::after {
18
+ content: '\25B6';
19
+ margin-left: 6px;
20
+ }
21
+ }
22
+
23
+ .al-document-title-bar {
24
+ .toggle-bookmark {
25
+ @media (min-width: 576px) and (max-width: 991px) {
26
+ padding-right: $spacer;
27
+ }
28
+ }
29
+ }
30
+
31
+ .bookmark-toggle .toggle-bookmark {
32
+ margin-bottom: 0;
33
+ }
@@ -0,0 +1,60 @@
1
+ .al-homepage-masthead.jumbotron {
2
+ border-bottom: $result-item-border-styling;
3
+ padding: ($spacer * 2) $spacer $spacer;
4
+
5
+ h1 {
6
+ font-size: 2.25rem;
7
+ margin-bottom: ($spacer * 2);
8
+ }
9
+
10
+ .search-query-form {
11
+ margin-bottom: $spacer;
12
+ max-width: 100%;
13
+ }
14
+
15
+ .navbar {
16
+ padding-bottom: 0;
17
+
18
+ a {
19
+ font-weight: $font-weight-bold;
20
+ }
21
+ }
22
+ }
23
+
24
+ .al-masthead {
25
+ h1 {
26
+ font-size: $font-size-h2;
27
+ margin: 0;
28
+ padding: ($spacer * 1.5) ($spacer / 2);
29
+ }
30
+
31
+ + .navbar-search {
32
+ border-bottom: $result-item-border-styling;
33
+ border-top: $result-item-border-styling;
34
+ margin-bottom: ($spacer / 2);
35
+
36
+ a {
37
+ font-weight: $font-weight-bold;
38
+ }
39
+
40
+ .active a {
41
+ color: $gray;
42
+ }
43
+
44
+ .navbar-toggler {
45
+ background-color: $white;
46
+ border: $result-item-border-styling;
47
+ }
48
+
49
+ .navbar-toggler-icon {
50
+ background-image: $navbar-light-toggler-bg;
51
+ }
52
+ }
53
+
54
+ @media (max-width: 992px) {
55
+ h1,
56
+ + .navbar-search {
57
+ text-align: center;
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,29 @@
1
+ .blacklight-repositories-show {
2
+ .al-repository-show-header {
3
+ margin-bottom: ($spacer / 2);
4
+ margin-top: ($spacer * 2);
5
+
6
+ h3 {
7
+ font-size: $font-size-h4;
8
+ }
9
+ }
10
+
11
+ .al-repository-collections{
12
+ font-size: $font-size-sm;
13
+
14
+ &::after {
15
+ content: '\bb';
16
+ }
17
+ }
18
+
19
+ .al-document-title-bar {
20
+ border-top: $result-item-border-styling;
21
+ margin-bottom: $spacer;
22
+ padding-top: ($spacer / 2);
23
+
24
+ .al-document-abstract-or-scope,
25
+ .al-collection-id {
26
+ font-size: $font-size-sm;
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,54 @@
1
+ .al-repository {
2
+ background-color: $gray-lighter;
3
+ border: $result-item-border-styling;
4
+ margin-bottom: $spacer;
5
+
6
+ .al-repository-information {
7
+ font-size: $font-size-sm;
8
+ padding: $spacer;
9
+
10
+ @media (min-width: 992px) {
11
+ padding-left: 0;
12
+ }
13
+
14
+ h2 {
15
+ font-size: $font-size-h5;
16
+ margin-bottom: $spacer;
17
+ }
18
+
19
+ address {
20
+ margin-bottom: 0;
21
+ }
22
+
23
+ .al-repository-contact,
24
+ .al-repository-extra-collection-count {
25
+ font-weight: 300;
26
+ }
27
+
28
+ .al-repository-street-address {
29
+ margin-bottom: 0.5rem;
30
+ }
31
+
32
+ .al-repository-description {
33
+ margin-right: $spacer;
34
+ padding-left: $spacer * 2;
35
+
36
+ @media (min-width: 992px) {
37
+ border-left: $result-item-border-styling;
38
+ }
39
+ }
40
+
41
+ .al-repository-extra {
42
+ text-align: center;
43
+
44
+ .al-repository-extra-collection-count {
45
+ font-style: italic;
46
+ margin-bottom: $spacer;
47
+ }
48
+
49
+ .al-repository-collection-count {
50
+ font-weight: $font-weight-bold;
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,75 @@
1
+ .documents-list {
2
+ // Result item header
3
+ .al-document-title-bar {
4
+ background-color: $gray-lighter;
5
+ border: $result-item-border-styling;
6
+ font-size: $font-size-sm;
7
+ margin: 0 (-$result-item-body-padding - 1px) 0.5rem;
8
+ padding: 3px $result-item-body-padding;
9
+ }
10
+
11
+ // Result item body
12
+ article.document {
13
+ border-bottom: 0;
14
+ border-left: $result-item-border-styling;
15
+ border-right: $result-item-border-styling;
16
+ margin-bottom: $spacer * 2;
17
+ padding: 0 $result-item-body-padding;
18
+
19
+ .documentHeader {
20
+ padding-top: 0.4rem;
21
+ }
22
+
23
+ .document-title-heading {
24
+ font-size: $font-size-h5;
25
+ }
26
+
27
+ .breadcrumb-links,
28
+ .al-document-creator,
29
+ .al-document-extent,
30
+ .al-document-abstract-or-scope {
31
+ font-size: $font-size-sm;
32
+ }
33
+ }
34
+ }
35
+
36
+ .documents-compact {
37
+ .document {
38
+ .breadcrumb-links,
39
+ .al-repository-footer {
40
+ font-size: $font-size-sm;
41
+ }
42
+ }
43
+ }
44
+
45
+ .documents-hierarchy {
46
+ .al-number-of-children-badge {
47
+ background-color: #eee;
48
+ border: 1px solid #ccc;
49
+ color: $gray-light;
50
+ vertical-align: top;
51
+ }
52
+ }
53
+
54
+ .al-data-range-histogram {
55
+ margin-bottom: $spacer;
56
+ }
57
+
58
+ .blacklight-catalog-index #appliedParams {
59
+ margin-bottom: ($spacer * 3) !important;
60
+ }
61
+
62
+
63
+ // Compact Search Results
64
+ .documents-compact {
65
+ margin-bottom: $spacer;
66
+
67
+ .document {
68
+ border-bottom: $result-item-border-styling;
69
+ padding: $spacer 0;
70
+
71
+ &:first-child {
72
+ border-top: $result-item-border-styling;
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,78 @@
1
+ // Sidebar
2
+ .al-sticky-sidebar {
3
+ position: sticky;
4
+ top: 0;
5
+
6
+ // Separate first-level divs in sidebar
7
+ > div {
8
+ margin-bottom: $spacer;
9
+ }
10
+
11
+ .card-header h3 {
12
+ font-size: $font-size-h6;
13
+ font-weight: $font-weight-normal;
14
+ }
15
+
16
+ // Sidebar sections
17
+ dt {
18
+ color: $gray;
19
+ font-size: $font-size-xs;
20
+ font-weight: $font-weight-bold;
21
+ margin-bottom: 3px;
22
+ text-transform: uppercase;
23
+ }
24
+
25
+ dd {
26
+ line-height: 1.4;
27
+ margin-bottom: $spacer;
28
+ }
29
+
30
+ .al-in-person-repository-name,
31
+ .al-in-person-repository-location {
32
+ font-size: $font-size-sm;
33
+ line-height: 1.25;
34
+ }
35
+
36
+ .al-in-person-repository-name img {
37
+ margin-bottom: $headings-margin-bottom;
38
+ margin-right: $spacer;
39
+ max-height: 65px;
40
+ max-width: 65px;
41
+ }
42
+
43
+ .al-repository-contact-city_state_zip_country {
44
+ margin-bottom: ($spacer / 2);
45
+ }
46
+ }
47
+
48
+ // Collection header
49
+ .al-show-header-section {
50
+ border: $result-item-border-styling;
51
+ margin-bottom: $spacer;
52
+ padding: 0 $spacer;
53
+
54
+ .al-document-title-bar {
55
+ background-color: $gray-lighter;
56
+ border-bottom: $result-item-border-styling;
57
+ font-size: $font-size-sm;
58
+ margin: 0 (-$spacer) $spacer;
59
+ padding: 3px $result-item-body-padding;
60
+ }
61
+
62
+ h1 {
63
+ font-size: $font-size-h4;
64
+ margin-bottom: $spacer;
65
+ }
66
+ }
67
+
68
+ // Collection overview
69
+ .al-show-sub-heading {
70
+ font-size: $font-size-h6;
71
+ text-transform: uppercase;
72
+
73
+ + dl dt {
74
+ font-size: $font-size-xs;
75
+ margin-top: 4px;
76
+ text-transform: uppercase;
77
+ }
78
+ }
@@ -0,0 +1,16 @@
1
+ .al-in-person-repository-location {
2
+ clear: left;
3
+ }
4
+
5
+ .al-digital-object {
6
+ margin-bottom: $spacer;
7
+
8
+ .al-digital-object-label {
9
+ margin-bottom: ($spacer / 2);
10
+ }
11
+ }
12
+
13
+ // Hiding this from display since we don't need it.
14
+ dt.blacklight-digital_objects_ssm {
15
+ display: none;
16
+ }
@@ -0,0 +1,2 @@
1
+ $result-item-body-padding: 12px;
2
+ $result-item-border-styling: 1px solid #ccc;
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Arclight
4
+ # Controller for our /repositories index page
5
+ class RepositoriesController < ApplicationController
6
+ def index
7
+ @repositories = Arclight::Repository.all
8
+ load_collection_counts
9
+ end
10
+
11
+ def show
12
+ @repository = Arclight::Repository.find_by!(slug: params[:id])
13
+ search_service = Blacklight.repository_class.new(blacklight_config)
14
+ @response = search_service.search(
15
+ q: "level_sim:Collection repository_sim:\"#{@repository.name}\"",
16
+ rows: 100
17
+ )
18
+ @collections = @response.documents
19
+ end
20
+
21
+ private
22
+
23
+ def load_collection_counts
24
+ counts = fetch_collection_counts
25
+ @repositories.each do |repository|
26
+ repository.collection_count = counts[repository.name] || 0
27
+ end
28
+ end
29
+
30
+ def fetch_collection_counts
31
+ search_service = Blacklight.repository_class.new(blacklight_config)
32
+ results = search_service.search(
33
+ q: 'level_sim:Collection',
34
+ 'facet.field': 'repository_sim',
35
+ rows: 0
36
+ )
37
+ Hash[*results.facet_fields['repository_sim']]
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Arclight
4
+ ##
5
+ # A module to add configuration helpers for certain fields used by Arclight
6
+ module FieldConfigHelpers
7
+ extend ActiveSupport::Concern
8
+ include ActionView::Helpers::OutputSafetyHelper
9
+ include ActionView::Helpers::TagHelper
10
+
11
+ included do
12
+ if respond_to?(:helper_method)
13
+ helper_method :repository_config_present
14
+ helper_method :request_config_present
15
+ helper_method :context_sidebar_repository
16
+ helper_method :before_you_visit_note_present
17
+ helper_method :context_sidebar_visit_note
18
+ helper_method :context_sidebar_containers_request
19
+ helper_method :item_requestable?
20
+ helper_method :paragraph_separator
21
+ helper_method :link_to_name_facet
22
+ end
23
+ end
24
+
25
+ def repository_config_present(_, document)
26
+ document.repository_config.present?
27
+ end
28
+
29
+ def item_requestable?(_, options)
30
+ document = options[:document]
31
+ request_config_present('', document) && document.containers.present?
32
+ end
33
+
34
+ def request_config_present(var, document)
35
+ repository_config_present(var, document) &&
36
+ document.repository_config.google_request_url.present? &&
37
+ document.repository_config.google_request_mappings.present?
38
+ end
39
+
40
+ def context_sidebar_repository(args)
41
+ document = args[:document]
42
+ ApplicationController.renderer.render(
43
+ 'arclight/repositories/_in_person_repository',
44
+ layout: false,
45
+ locals: { repository: document.repository_config }
46
+ )
47
+ end
48
+
49
+ def before_you_visit_note_present(_, document)
50
+ document.repository_config && document.repository_config.visit_note.present?
51
+ end
52
+
53
+ def context_sidebar_visit_note(args)
54
+ document = args[:document]
55
+ document.repository_config.visit_note
56
+ end
57
+
58
+ def context_sidebar_containers_request(args)
59
+ document = args[:document]
60
+ presenter = Arclight::ShowPresenter.new(document, view_context)
61
+ ApplicationController.renderer.render(
62
+ 'arclight/requests/_google_form',
63
+ layout: false,
64
+ locals: {
65
+ google_form: Arclight::Requests::GoogleForm.new(document, presenter, solr_document_url(document))
66
+ }
67
+ )
68
+ end
69
+
70
+ def paragraph_separator(args)
71
+ safe_join(args[:value].map { |paragraph| content_tag(:p, paragraph) })
72
+ end
73
+
74
+ def link_to_name_facet(args)
75
+ options = args[:config].try(:separator_options) || {}
76
+ values = args[:value] || []
77
+
78
+ values.map do |value|
79
+ view_context.link_to(
80
+ value,
81
+ view_context.search_action_path(f: { names_ssim: [value] })
82
+ )
83
+ end.to_sentence(options).html_safe
84
+ end
85
+ end
86
+ end