arclight 0.0.1 → 1.4.0
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 +44 -0
- data/.gitignore +7 -0
- data/.rspec +0 -1
- data/.rubocop.yml +362 -0
- data/.rubocop_todo.yml +122 -0
- data/.solr_wrapper +5 -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 +57 -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 +40 -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 +32 -0
- data/app/components/arclight/document_components_hierarchy_component.rb +28 -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/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 +15 -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 +19 -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 +159 -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 +334 -0
- data/lib/arclight/traject/ead2_config.rb +315 -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 +126 -0
- data/lib/generators/arclight/templates/arclight.scss +5 -0
- data/lib/generators/arclight/templates/catalog_controller.rb +422 -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 +72 -0
- data/template.rb +10 -0
- metadata +432 -20
- data/.travis.yml +0 -5
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Arclight
|
|
4
|
+
# A range of years that handles gaps, such as [1999, 2000, 2002].
|
|
5
|
+
# Primary usage is:
|
|
6
|
+
# ```
|
|
7
|
+
# range = YearRange.new('1999/2004')
|
|
8
|
+
# range.years => [1999, 2000, 2001, 2002, 2003, 2004]
|
|
9
|
+
# range.to_s => '1999-2004'
|
|
10
|
+
# range << range.parse_ranges(['2010/2010'])
|
|
11
|
+
# range.years => [1999, 2000, 2001, 2002, 2003, 2004, 2010]
|
|
12
|
+
# range.to_s => '1999-2004, 2010'
|
|
13
|
+
# ```
|
|
14
|
+
class YearRange
|
|
15
|
+
attr_accessor :years
|
|
16
|
+
|
|
17
|
+
# @param [Array<String>] `dates` in the form YYYY/YYYY
|
|
18
|
+
def initialize(dates = nil)
|
|
19
|
+
@years = []
|
|
20
|
+
self << parse_ranges(dates) if dates.present?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @return [String] a concise, human-readable version of the year range, including gaps
|
|
24
|
+
def to_s
|
|
25
|
+
return if years.empty?
|
|
26
|
+
return to_s_for_streak(years) unless gaps?
|
|
27
|
+
|
|
28
|
+
to_s_with_gaps
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# @param [Array<Integer>] `other` the set of years to add
|
|
32
|
+
def <<(other)
|
|
33
|
+
return self if other.blank?
|
|
34
|
+
|
|
35
|
+
@years |= other # will remove duplicates
|
|
36
|
+
@years.sort!
|
|
37
|
+
self
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @param [String] `dates` in the form YYYY/YYYY
|
|
41
|
+
# @return [Array<Integer>] the set of years in the given range
|
|
42
|
+
def parse_range(dates)
|
|
43
|
+
return if dates.blank?
|
|
44
|
+
|
|
45
|
+
start_year, end_year = dates.split('/').map { |date| to_year_from_iso8601(date) }
|
|
46
|
+
return [start_year] if end_year.blank?
|
|
47
|
+
raise ArgumentError, "Range is too large: #{dates}" if (end_year - start_year) > 1000
|
|
48
|
+
raise ArgumentError, "Range is inverted: #{dates}" unless start_year <= end_year
|
|
49
|
+
|
|
50
|
+
(start_year..end_year).to_a
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# @param [Array<String>] `dates` in the form YYYY/YYYY
|
|
54
|
+
# @return [Array<Integer>] the set of years in the given range
|
|
55
|
+
def parse_ranges(dates)
|
|
56
|
+
dates.map { |date| parse_range(date) }.flatten.sort.uniq
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @param [String] `date` a date in one of these formats:
|
|
60
|
+
# YYYY, YYYY-MM, YYYY-MM-DD, and YYYYMMDD
|
|
61
|
+
def to_year_from_iso8601(date)
|
|
62
|
+
return if date.blank?
|
|
63
|
+
|
|
64
|
+
date.split('-').first[0..3].to_i # Time.parse doesn't work here
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @return [Boolean] are there gaps between the years, such as 1999, 2000, 2002?
|
|
68
|
+
def gaps?
|
|
69
|
+
return false if years.blank?
|
|
70
|
+
|
|
71
|
+
(years.min..years.max).to_a != years
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
|
|
76
|
+
# Deals with making a human-readable range for years with 1 or more gaps.
|
|
77
|
+
# It involves detection of streaks between the gaps.
|
|
78
|
+
# @return [String] 1999-2000, 2002 for 1999, 2000, 2002
|
|
79
|
+
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
80
|
+
def to_s_with_gaps
|
|
81
|
+
raise ArgumentError if years.blank? || years.length < 2
|
|
82
|
+
|
|
83
|
+
results = []
|
|
84
|
+
streak = [years[0]]
|
|
85
|
+
i = streak.first
|
|
86
|
+
years[1..].each do |j|
|
|
87
|
+
i += 1
|
|
88
|
+
if i == j
|
|
89
|
+
streak << j
|
|
90
|
+
else # we have a gap
|
|
91
|
+
results << if streak.length == 1
|
|
92
|
+
streak.first.to_s
|
|
93
|
+
else
|
|
94
|
+
to_s_for_streak(streak)
|
|
95
|
+
end
|
|
96
|
+
streak = [j]
|
|
97
|
+
i = j
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
results << to_s_for_streak(streak)
|
|
101
|
+
results.join(', ')
|
|
102
|
+
end
|
|
103
|
+
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
104
|
+
|
|
105
|
+
def to_s_for_streak(streak)
|
|
106
|
+
return streak.min.to_s if streak.min == streak.max
|
|
107
|
+
|
|
108
|
+
streak.minmax.map(&:to_s).join('-')
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
data/lib/arclight.rb
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'arclight/version'
|
|
4
|
+
require 'arclight/engine'
|
|
5
|
+
require 'arclight/repository'
|
|
6
|
+
require 'arclight/year_range'
|
|
2
7
|
|
|
8
|
+
# :nodoc:
|
|
3
9
|
module Arclight
|
|
4
|
-
|
|
10
|
+
autoload :Routes, 'arclight/routes'
|
|
11
|
+
|
|
12
|
+
def self.deprecation
|
|
13
|
+
@deprecation ||= ActiveSupport::Deprecation.new('2.0', 'Arclight')
|
|
14
|
+
end
|
|
5
15
|
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'rails/generators'
|
|
4
|
+
|
|
5
|
+
module Arclight
|
|
6
|
+
##
|
|
7
|
+
# Arclight install generator
|
|
8
|
+
class Install < Rails::Generators::Base
|
|
9
|
+
source_root File.expand_path('templates', __dir__)
|
|
10
|
+
|
|
11
|
+
def create_blacklight_catalog
|
|
12
|
+
remove_file 'app/controllers/catalog_controller.rb'
|
|
13
|
+
copy_file 'catalog_controller.rb', 'app/controllers/catalog_controller.rb'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def include_arclight_solrdocument
|
|
17
|
+
inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do
|
|
18
|
+
"\n include Arclight::SolrDocument"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def install_blacklight_locale_picker
|
|
23
|
+
gem 'blacklight-locale_picker'
|
|
24
|
+
|
|
25
|
+
Bundler.with_unbundled_env do
|
|
26
|
+
run 'bundle install'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
generate 'blacklight:locale_picker:install'
|
|
30
|
+
|
|
31
|
+
inject_into_file 'app/helpers/application_helper.rb', after: 'include Blacklight::LocalePicker::LocaleHelper' do
|
|
32
|
+
"\n\n def additional_locale_routing_scopes\n [blacklight, arclight_engine]\n end"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def add_custom_routes
|
|
37
|
+
inject_into_file 'config/routes.rb', after: "mount Blacklight::Engine => '/'" do
|
|
38
|
+
"\n mount Arclight::Engine => '/'\n"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
gsub_file 'config/routes.rb', 'root to: "catalog#index"', 'root to: "arclight/repositories#index"'
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def copy_styles
|
|
45
|
+
copy_file 'arclight.scss', 'app/assets/stylesheets/arclight.scss'
|
|
46
|
+
remove_file 'app/assets/stylesheets/blacklight.scss' # Avoid two copies of bootstrap
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def add_arclight_search_behavior
|
|
50
|
+
inject_into_file 'app/models/search_builder.rb', after: 'include Blacklight::Solr::SearchBuilderBehavior' do
|
|
51
|
+
"\n include Arclight::SearchBehavior"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def solr_config
|
|
56
|
+
directory '../../../../solr', 'solr', force: true
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def add_repository_config
|
|
60
|
+
copy_file 'config/repositories.yml' unless File.exist?('config/repositories.yml')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def add_download_config
|
|
64
|
+
copy_file 'config/downloads.yml' unless File.exist?('config/downloads.yml')
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def add_i18n_config
|
|
68
|
+
copy_file 'config/locales/arclight.en.yml'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def modify_blacklight_yml
|
|
72
|
+
gsub_file 'config/locales/blacklight.en.yml', "application_name: 'Blacklight'", "application_name: 'Arclight'"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def assets
|
|
76
|
+
if using_importmap?
|
|
77
|
+
pin_javascript_dependencies
|
|
78
|
+
import_arclight_javascript
|
|
79
|
+
else
|
|
80
|
+
install_javascript_dependencies
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def inject_arclight_routes
|
|
85
|
+
inject_into_file 'config/routes.rb',
|
|
86
|
+
" concern :hierarchy, Arclight::Routes::Hierarchy.new\n",
|
|
87
|
+
after: /concern :exportable.*\n/
|
|
88
|
+
inject_into_file 'config/routes.rb',
|
|
89
|
+
" concerns :hierarchy\n",
|
|
90
|
+
after: /resources :solr_documents.*\n/
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
private
|
|
94
|
+
|
|
95
|
+
def root
|
|
96
|
+
@root ||= Pathname(destination_root)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def using_importmap?
|
|
100
|
+
@using_importmap ||= root.join('config/importmap.rb').exist?
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# This is the last step because any failure here wouldn't prevent the other steps from running
|
|
104
|
+
def install_javascript_dependencies
|
|
105
|
+
inject_into_file 'app/assets/javascripts/application.js', after: '//= require blacklight/blacklight' do
|
|
106
|
+
"\n// Required by Arclight" \
|
|
107
|
+
"\n//= require arclight/arclight"
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def pin_javascript_dependencies
|
|
112
|
+
say 'Arclight Importmap asset generation'
|
|
113
|
+
|
|
114
|
+
append_to_file 'config/importmap.rb', <<~RUBY
|
|
115
|
+
pin "arclight", to: "arclight/arclight.js"
|
|
116
|
+
# TODO: We may be able to move these to a single importmap for arclight.
|
|
117
|
+
pin "arclight/oembed_controller", to: "arclight/oembed_controller.js"
|
|
118
|
+
pin "arclight/truncate_controller", to: "arclight/truncate_controller.js"
|
|
119
|
+
RUBY
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def import_arclight_javascript
|
|
123
|
+
append_to_file 'app/javascript/application.js', "\nimport \"arclight\""
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|