From ec6b4aa2002395becdcd756d49bdb4161319748f Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 2 Oct 2023 10:36:33 -0500 Subject: [PATCH] Update to jsbundling-rails --- .gitignore | 5 + Gemfile | 2 + Gemfile.lock | 3 + Procfile.dev | 2 + README.md | 6 +- app/assets/builds/.keep | 0 app/assets/config/manifest.js | 1 + app/assets/javascripts/application.js | 39 ---- app/assets/javascripts/eds_range_limit.js | 74 ------- .../alternate_catalog.js | 5 +- .../javascripts => javascript}/analytics.js | 0 app/javascript/application.js | 61 ++++++ .../javascripts => javascript}/article.js | 0 .../async_collection_members.js | 0 .../backend_lookup.js | 0 .../blacklight_hierarchy.js | 0 .../bootstrap-modal-addon.js | 0 .../course_reserves.js | 0 app/javascript/eds_range_limit.js | 67 ++++++ .../embedded-call-number-browse.js | 2 + .../exhibitPanel.js | 11 +- .../facet-options-checkboxes.js | 0 .../feedback_form.js | 0 .../home_page_facet_collapse.js | 0 .../jquery.accordion-section.js | 0 .../jquery.clear-input-text.js | 0 .../jquery.libraryh3lp.js | 0 .../jquery.live-lookup.js | 0 .../jquery.long-lists.js | 0 .../jquery.managed-purl.js | 0 .../jquery.plug-google-content.js | 0 .../jquery.preview-brief.js | 2 + .../jquery.preview-embed-browse.js | 2 + .../jquery.preview-filmstrip.js | 2 + .../jquery.preview-gallery.js | 2 + .../jquery.purl-embed.js | 0 .../jquery.side-nav-minimap.js | 0 .../jquery.stackmap.js | 0 .../jquery.turbolinks-cursor.js | 0 .../location-hours.js | 0 .../preview-content.js | 4 +- .../recent-selections.js | 0 .../search-context.js | 0 .../javascripts => javascript}/select-all.js | 0 .../javascripts => javascript}/sfx-panel.js | 0 .../javascripts => javascript}/skip-to-nav.js | 0 .../javascripts => javascript}/tooltip.js | 0 .../javascripts => javascript}/truncate.js | 0 .../update-hidden-inputs-by-checkbox.js | 0 .../javascript/vendor}/jquery-scrollspy.js | 0 .../javascript/vendor}/responsiveTruncator.js | 0 .../javascript/vendor}/trunk8.js | 0 app/views/layouts/searchworks.html.erb | 9 +- bin/dev | 11 + package.json | 17 ++ yarn.lock | 197 ++++++++++++++++++ 56 files changed, 394 insertions(+), 130 deletions(-) create mode 100644 Procfile.dev create mode 100644 app/assets/builds/.keep delete mode 100644 app/assets/javascripts/application.js delete mode 100644 app/assets/javascripts/eds_range_limit.js rename app/{assets/javascripts => javascript}/alternate_catalog.js (97%) rename app/{assets/javascripts => javascript}/analytics.js (100%) create mode 100644 app/javascript/application.js rename app/{assets/javascripts => javascript}/article.js (100%) rename app/{assets/javascripts => javascript}/async_collection_members.js (100%) rename app/{assets/javascripts => javascript}/backend_lookup.js (100%) rename app/{assets/javascripts => javascript}/blacklight_hierarchy.js (100%) rename app/{assets/javascripts => javascript}/bootstrap-modal-addon.js (100%) rename app/{assets/javascripts => javascript}/course_reserves.js (100%) create mode 100644 app/javascript/eds_range_limit.js rename app/{assets/javascripts => javascript}/embedded-call-number-browse.js (99%) rename app/{assets/javascripts => javascript}/exhibitPanel.js (97%) rename app/{assets/javascripts => javascript}/facet-options-checkboxes.js (100%) rename app/{assets/javascripts => javascript}/feedback_form.js (100%) rename app/{assets/javascripts => javascript}/home_page_facet_collapse.js (100%) rename app/{assets/javascripts => javascript}/jquery.accordion-section.js (100%) rename app/{assets/javascripts => javascript}/jquery.clear-input-text.js (100%) rename app/{assets/javascripts => javascript}/jquery.libraryh3lp.js (100%) rename app/{assets/javascripts => javascript}/jquery.live-lookup.js (100%) rename app/{assets/javascripts => javascript}/jquery.long-lists.js (100%) rename app/{assets/javascripts => javascript}/jquery.managed-purl.js (100%) rename app/{assets/javascripts => javascript}/jquery.plug-google-content.js (100%) rename app/{assets/javascripts => javascript}/jquery.preview-brief.js (97%) rename app/{assets/javascripts => javascript}/jquery.preview-embed-browse.js (98%) rename app/{assets/javascripts => javascript}/jquery.preview-filmstrip.js (98%) rename app/{assets/javascripts => javascript}/jquery.preview-gallery.js (99%) rename app/{assets/javascripts => javascript}/jquery.purl-embed.js (100%) rename app/{assets/javascripts => javascript}/jquery.side-nav-minimap.js (100%) rename app/{assets/javascripts => javascript}/jquery.stackmap.js (100%) rename app/{assets/javascripts => javascript}/jquery.turbolinks-cursor.js (100%) rename app/{assets/javascripts => javascript}/location-hours.js (100%) rename app/{assets/javascripts => javascript}/preview-content.js (97%) rename app/{assets/javascripts => javascript}/recent-selections.js (100%) rename app/{assets/javascripts => javascript}/search-context.js (100%) rename app/{assets/javascripts => javascript}/select-all.js (100%) rename app/{assets/javascripts => javascript}/sfx-panel.js (100%) rename app/{assets/javascripts => javascript}/skip-to-nav.js (100%) rename app/{assets/javascripts => javascript}/tooltip.js (100%) rename app/{assets/javascripts => javascript}/truncate.js (100%) rename app/{assets/javascripts => javascript}/update-hidden-inputs-by-checkbox.js (100%) rename {vendor/assets/javascripts => app/javascript/vendor}/jquery-scrollspy.js (100%) rename {vendor/assets/javascripts => app/javascript/vendor}/responsiveTruncator.js (100%) rename {vendor/assets/javascripts => app/javascript/vendor}/trunk8.js (100%) create mode 100755 bin/dev create mode 100644 package.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index a5427e1e3..a4504058a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,8 @@ config/environments/*.local.yml /.ruby-version /.byebug_history /spec/examples.txt + +/app/assets/builds/* +!/app/assets/builds/.keep + +/node_modules diff --git a/Gemfile b/Gemfile index 799f2b48f..9fe805377 100644 --- a/Gemfile +++ b/Gemfile @@ -109,3 +109,5 @@ gem 'global_alerts' gem 'view_component', '< 2.75' gem "parslet", "~> 2.0" + +gem "jsbundling-rails", "~> 1.2" diff --git a/Gemfile.lock b/Gemfile.lock index 0fec50647..d532a7430 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -310,6 +310,8 @@ GEM jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) + jsbundling-rails (1.2.1) + railties (>= 6.0.0) json (2.7.1) jwt (2.7.1) kaminari (1.2.2) @@ -676,6 +678,7 @@ DEPENDENCIES global_alerts honeybadger jbuilder (~> 2.7) + jsbundling-rails (~> 1.2) launchy leaflet-rails letter_opener diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 000000000..b19ff761b --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,2 @@ +web: env RUBY_DEBUG_OPEN=true bin/rails server +js: yarn build --watch diff --git a/README.md b/README.md index 80da6aa99..09d8fb7c4 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ To start Solr, you can use the `solr_wrapper` command. However, if starting from Start the rails app - $ rails s + $ bin/dev ## Getting data in development @@ -37,9 +37,9 @@ For fixture data, you can run `solr_wrapper` locally as above, and populate samp ## "Logging in" as a User in development -Given that this app is using shibboleth + devise for login, it can be tricky to get a user context set. The user itself can be set by starting rails with a `REMOTE_USER` env var set (e.g. `REMOTE_USER=jstanford rails s`). +Given that this app is using shibboleth + devise for login, it can be tricky to get a user context set. The user itself can be set by starting rails with a `REMOTE_USER` env var set (e.g. `REMOTE_USER=jstanford bin/dev`). -If you need to set your affiliation attribute (e.g. `stanford:staff`) for things like testing article search, you can start rails with a `suAffiliation` env var set (e.g. `REMOTE_USER=jstanford suAffiliation=stanford:staff rails s`). +If you need to set your affiliation attribute (e.g. `stanford:staff`) for things like testing article search, you can start rails with a `suAffiliation` env var set (e.g. `REMOTE_USER=jstanford suAffiliation=stanford:staff bin/dev`). One caveat to this is that you may still need to go through the login path `/sso/login` in order to ensure proper session setup (e.g. eds guest flag set). diff --git a/app/assets/builds/.keep b/app/assets/builds/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 7ad58c226..05f0adab6 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -3,3 +3,4 @@ //= link application.js //= link application.css //= link print.css +//= link_tree ../builds diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js deleted file mode 100644 index fa3fff3a1..000000000 --- a/app/assets/javascripts/application.js +++ /dev/null @@ -1,39 +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, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, 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. -// -// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details -// about supported directives. -// - -//= require rails-ujs -//= require turbolinks -//= require responsiveTruncator -//= require trunk8 -//= require jquery-scrollspy -//= require leaflet -// -// Required by Blacklight - -//= require popper -//= require bootstrap -//= require blacklight/blacklight - -// For blacklight_range_limit built-in JS, if you don't want it you don't need -// this: -//= require 'blacklight_range_limit' - -//= require_tree . - -// Prevent the back-button from trying to add a second instance of recaptcha -// See https://github.com/ambethia/recaptcha/issues/217#issuecomment-615221808 -document.addEventListener("turbolinks:before-cache", function () { - // On the articles page there is a feedback and a connection form. - // Both have a recaptcha that needs clearing. - document.querySelectorAll(".g-recaptcha").forEach((elem) => elem.innerHTML = ""); -}); diff --git a/app/assets/javascripts/eds_range_limit.js b/app/assets/javascripts/eds_range_limit.js deleted file mode 100644 index b1fa2fbd3..000000000 --- a/app/assets/javascripts/eds_range_limit.js +++ /dev/null @@ -1,74 +0,0 @@ -(function( global) { - 'use strict'; - var EdsRangeLimit; - - EdsRangeLimit = { - init: function(el) { - var $el = $(el); - var data = $el.data(); - var $begin = $el.find('input.range_begin'); - var $end = $el.find('input.range_end'); - var min = data.edsDateMin; - var max = data.edsDateMax; - var begin = data.edsDateBegin; - var end = data.edsDateEnd; - var $target = $($el.find('.eds-slider')[0]); - - // Much of this is a copy from BlacklightRangeLimit so that the experience - // stays consistant - var placeholder_input = $('').appendTo($target); - - if (placeholder_input.slider !== undefined) { - placeholder_input.slider({ - min: data.edsDateMin, - max: data.edsDateMax, - value: [begin, end], - tooltip: 'hide' - }); - } - - // Update css to 100% - $target.find('.slider').css('width', '100%'); - - $begin.val(begin); - $end.val(end); - - // Handle slider changes - placeholder_input.slider().on('slide', function(e) { - $begin.val(e.value[0]) - $end.val(e.value[1]) - }); - - // Handle when form updates - $begin.change(function() { - var val = BlacklightRangeLimit.parseNum($(this).val()); - if ( isNaN(val) || val < min) { - //for weird data, set slider at min - val = min; - } - var values = placeholder_input.data('slider').getValue(); - values[0] = val; - placeholder_input.slider('setValue', values); - }); - - $end.change(function() { - var val = BlacklightRangeLimit.parseNum($(this).val()); - if ( isNaN(val) || val > max) { - //for weird data, set slider at max - val = max; - } - var values = placeholder_input.data('slider').getValue(); - values[1] = val; - placeholder_input.slider('setValue', values); - }); - } - } - - global.EdsRangeLimit = EdsRangeLimit; -})(this); - -Blacklight.onLoad(function() { - $('.eds_range_slider').each(function(i, element) { - EdsRangeLimit.init(element); - }) -}); diff --git a/app/assets/javascripts/alternate_catalog.js b/app/javascript/alternate_catalog.js similarity index 97% rename from app/assets/javascripts/alternate_catalog.js rename to app/javascript/alternate_catalog.js index b20a812fb..185e73764 100644 --- a/app/assets/javascripts/alternate_catalog.js +++ b/app/javascript/alternate_catalog.js @@ -1,5 +1,5 @@ -(function (global) { - var AlternateCatalog = { +const AlternateCatalog = (function (global) { + return { container: null, titleElement: null, @@ -120,7 +120,6 @@ return facetLinks } - global.AlternateCatalog = AlternateCatalog; }(this)); Blacklight.onLoad(function () { diff --git a/app/assets/javascripts/analytics.js b/app/javascript/analytics.js similarity index 100% rename from app/assets/javascripts/analytics.js rename to app/javascript/analytics.js diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 000000000..18d860d8c --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,61 @@ +// Entry point for the build script in your packageon + +import "rails-ujs"; +import "turbolinks"; +import "./vendor/responsiveTruncator"; +import "./vendor/trunk8"; +import "./vendor/jquery-scrollspy"; +import "leaflet"; +// import "popper.js"; +// import "bootstrap"; +import "blacklight-frontend/app/assets/javascripts/blacklight/blacklight"; +import "blacklight-range-limit"; +import "blacklight-range-limit/vendor/assets/javascripts/bootstrap-slider" + +import "./alternate_catalog"; +import "./analytics"; +import "./article"; +import "./async_collection_members"; +import "./backend_lookup"; +import "./blacklight_hierarchy"; +import "./bootstrap-modal-addon"; +import "./course_reserves"; +import "./eds_range_limit"; +import "./embedded-call-number-browse"; +import "./exhibitPanel"; +import "./facet-options-checkboxes"; +import "./feedback_form"; +import "./home_page_facet_collapse"; +import "./jquery.accordion-section"; +import "./jquery.clear-input-text"; +import "./jquery.libraryh3lp"; +import "./jquery.live-lookup"; +import "./jquery.long-lists"; +import "./jquery.managed-purl"; +import "./jquery.plug-google-content"; +import "./jquery.preview-brief"; +import "./jquery.preview-embed-browse"; +import "./jquery.preview-filmstrip"; +import "./jquery.preview-gallery"; +import "./jquery.purl-embed"; +import "./jquery.side-nav-minimap"; +import "./jquery.stackmap"; +import "./jquery.turbolinks-cursor"; +import "./location-hours"; +import "./preview-content"; +import "./recent-selections"; +import "./search-context"; +import "./select-all"; +import "./sfx-panel"; +import "./skip-to-nav"; +import "./tooltip"; +import "./truncate"; +import "./update-hidden-inputs-by-checkbox"; + +// Prevent the back-button from trying to add a second instance of recaptcha +// See https://github.com/ambethia/recaptcha/issues/217#issuecomment-615221808 +document.addEventListener("turbolinks:before-cache", function () { + // On the articles page there is a feedback and a connection form. + // Both have a recaptcha that needs clearing. + document.querySelectorAll(".g-recaptcha").forEach((elem) => elem.innerHTML = ""); +}); \ No newline at end of file diff --git a/app/assets/javascripts/article.js b/app/javascript/article.js similarity index 100% rename from app/assets/javascripts/article.js rename to app/javascript/article.js diff --git a/app/assets/javascripts/async_collection_members.js b/app/javascript/async_collection_members.js similarity index 100% rename from app/assets/javascripts/async_collection_members.js rename to app/javascript/async_collection_members.js diff --git a/app/assets/javascripts/backend_lookup.js b/app/javascript/backend_lookup.js similarity index 100% rename from app/assets/javascripts/backend_lookup.js rename to app/javascript/backend_lookup.js diff --git a/app/assets/javascripts/blacklight_hierarchy.js b/app/javascript/blacklight_hierarchy.js similarity index 100% rename from app/assets/javascripts/blacklight_hierarchy.js rename to app/javascript/blacklight_hierarchy.js diff --git a/app/assets/javascripts/bootstrap-modal-addon.js b/app/javascript/bootstrap-modal-addon.js similarity index 100% rename from app/assets/javascripts/bootstrap-modal-addon.js rename to app/javascript/bootstrap-modal-addon.js diff --git a/app/assets/javascripts/course_reserves.js b/app/javascript/course_reserves.js similarity index 100% rename from app/assets/javascripts/course_reserves.js rename to app/javascript/course_reserves.js diff --git a/app/javascript/eds_range_limit.js b/app/javascript/eds_range_limit.js new file mode 100644 index 000000000..6abd0c0f5 --- /dev/null +++ b/app/javascript/eds_range_limit.js @@ -0,0 +1,67 @@ +const EdsRangeLimit = { + init: function(el) { + var $el = $(el); + var data = $el.data(); + var $begin = $el.find('input.range_begin'); + var $end = $el.find('input.range_end'); + var min = data.edsDateMin; + var max = data.edsDateMax; + var begin = data.edsDateBegin; + var end = data.edsDateEnd; + var $target = $($el.find('.eds-slider')[0]); + + // Much of this is a copy from BlacklightRangeLimit so that the experience + // stays consistant + var placeholder_input = $('').appendTo($target); + + if (placeholder_input.slider !== undefined) { + placeholder_input.slider({ + min: data.edsDateMin, + max: data.edsDateMax, + value: [begin, end], + tooltip: 'hide' + }); + } + + // Update css to 100% + $target.find('.slider').css('width', '100%'); + + $begin.val(begin); + $end.val(end); + + // Handle slider changes + placeholder_input.slider().on('slide', function(e) { + $begin.val(e.value[0]) + $end.val(e.value[1]) + }); + + // Handle when form updates + $begin.change(function() { + var val = BlacklightRangeLimit.parseNum($(this).val()); + if ( isNaN(val) || val < min) { + //for weird data, set slider at min + val = min; + } + var values = placeholder_input.data('slider').getValue(); + values[0] = val; + placeholder_input.slider('setValue', values); + }); + + $end.change(function() { + var val = BlacklightRangeLimit.parseNum($(this).val()); + if ( isNaN(val) || val > max) { + //for weird data, set slider at max + val = max; + } + var values = placeholder_input.data('slider').getValue(); + values[1] = val; + placeholder_input.slider('setValue', values); + }); + } +} + +Blacklight.onLoad(function() { + $('.eds_range_slider').each(function(i, element) { + EdsRangeLimit.init(element); + }) +}); diff --git a/app/assets/javascripts/embedded-call-number-browse.js b/app/javascript/embedded-call-number-browse.js similarity index 99% rename from app/assets/javascripts/embedded-call-number-browse.js rename to app/javascript/embedded-call-number-browse.js index c7f68cad3..8e85279df 100644 --- a/app/assets/javascripts/embedded-call-number-browse.js +++ b/app/javascript/embedded-call-number-browse.js @@ -1,3 +1,5 @@ +import PreviewContent from './preview-content' + (function($) { /* diff --git a/app/assets/javascripts/exhibitPanel.js b/app/javascript/exhibitPanel.js similarity index 97% rename from app/assets/javascripts/exhibitPanel.js rename to app/javascript/exhibitPanel.js index 57d78739a..d8a1a007f 100644 --- a/app/assets/javascripts/exhibitPanel.js +++ b/app/javascript/exhibitPanel.js @@ -1,8 +1,4 @@ -(function( global) { - 'use strict'; - var ExhibitsPanel; - - ExhibitsPanel = { +const ExhibitsPanel = { panel: null, druid: null, exhibitsHost: null, @@ -138,10 +134,7 @@ return wrapper; } - } - - global.ExhibitsPanel = ExhibitsPanel; -})(this); +} Blacklight.onLoad(function() { $('[data-behavior="exhibits-panel"]').each(function(i, element) { diff --git a/app/assets/javascripts/facet-options-checkboxes.js b/app/javascript/facet-options-checkboxes.js similarity index 100% rename from app/assets/javascripts/facet-options-checkboxes.js rename to app/javascript/facet-options-checkboxes.js diff --git a/app/assets/javascripts/feedback_form.js b/app/javascript/feedback_form.js similarity index 100% rename from app/assets/javascripts/feedback_form.js rename to app/javascript/feedback_form.js diff --git a/app/assets/javascripts/home_page_facet_collapse.js b/app/javascript/home_page_facet_collapse.js similarity index 100% rename from app/assets/javascripts/home_page_facet_collapse.js rename to app/javascript/home_page_facet_collapse.js diff --git a/app/assets/javascripts/jquery.accordion-section.js b/app/javascript/jquery.accordion-section.js similarity index 100% rename from app/assets/javascripts/jquery.accordion-section.js rename to app/javascript/jquery.accordion-section.js diff --git a/app/assets/javascripts/jquery.clear-input-text.js b/app/javascript/jquery.clear-input-text.js similarity index 100% rename from app/assets/javascripts/jquery.clear-input-text.js rename to app/javascript/jquery.clear-input-text.js diff --git a/app/assets/javascripts/jquery.libraryh3lp.js b/app/javascript/jquery.libraryh3lp.js similarity index 100% rename from app/assets/javascripts/jquery.libraryh3lp.js rename to app/javascript/jquery.libraryh3lp.js diff --git a/app/assets/javascripts/jquery.live-lookup.js b/app/javascript/jquery.live-lookup.js similarity index 100% rename from app/assets/javascripts/jquery.live-lookup.js rename to app/javascript/jquery.live-lookup.js diff --git a/app/assets/javascripts/jquery.long-lists.js b/app/javascript/jquery.long-lists.js similarity index 100% rename from app/assets/javascripts/jquery.long-lists.js rename to app/javascript/jquery.long-lists.js diff --git a/app/assets/javascripts/jquery.managed-purl.js b/app/javascript/jquery.managed-purl.js similarity index 100% rename from app/assets/javascripts/jquery.managed-purl.js rename to app/javascript/jquery.managed-purl.js diff --git a/app/assets/javascripts/jquery.plug-google-content.js b/app/javascript/jquery.plug-google-content.js similarity index 100% rename from app/assets/javascripts/jquery.plug-google-content.js rename to app/javascript/jquery.plug-google-content.js diff --git a/app/assets/javascripts/jquery.preview-brief.js b/app/javascript/jquery.preview-brief.js similarity index 97% rename from app/assets/javascripts/jquery.preview-brief.js rename to app/javascript/jquery.preview-brief.js index 072c11dd3..3119a0c61 100644 --- a/app/assets/javascripts/jquery.preview-brief.js +++ b/app/javascript/jquery.preview-brief.js @@ -1,3 +1,5 @@ +import PreviewContent from './preview-content' + (function($) { /* diff --git a/app/assets/javascripts/jquery.preview-embed-browse.js b/app/javascript/jquery.preview-embed-browse.js similarity index 98% rename from app/assets/javascripts/jquery.preview-embed-browse.js rename to app/javascript/jquery.preview-embed-browse.js index 69af42f3d..4c14ff19c 100644 --- a/app/assets/javascripts/jquery.preview-embed-browse.js +++ b/app/javascript/jquery.preview-embed-browse.js @@ -1,3 +1,5 @@ +import PreviewContent from './preview-content' + (function($) { /* diff --git a/app/assets/javascripts/jquery.preview-filmstrip.js b/app/javascript/jquery.preview-filmstrip.js similarity index 98% rename from app/assets/javascripts/jquery.preview-filmstrip.js rename to app/javascript/jquery.preview-filmstrip.js index a21c9b9b2..168d6bdfb 100644 --- a/app/assets/javascripts/jquery.preview-filmstrip.js +++ b/app/javascript/jquery.preview-filmstrip.js @@ -1,3 +1,5 @@ +import PreviewContent from './preview-content' + (function($) { /* diff --git a/app/assets/javascripts/jquery.preview-gallery.js b/app/javascript/jquery.preview-gallery.js similarity index 99% rename from app/assets/javascripts/jquery.preview-gallery.js rename to app/javascript/jquery.preview-gallery.js index 79796d0d9..194d9b049 100644 --- a/app/assets/javascripts/jquery.preview-gallery.js +++ b/app/javascript/jquery.preview-gallery.js @@ -1,3 +1,5 @@ +import PreviewContent from './preview-content' + (function($) { /* diff --git a/app/assets/javascripts/jquery.purl-embed.js b/app/javascript/jquery.purl-embed.js similarity index 100% rename from app/assets/javascripts/jquery.purl-embed.js rename to app/javascript/jquery.purl-embed.js diff --git a/app/assets/javascripts/jquery.side-nav-minimap.js b/app/javascript/jquery.side-nav-minimap.js similarity index 100% rename from app/assets/javascripts/jquery.side-nav-minimap.js rename to app/javascript/jquery.side-nav-minimap.js diff --git a/app/assets/javascripts/jquery.stackmap.js b/app/javascript/jquery.stackmap.js similarity index 100% rename from app/assets/javascripts/jquery.stackmap.js rename to app/javascript/jquery.stackmap.js diff --git a/app/assets/javascripts/jquery.turbolinks-cursor.js b/app/javascript/jquery.turbolinks-cursor.js similarity index 100% rename from app/assets/javascripts/jquery.turbolinks-cursor.js rename to app/javascript/jquery.turbolinks-cursor.js diff --git a/app/assets/javascripts/location-hours.js b/app/javascript/location-hours.js similarity index 100% rename from app/assets/javascripts/location-hours.js rename to app/javascript/location-hours.js diff --git a/app/assets/javascripts/preview-content.js b/app/javascript/preview-content.js similarity index 97% rename from app/assets/javascripts/preview-content.js rename to app/javascript/preview-content.js index 817afefcd..f713a5432 100644 --- a/app/assets/javascripts/preview-content.js +++ b/app/javascript/preview-content.js @@ -3,7 +3,7 @@ caching of fetched preview content in browser */ -var PreviewContent = (function() { +const PreviewContent = (function() { var useCache = true, insertType; @@ -95,3 +95,5 @@ var PreviewContent = (function() { }; }()); + +export default PreviewContent; \ No newline at end of file diff --git a/app/assets/javascripts/recent-selections.js b/app/javascript/recent-selections.js similarity index 100% rename from app/assets/javascripts/recent-selections.js rename to app/javascript/recent-selections.js diff --git a/app/assets/javascripts/search-context.js b/app/javascript/search-context.js similarity index 100% rename from app/assets/javascripts/search-context.js rename to app/javascript/search-context.js diff --git a/app/assets/javascripts/select-all.js b/app/javascript/select-all.js similarity index 100% rename from app/assets/javascripts/select-all.js rename to app/javascript/select-all.js diff --git a/app/assets/javascripts/sfx-panel.js b/app/javascript/sfx-panel.js similarity index 100% rename from app/assets/javascripts/sfx-panel.js rename to app/javascript/sfx-panel.js diff --git a/app/assets/javascripts/skip-to-nav.js b/app/javascript/skip-to-nav.js similarity index 100% rename from app/assets/javascripts/skip-to-nav.js rename to app/javascript/skip-to-nav.js diff --git a/app/assets/javascripts/tooltip.js b/app/javascript/tooltip.js similarity index 100% rename from app/assets/javascripts/tooltip.js rename to app/javascript/tooltip.js diff --git a/app/assets/javascripts/truncate.js b/app/javascript/truncate.js similarity index 100% rename from app/assets/javascripts/truncate.js rename to app/javascript/truncate.js diff --git a/app/assets/javascripts/update-hidden-inputs-by-checkbox.js b/app/javascript/update-hidden-inputs-by-checkbox.js similarity index 100% rename from app/assets/javascripts/update-hidden-inputs-by-checkbox.js rename to app/javascript/update-hidden-inputs-by-checkbox.js diff --git a/vendor/assets/javascripts/jquery-scrollspy.js b/app/javascript/vendor/jquery-scrollspy.js similarity index 100% rename from vendor/assets/javascripts/jquery-scrollspy.js rename to app/javascript/vendor/jquery-scrollspy.js diff --git a/vendor/assets/javascripts/responsiveTruncator.js b/app/javascript/vendor/responsiveTruncator.js similarity index 100% rename from vendor/assets/javascripts/responsiveTruncator.js rename to app/javascript/vendor/responsiveTruncator.js diff --git a/vendor/assets/javascripts/trunk8.js b/app/javascript/vendor/trunk8.js similarity index 100% rename from vendor/assets/javascripts/trunk8.js rename to app/javascript/vendor/trunk8.js diff --git a/app/views/layouts/searchworks.html.erb b/app/views/layouts/searchworks.html.erb index 38b3ad076..4a212e8f6 100644 --- a/app/views/layouts/searchworks.html.erb +++ b/app/views/layouts/searchworks.html.erb @@ -23,7 +23,14 @@ crossorigin="anonymous"> - <%= javascript_include_tag "application" %> + + + <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> +