diff --git a/Gemfile b/Gemfile index e9946bd4..06c68728 100644 --- a/Gemfile +++ b/Gemfile @@ -74,7 +74,7 @@ group :deployment do end gem 'blacklight', '~> 7.14' -gem 'blacklight-spotlight', '~> 3.1' +gem 'blacklight-spotlight', '~> 3.1', github: 'projectblacklight/spotlight', branch: 'nestable' gem 'twitter-typeahead-rails', '0.11.1.pre.corejavascript' gem 'friendly_id' @@ -111,3 +111,5 @@ gem 'cache_with_locale' gem 'i18n-js', '< 4' # v4 was a complete rewrite; will take some work to update gem 'i18n-tasks' + +gem 'importmap-rails', '~> 1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 08d2b80c..25770a48 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,48 @@ +GIT + remote: https://github.com/projectblacklight/spotlight.git + revision: 3175f09046db7da5217c316e1e9644bf5e3353fc + branch: nestable + specs: + blacklight-spotlight (3.5.0.2) + activejob-status + acts-as-taggable-on (>= 5.0, < 10) + autoprefixer-rails + blacklight (>= 7.18, < 9) + blacklight-gallery (>= 3.0, < 5) + bootstrap_form (~> 4.1) + breadcrumbs_on_rails (>= 3.0, < 5) + cancancan + carrierwave (~> 2.2) + clipboard-rails (~> 1.5) + devise (~> 4.1) + devise_invitable + faraday + faraday-follow_redirects + friendly_id (~> 5.5) + github-markup + handlebars_assets + i18n + i18n-active_record + iiif-presentation + iiif_manifest + leaflet-rails + legato + mini_magick + nokogiri + oauth2 + openseadragon + ostruct (!= 0.3.2, != 0.3.1, != 0.3.0) + paper_trail (>= 11.0, < 13) + rails (>= 6.1, < 8) + redcarpet (>= 2.0.1, < 4) + riiif (~> 2.0) + roar (~> 1.1) + roar-rails + signet + sprockets (>= 4) + tophat + view_component (~> 2.0) + GEM remote: https://rubygems.org/ specs: @@ -94,10 +139,6 @@ GEM aws-sigv4 (~> 1.4) aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) - babel-source (5.8.35) - babel-transpiler (0.7.0) - babel-source (>= 4.0, < 6) - execjs (~> 2.0) bcrypt (3.1.18) better_html (2.0.1) actionview (>= 6.0) @@ -128,47 +169,6 @@ GEM blacklight (>= 7.0, < 9) rails ruby-oembed - blacklight-spotlight (3.5.0.2) - activejob-status - acts-as-taggable-on (>= 5.0, < 10) - autoprefixer-rails - blacklight (~> 7.18) - blacklight-gallery (>= 3.0, < 5) - bootstrap_form (~> 4.1) - breadcrumbs_on_rails (>= 3.0, < 5) - cancancan - carrierwave (~> 2.2) - clipboard-rails (~> 1.5) - devise (~> 4.1) - devise_invitable - faraday - faraday_middleware - friendly_id (~> 5.2, != 5.4.1, != 5.4.0) - github-markup - handlebars_assets - i18n - i18n-active_record - iiif-presentation - iiif_manifest - leaflet-rails - legato - mini_magick - nokogiri - oauth2 - openseadragon - ostruct (!= 0.3.2, != 0.3.1, != 0.3.0) - paper_trail (>= 11.0, < 13) - rails (>= 6.1, < 8) - redcarpet (>= 2.0.1, < 4) - riiif (~> 2.0) - roar (~> 1.1) - roar-rails - signet - sprockets (>= 3) - sprockets-es6 - thor - tophat - underscore-rails (~> 1.6) blacklight_range_limit (8.2.3) blacklight (>= 7.25.2, < 9) bootsnap (1.16.0) @@ -305,31 +305,12 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (1.10.3) - faraday-em_http (~> 1.0) - faraday-em_synchrony (~> 1.0) - faraday-excon (~> 1.1) - faraday-httpclient (~> 1.0) - faraday-multipart (~> 1.0) - faraday-net_http (~> 1.0) - faraday-net_http_persistent (~> 1.0) - faraday-patron (~> 1.0) - faraday-rack (~> 1.0) - faraday-retry (~> 1.0) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-em_http (1.0.0) - faraday-em_synchrony (1.0.0) - faraday-excon (1.1.0) - faraday-httpclient (1.0.1) - faraday-multipart (1.0.4) - multipart-post (~> 2) - faraday-net_http (1.0.1) - faraday-net_http_persistent (1.2.0) - faraday-patron (1.0.0) - faraday-rack (1.0.0) - faraday-retry (1.0.3) - faraday_middleware (1.2.0) - faraday (~> 1.0) + faraday-follow_redirects (0.3.0) + faraday (>= 1, < 3) + faraday-net_http (3.0.2) ffi (1.15.5) ffi-compiler (1.0.1) ffi (>= 1.0.0) @@ -380,11 +361,14 @@ GEM activesupport (>= 3.2.18) faraday (>= 0.9) json - iiif_manifest (1.3.0) + iiif_manifest (1.3.1) activesupport (>= 4) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + importmap-rails (1.1.5) + actionpack (>= 6.0.0) + railties (>= 6.0.0) io-console (0.6.0) irb (1.6.2) reline (>= 0.3.0) @@ -440,7 +424,6 @@ GEM msgpack (1.6.0) multi_json (1.15.0) multi_xml (0.6.0) - multipart-post (2.3.0) net-imap (0.3.4) date net-protocol @@ -667,10 +650,6 @@ GEM sprockets (4.2.0) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-es6 (0.9.2) - babel-source (>= 5.8.11) - babel-transpiler - sprockets (>= 3.0.0) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) @@ -704,7 +683,6 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) uber (0.1.0) - underscore-rails (1.8.3) unf (0.1.4) unf_ext unf_ext (0.0.8.2) @@ -744,7 +722,7 @@ DEPENDENCIES blacklight-gallery (~> 4.0) blacklight-hierarchy blacklight-oembed (>= 0.1.0) - blacklight-spotlight (~> 3.1) + blacklight-spotlight (~> 3.1)! blacklight_range_limit (~> 8.0) bootsnap (>= 1.4.4) bootstrap (~> 4.0) @@ -767,6 +745,7 @@ DEPENDENCIES i18n-js (< 4) i18n-tasks iiif-presentation (~> 1.0) + importmap-rails (~> 1.1) jbuilder (~> 2.7) jquery-rails lograge diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index cb4ddbfc..866996be 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,3 +1,10 @@ //= link_tree ../images -//= link_directory ../javascripts .js //= link application.css +//= link spotlight/manifest.js +//= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js + +// needed for import map pin_all_under +//= link spotlight/application.js +//= link spotlight/spotlight.esm.js +//= link spotlight/spotlight.js \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js deleted file mode 100644 index a1e0dd83..00000000 --- a/app/assets/javascripts/application.js +++ /dev/null @@ -1,32 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's -// vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. JavaScript code in this file should be added after the last require_* statement. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require rails-ujs -//= require turbolinks -// -// -// Required by Blacklight -//= require jquery3 -//= require popper -//= require twitter/typeahead -//= require bootstrap -//= require bootstrap/util -//= require blacklight/blacklight - -//= require transform_result -//= require i18n/translations -//= require_tree . - - -// For blacklight_range_limit built-in JS, if you don't want it you don't need -// this: -//= require 'blacklight_range_limit' diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 00000000..17fa9b57 --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,45 @@ +// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails +import jQuery from 'jquery' +window.jQuery = jQuery +window.$ = jQuery + +console.log("JQURY imported") +import 'bootstrap' +import "@hotwired/turbo-rails" +import L from 'leaflet' +window.L = L +import SirTrevor from 'sir-trevor' +window.SirTrevor = SirTrevor +import Clipboard from 'clipboard' +window.Clipboard = Clipboard + +// We can probably ditch this dynamic import once we use Blacklight 8 +import('blacklight/blacklight') +import('spotlight/spotlight.esm').then((Spotlight)=> { + console.log('spotlight defined') + window.Spotlight = Spotlight +}) + +import {I18n} from 'i18n-js' +window.I18n = I18n + +//= require rails-ujs +//= require turbolinks +// +// +// Required by Blacklight +//= require jquery3 +//= require popper +//= require twitter/typeahead +//= require bootstrap +//= require bootstrap/util +//= require blacklight/blacklight + +//= require transform_result +//= require i18n/translations +// require_tree . + + +// For blacklight_range_limit built-in JS, if you don't want it you don't need +// this: +//= require 'blacklight_range_limit' \ No newline at end of file diff --git a/app/views/layouts/spotlight/base.html.erb b/app/views/layouts/spotlight/base.html.erb new file mode 100644 index 00000000..1103a7a9 --- /dev/null +++ b/app/views/layouts/spotlight/base.html.erb @@ -0,0 +1,54 @@ + +<%= content_tag :html, class: 'no-js', **(try(:html_tag_attributes) || {}) do %> +
+ + + + <%= render partial: 'shared/analytics' %> +