blacklight-spotlight 3.6.0.beta4 → 3.6.0.beta5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/spotlight/manifest.js +3 -1
  3. data/app/assets/javascripts/spotlight/application.js +0 -1
  4. data/app/assets/javascripts/spotlight/spotlight.esm.js +30 -17
  5. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -1
  6. data/app/assets/javascripts/spotlight/spotlight.js +30 -17
  7. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -1
  8. data/app/assets/stylesheets/spotlight/_exhibits_index.scss +1 -1
  9. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +1 -1
  10. data/app/javascript/spotlight/admin/{add_image_selector.es6 → add_image_selector.js} +1 -1
  11. data/app/javascript/spotlight/admin/block_mixins/autocompleteable.js +1 -5
  12. data/app/javascript/spotlight/admin/blocks/block.js +2 -2
  13. data/app/javascript/spotlight/admin/blocks/browse_block.js +8 -3
  14. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +7 -3
  15. data/app/javascript/spotlight/admin/blocks/oembed_block.js +2 -2
  16. data/app/javascript/spotlight/admin/blocks/pages_block.js +7 -3
  17. data/app/javascript/spotlight/admin/blocks/resources_block.js +4 -4
  18. data/app/javascript/spotlight/admin/blocks/solr_documents_base_block.js +8 -5
  19. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +3 -3
  20. data/app/javascript/spotlight/admin/crop.js +3 -3
  21. data/app/javascript/spotlight/admin/{croppable.es6 → croppable.js} +1 -1
  22. data/app/javascript/spotlight/admin/index.js +53 -55
  23. data/app/javascript/spotlight/admin/{pages.es6 → pages.js} +4 -4
  24. data/app/javascript/spotlight/admin/search_typeahead.js +7 -6
  25. data/app/javascript/spotlight/admin/sir-trevor/block_controls.js +3 -3
  26. data/app/javascript/spotlight/admin/sir-trevor/block_limits.js +6 -6
  27. data/app/javascript/spotlight/admin/{visibility_toggle.es6 → visibility_toggle.js} +1 -1
  28. data/app/javascript/spotlight/index.js +5 -5
  29. data/app/javascript/spotlight/user/index.js +5 -5
  30. data/app/views/layouts/spotlight/base.html.erb +2 -2
  31. data/app/views/spotlight/dashboards/_page.html.erb +2 -2
  32. data/app/views/spotlight/home_pages/_edit_page_link.html.erb +2 -1
  33. data/app/views/spotlight/pages/_edit_page_link.html.erb +2 -1
  34. data/app/views/spotlight/pages/_page.html.erb +1 -1
  35. data/app/views/spotlight/shared/_locale_picker.html.erb +2 -1
  36. data/config/importmap.rb +4 -0
  37. data/lib/generators/spotlight/install_generator.rb +3 -0
  38. data/lib/spotlight/engine.rb +16 -2
  39. data/lib/spotlight/version.rb +1 -1
  40. metadata +30 -43
  41. /data/app/javascript/spotlight/admin/{add_another.es6 → add_another.js} +0 -0
  42. /data/app/javascript/spotlight/admin/{add_new_button.es6 → add_new_button.js} +0 -0
  43. /data/app/javascript/spotlight/admin/{appearance.es6 → appearance.js} +0 -0
  44. /data/app/javascript/spotlight/admin/{blacklight_configuration.es6 → blacklight_configuration.js} +0 -0
  45. /data/app/javascript/spotlight/admin/{checkbox_submit.es6 → checkbox_submit.js} +0 -0
  46. /data/app/javascript/spotlight/admin/{copy_email_addresses.es6 → copy_email_addresses.js} +0 -0
  47. /data/app/javascript/spotlight/admin/{edit_in_place.es6 → edit_in_place.js} +0 -0
  48. /data/app/javascript/spotlight/admin/{exhibit_tag_autocomplete.es6 → exhibit_tag_autocomplete.js} +0 -0
  49. /data/app/javascript/spotlight/admin/{exhibits.es6 → exhibits.js} +0 -0
  50. /data/app/javascript/spotlight/admin/{form_observer.es6 → form_observer.js} +0 -0
  51. /data/app/javascript/spotlight/admin/{locks.es6 → locks.js} +0 -0
  52. /data/app/javascript/spotlight/admin/{progress_monitor.es6 → progress_monitor.js} +0 -0
  53. /data/app/javascript/spotlight/admin/{readonly_checkbox.es6 → readonly_checkbox.js} +0 -0
  54. /data/app/javascript/spotlight/admin/{select_related_input.es6 → select_related_input.js} +0 -0
  55. /data/app/javascript/spotlight/admin/{tabs.es6 → tabs.js} +0 -0
  56. /data/app/javascript/spotlight/admin/{translation_progress.es6 → translation_progress.js} +0 -0
  57. /data/app/javascript/spotlight/admin/{users.es6 → users.js} +0 -0
  58. /data/app/javascript/spotlight/{spotlight.js → core.js} +0 -0
  59. /data/app/javascript/spotlight/user/{browse_group_categories.es6 → browse_group_categories.js} +0 -0
  60. /data/app/javascript/spotlight/user/{carousel.es6 → carousel.js} +0 -0
  61. /data/app/javascript/spotlight/user/{clear_form_button.es6 → clear_form_button.js} +0 -0
  62. /data/app/javascript/spotlight/user/{report_a_problem.es6 → report_a_problem.js} +0 -0
  63. /data/app/javascript/spotlight/user/{zpr_links.es6 → zpr_links.js} +0 -0
@@ -1,4 +1,4 @@
1
- $exhibit-card-overlay-padding: $card-img-overlay-padding / 2 !default;
1
+ $exhibit-card-overlay-padding: $card-img-overlay-padding * 0.5 !default;
2
2
  $exhibit-card-overlay-opacity: 0.85 !default;
3
3
  $exhibit-card-bg: $card-bg !default;
4
4
 
@@ -73,7 +73,7 @@ $xl-sidebar-five-tile-width: ($container-xl-sidebar * 0.2) - $tile-margin;
73
73
  font-size: $h4-font-size;
74
74
  line-height: 1.2;
75
75
  margin: 0;
76
- padding: $spacer / 4;
76
+ padding: $spacer * 0.25;
77
77
 
78
78
  @media (min-width: breakpoint-min("sm")) {
79
79
  font-size: 1.125rem;
@@ -1,4 +1,4 @@
1
- import Iiif from 'iiif'
1
+ import Iiif from 'spotlight/admin/iiif'
2
2
 
3
3
  export function addImageSelector(input, panel, manifestUrl, initialize) {
4
4
  if (!manifestUrl) {
@@ -10,10 +10,6 @@
10
10
  this.autocomplete_url = function() { return $('form[data-autocomplete-url]').data('autocomplete-url').replace("%25QUERY", "%QUERY"); };
11
11
  }
12
12
 
13
- if (this['autocomplete_template'] === undefined) {
14
- this.autocomplete_url = function() { return '<div class="autocomplete-item{{#if private}} blacklight-private{{/if}}">{{#if thumbnail}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small>&nbsp;&nbsp;{{description}}</small></div>' };
15
- }
16
-
17
13
  if (this['transform_autocomplete_results'] === undefined) {
18
14
  this.transform_autocomplete_results = (val) => val
19
15
  }
@@ -35,7 +31,7 @@
35
31
  },
36
32
 
37
33
  addAutocompletetoSirTrevorForm: function() {
38
- $('[data-twitter-typeahead]', this.inner).spotlightSearchTypeAhead({bloodhound: this.bloodhound(), template: this.autocomplete_template()}).on('typeahead:selected typeahead:autocompleted', this.autocompletedHandler()).on( 'focus', function() {
34
+ $('[data-twitter-typeahead]', this.inner).spotlightSearchTypeAhead({bloodhound: this.bloodhound(), template: this.autocomplete_template}).on('typeahead:selected typeahead:autocompleted', this.autocompletedHandler()).on( 'focus', function() {
39
35
  if($(this).val() === '') {
40
36
  $(this).data().ttTypeahead.input.trigger('queryChanged', '');
41
37
  }
@@ -1,6 +1,6 @@
1
- import Spotlight from 'spotlight'
1
+ import Core from 'spotlight/core'
2
2
  (function ($){
3
- Spotlight.Block = SirTrevor.Block.extend({
3
+ Core.Block = SirTrevor.Block.extend({
4
4
  scribeOptions: {
5
5
  allowBlockElements: true,
6
6
  tags: { p: true }
@@ -1,8 +1,8 @@
1
- import Spotlight from 'spotlight'
1
+ import Core from 'spotlight/core'
2
2
 
3
3
  SirTrevor.Blocks.Browse = (function(){
4
4
 
5
- return Spotlight.Block.Resources.extend({
5
+ return Core.Block.Resources.extend({
6
6
  type: "browse",
7
7
 
8
8
  icon_name: "browse",
@@ -10,7 +10,12 @@ SirTrevor.Blocks.Browse = (function(){
10
10
  autocomplete_url: function() {
11
11
  return $(this.inner).closest('form[data-autocomplete-exhibit-searches-path]').data('autocomplete-exhibit-searches-path').replace("%25QUERY", "%QUERY");
12
12
  },
13
- autocomplete_template: function() { return '<div class="autocomplete-item{{#unless published}} blacklight-private{{/unless}}">{{#if thumbnail_image_url}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail_image_url}}" /></div>{{/if}}<span class="autocomplete-title">{{full_title}}</span><br/><small>&nbsp;&nbsp;{{description}}</small></div>' },
13
+
14
+ autocomplete_template: function(obj) {
15
+ const thumbnail = obj.thumbnail_image_url ? `<div class="document-thumbnail"><img class="img-thumbnail" src="${obj.thumbnail_image_url}" /></div>` : ''
16
+ return `<div class="autocomplete-item${!obj.published ? ' blacklight-private' : ''}">${thumbnail}
17
+ <span class="autocomplete-title">${obj.full_title}</span><br/><small>&nbsp;&nbsp;${obj.description}</small></div>`
18
+ },
14
19
 
15
20
  bloodhoundOptions: function() {
16
21
  return {
@@ -1,11 +1,11 @@
1
1
  /*
2
2
  Sir Trevor BrowseGroupCategories
3
3
  */
4
- import Spotlight from 'spotlight'
4
+ import Core from 'spotlight/core'
5
5
 
6
6
  SirTrevor.Blocks.BrowseGroupCategories = (function(){
7
7
 
8
- return Spotlight.Block.Resources.extend({
8
+ return Core.Block.Resources.extend({
9
9
  type: "browse_group_categories",
10
10
  icon_name: "browse",
11
11
  bloodhoundOptions: function() {
@@ -26,7 +26,11 @@ SirTrevor.Blocks.BrowseGroupCategories = (function(){
26
26
  autocomplete_control: function() {
27
27
  return `<input type="text" class="st-input-string form-control item-input-field" data-twitter-typeahead="true" placeholder="${i18n.t("blocks:browse_group_categories:autocomplete")}"/>`
28
28
  },
29
- autocomplete_template: function() { return '<div class="autocomplete-item{{#unless published}} blacklight-private{{/unless}}"><span class="autocomplete-title">{{title}}</span><br/></div>' },
29
+ autocomplete_template: function(obj) {
30
+ return `<div class="autocomplete-item${!obj.published ? ' blacklight-private' : ''}">
31
+ <span class="autocomplete-title">${obj.title}</span><br/></div>`
32
+ },
33
+
30
34
  autocomplete_url: function() { return $(this.inner).closest('form[data-autocomplete-exhibit-browse-groups-path]').data('autocomplete-exhibit-browse-groups-path').replace("%25QUERY", "%QUERY"); },
31
35
  _itemPanel: function(data) {
32
36
  var index = "item_" + this.globalIndex++;
@@ -6,11 +6,11 @@
6
6
  and any provided text
7
7
  and displays them.
8
8
  */
9
- import Spotlight from 'spotlight'
9
+ import Core from 'spotlight/core'
10
10
 
11
11
  SirTrevor.Blocks.Oembed = (function(){
12
12
 
13
- return Spotlight.Block.extend({
13
+ return Core.Block.extend({
14
14
  plustextable: true,
15
15
 
16
16
  id_key:"url",
@@ -1,14 +1,18 @@
1
- import Spotlight from 'spotlight'
1
+ import Core from 'spotlight/core'
2
2
 
3
3
  SirTrevor.Blocks.FeaturedPages = (function(){
4
4
 
5
- return Spotlight.Block.Resources.extend({
5
+ return Core.Block.Resources.extend({
6
6
  type: "featured_pages",
7
7
 
8
8
  icon_name: "pages",
9
9
 
10
10
  autocomplete_url: function() { return $(this.inner).closest('form[data-autocomplete-exhibit-pages-path]').data('autocomplete-exhibit-pages-path').replace("%25QUERY", "%QUERY"); },
11
- autocomplete_template: function() { return '<div class="autocomplete-item{{#unless published}} blacklight-private{{/unless}}">{{#if thumbnail_image_url}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail_image_url}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small>&nbsp;&nbsp;{{description}}</small></div>' },
11
+ autocomplete_template: function(obj) {
12
+ const thumbnail = obj.thumbnail_image_url ? `<div class="document-thumbnail"><img class="img-thumbnail" src="${obj.thumbnail_image_url}" /></div>` : ''
13
+ return `<div class="autocomplete-item${!obj.published ? ' blacklight-private' : ''}">${thumbnail}
14
+ <span class="autocomplete-title">${obj.title}</span><br/><small>&nbsp;&nbsp;${obj.description}</small></div>`
15
+ },
12
16
  bloodhoundOptions: function() {
13
17
  return {
14
18
  prefetch: {
@@ -1,9 +1,9 @@
1
- import Spotlight from 'spotlight'
2
- import SpotlightNestable from 'spotlight_nestable'
1
+ import Core from 'spotlight/core'
2
+ import SpotlightNestable from 'spotlight/admin/spotlight_nestable'
3
3
 
4
- Spotlight.Block.Resources = (function(){
4
+ Core.Block.Resources = (function(){
5
5
 
6
- return Spotlight.Block.extend({
6
+ return Core.Block.extend({
7
7
  type: "resources",
8
8
  formable: true,
9
9
  autocompleteable: true,
@@ -1,13 +1,16 @@
1
- import Iiif from '../iiif'
2
- import Spotlight from 'spotlight'
1
+ import Iiif from 'spotlight/admin/iiif'
2
+ import Core from 'spotlight/core'
3
3
 
4
4
  SirTrevor.Blocks.SolrDocumentsBase = (function(){
5
5
 
6
- return Spotlight.Block.Resources.extend({
6
+ return Core.Block.Resources.extend({
7
7
  plustextable: true,
8
8
  autocomplete_url: function() { return this.$instance().closest('form[data-autocomplete-exhibit-catalog-path]').data('autocomplete-exhibit-catalog-path').replace("%25QUERY", "%QUERY"); },
9
- autocomplete_template: function() { return '<div class="autocomplete-item{{#if private}} blacklight-private{{/if}}">{{#if thumbnail}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small>&nbsp;&nbsp;{{description}}</small></div>' },
10
-
9
+ autocomplete_template: function(obj) {
10
+ const thumbnail = obj.thumbnail ? `<div class="document-thumbnail"><img class="img-thumbnail" src="${obj.thumbnail}" /></div>` : ''
11
+ return `<div class="autocomplete-item${obj.private ? ' blacklight-private' : ''}">${thumbnail}
12
+ <span class="autocomplete-title">${obj.title}</span><br/><small>&nbsp;&nbsp;${obj.description}</small></div>`
13
+ },
11
14
  transform_autocomplete_results: function(response) {
12
15
  return $.map(response['docs'], function(doc) {
13
16
  return doc;
@@ -1,8 +1,8 @@
1
- import SpotlightNestable from 'spotlight_nestable'
2
- import Spotlight from 'spotlight'
1
+ import SpotlightNestable from 'spotlight/admin/spotlight_nestable'
2
+ import Core from 'spotlight/core'
3
3
 
4
4
  SirTrevor.Blocks.UploadedItems = (function(){
5
- return Spotlight.Block.Resources.extend({
5
+ return Core.Block.Resources.extend({
6
6
  plustextable: true,
7
7
  uploadable: true,
8
8
  autocompleteable: false,
@@ -1,5 +1,5 @@
1
- import { addImageSelector } from 'add_image_selector'
2
- import Spotlight from 'spotlight'
1
+ import { addImageSelector } from 'spotlight/admin/add_image_selector'
2
+ import Core from 'spotlight/core'
3
3
 
4
4
  export default class Crop {
5
5
  constructor(cropArea) {
@@ -265,7 +265,7 @@ export default class Crop {
265
265
  // Form data
266
266
  data: this.getData(),
267
267
  headers: {
268
- 'X-CSRF-Token': Spotlight.csrfToken() || ''
268
+ 'X-CSRF-Token': Core.csrfToken() || ''
269
269
  },
270
270
  //Options to tell jQuery not to process data or worry about content-type.
271
271
  cache: false,
@@ -1,4 +1,4 @@
1
- import Crop from 'crop';
1
+ import Crop from 'spotlight/admin/crop';
2
2
 
3
3
  export default class {
4
4
  connect() {
@@ -1,62 +1,60 @@
1
- // import '../../../../vendor/assets/javascripts/sir-trevor'
2
- import '../../../../vendor/assets/javascripts/nestable'
3
- import '../../../../vendor/assets/javascripts/parameterize'
4
- import '../../../../vendor/assets/javascripts/bootstrap-tagsinput'
5
- import '../../../../vendor/assets/javascripts/jquery.serializejson'
6
- // import '../../../../vendor/assets/javascripts/clipboard'
7
- // import '../../../../vendor/assets/javascripts/leaflet'
8
- import '../../../../vendor/assets/javascripts/leaflet-iiif'
9
- import '../../../../vendor/assets/javascripts/Leaflet.Editable'
10
- import '../../../../vendor/assets/javascripts/Path.Drag'
1
+ // These scripts are in the vendor directory
2
+ import 'nestable'
3
+ import 'parameterize'
4
+ import 'bootstrap-tagsinput'
5
+ import 'jquery.serializejson'
6
+ import 'leaflet-iiif'
7
+ import 'Leaflet.Editable'
8
+ import 'Path.Drag'
11
9
 
12
- import AddAnother from 'add_another'
13
- import AddNewButton from 'add_new_button'
14
- import Appearance from 'appearance'
15
- import BlacklightConfiguration from 'blacklight_configuration'
16
- import CopyEmailAddress from 'copy_email_addresses'
17
- import Croppable from 'croppable'
18
- import EditInPlace from 'edit_in_place'
19
- import ExhibitTagAutocomplete from 'exhibit_tag_autocomplete'
20
- import Exhibits from 'exhibits'
21
- import FormObserver from 'form_observer'
22
- import Locks from 'locks'
23
- import 'multi_image_selector'
24
- import Pages from 'pages'
25
- import ProgressMonitor from 'progress_monitor'
26
- import ReadonlyCheckbox from 'readonly_checkbox'
27
- import { addAutocompletetoFeaturedImage } from 'search_typeahead'
28
- import SelectRelatedInput from 'select_related_input'
29
- import SpotlightNestable from 'spotlight_nestable'
30
- import Tabs from 'tabs'
31
- import TranslationProgress from 'translation_progress'
32
- import 'visibility_toggle'
33
- import Users from 'users'
10
+ import AddAnother from 'spotlight/admin/add_another'
11
+ import AddNewButton from 'spotlight/admin/add_new_button'
12
+ import Appearance from 'spotlight/admin/appearance'
13
+ import BlacklightConfiguration from 'spotlight/admin/blacklight_configuration'
14
+ import CopyEmailAddress from 'spotlight/admin/copy_email_addresses'
15
+ import Croppable from 'spotlight/admin/croppable'
16
+ import EditInPlace from 'spotlight/admin/edit_in_place'
17
+ import ExhibitTagAutocomplete from 'spotlight/admin/exhibit_tag_autocomplete'
18
+ import Exhibits from 'spotlight/admin/exhibits'
19
+ import FormObserver from 'spotlight/admin/form_observer'
20
+ import Locks from 'spotlight/admin/locks'
21
+ import 'spotlight/admin/multi_image_selector'
22
+ import Pages from 'spotlight/admin/pages'
23
+ import ProgressMonitor from 'spotlight/admin/progress_monitor'
24
+ import ReadonlyCheckbox from 'spotlight/admin/readonly_checkbox'
25
+ import { addAutocompletetoFeaturedImage } from 'spotlight/admin/search_typeahead'
26
+ import SelectRelatedInput from 'spotlight/admin/select_related_input'
27
+ import SpotlightNestable from 'spotlight/admin/spotlight_nestable'
28
+ import Tabs from 'spotlight/admin/tabs'
29
+ import TranslationProgress from 'spotlight/admin/translation_progress'
30
+ import 'spotlight/admin/visibility_toggle'
31
+ import Users from 'spotlight/admin/users'
34
32
 
35
- import 'block_mixins/autocompleteable'
36
- import 'block_mixins/formable'
37
- import 'block_mixins/plustextable'
33
+ import 'spotlight/admin/block_mixins/autocompleteable'
34
+ import 'spotlight/admin/block_mixins/formable'
35
+ import 'spotlight/admin/block_mixins/plustextable'
38
36
 
39
- import 'blocks/block'
40
- import 'blocks/resources_block' // This is a base class of several other blocks, so must come first
41
- import 'blocks/browse_block'
42
- import 'blocks/browse_group_categories_block'
43
- import 'blocks/iframe_block'
44
- import 'blocks/link_to_search_block'
45
- import 'blocks/oembed_block'
46
- import 'blocks/pages_block'
47
- import 'blocks/rule_block'
48
- import 'blocks/search_result_block'
49
- import 'blocks/solr_documents_base_block'
50
- import 'blocks/solr_documents_block'
51
- import 'blocks/solr_documents_carousel_block'
52
- import 'blocks/solr_documents_embed_block'
53
- import 'blocks/solr_documents_features_block'
54
- import 'blocks/solr_documents_grid_block'
55
- import 'blocks/uploaded_items_block'
37
+ import 'spotlight/admin/blocks/block'
38
+ import 'spotlight/admin/blocks/resources_block' // This is a base class of several other blocks, so must come first
39
+ import 'spotlight/admin/blocks/browse_block'
40
+ import 'spotlight/admin/blocks/browse_group_categories_block'
41
+ import 'spotlight/admin/blocks/iframe_block'
42
+ import 'spotlight/admin/blocks/link_to_search_block'
43
+ import 'spotlight/admin/blocks/oembed_block'
44
+ import 'spotlight/admin/blocks/pages_block'
45
+ import 'spotlight/admin/blocks/rule_block'
46
+ import 'spotlight/admin/blocks/search_result_block'
47
+ import 'spotlight/admin/blocks/solr_documents_base_block'
48
+ import 'spotlight/admin/blocks/solr_documents_block'
49
+ import 'spotlight/admin/blocks/solr_documents_carousel_block'
50
+ import 'spotlight/admin/blocks/solr_documents_embed_block'
51
+ import 'spotlight/admin/blocks/solr_documents_features_block'
52
+ import 'spotlight/admin/blocks/solr_documents_grid_block'
53
+ import 'spotlight/admin/blocks/uploaded_items_block'
56
54
 
57
- import 'sir-trevor/block_controls'
58
- import 'sir-trevor/block_limits'
59
- import 'sir-trevor/locales'
55
+ import 'spotlight/admin/sir-trevor/block_controls'
56
+ import 'spotlight/admin/sir-trevor/block_limits'
57
+ import 'spotlight/admin/sir-trevor/locales'
60
58
 
61
59
 
62
60
  export default class {
@@ -1,6 +1,6 @@
1
1
  // Place all the behaviors and hooks related to the matching controller here.
2
2
  // All this logic will automatically be available in application.js.
3
- import Spotlight from 'spotlight'
3
+ import Core from 'spotlight/core'
4
4
 
5
5
  export default class {
6
6
  connect(){
@@ -9,7 +9,7 @@ export default class {
9
9
  uploadUrl: $('[data-attachment-endpoint]').data('attachment-endpoint'),
10
10
  ajaxOptions: {
11
11
  headers: {
12
- 'X-CSRF-Token': Spotlight.csrfToken() || ''
12
+ 'X-CSRF-Token': Core.csrfToken() || ''
13
13
  },
14
14
  credentials: 'same-origin'
15
15
  }
@@ -34,9 +34,9 @@ export default class {
34
34
  }
35
35
  });
36
36
 
37
- editor.blockControls = Spotlight.BlockControls.create(editor);
37
+ editor.blockControls = Core.BlockControls.create(editor);
38
38
 
39
- new Spotlight.BlockLimits(editor).enforceLimits(editor);
39
+ new Core.BlockLimits(editor).enforceLimits(editor);
40
40
  }
41
41
  }
42
42
  }
@@ -1,4 +1,4 @@
1
- import { addImageSelector } from 'add_image_selector'
1
+ import { addImageSelector } from 'spotlight/admin/add_image_selector'
2
2
 
3
3
  (function($){
4
4
  $.fn.spotlightSearchTypeAhead = function( options ) {
@@ -14,12 +14,11 @@ import { addImageSelector } from 'add_image_selector'
14
14
  hint: (typeAheadInput.data('autocomplete-hint') || false),
15
15
  autoselect: (typeAheadInput.data('autocomplete-autoselect') || true)
16
16
  }, options);
17
-
18
17
  typeAheadInput.typeahead(settings, {
19
18
  displayKey: settings.displayKey,
20
19
  source: settings.bloodhound.ttAdapter(),
21
20
  templates: {
22
- suggestion: Handlebars.compile(settings.template)
21
+ suggestion: settings.template
23
22
  }
24
23
  })
25
24
  }
@@ -47,13 +46,15 @@ function itemsBloodhound() {
47
46
  return results;
48
47
  };
49
48
 
50
- function itemsTemplate() {
51
- return '<div class="autocomplete-item{{#if private}} blacklight-private{{/if}}">{{#if thumbnail}}<div class="document-thumbnail"><img class="img-thumbnail" src="{{thumbnail}}" /></div>{{/if}}<span class="autocomplete-title">{{title}}</span><br/><small>&nbsp;&nbsp;{{description}}</small></div>';
49
+ function templateFunc(obj) {
50
+ const thumbnail = obj.thumbnail ? `<div class="document-thumbnail"><img class="img-thumbnail" src="${obj.thumbnail}" /></div>` : ''
51
+ return $(`<div class="autocomplete-item${obj.private ? ' blacklight-private' : ''}">${thumbnail}
52
+ <span class="autocomplete-title">${obj.title}</span><br/><small>&nbsp;&nbsp;${obj.description}</small></div>`)
52
53
  }
53
54
 
54
55
  export function addAutocompletetoFeaturedImage(){
55
56
  if($('[data-featured-image-typeahead]').length > 0) {
56
- $('[data-featured-image-typeahead]').spotlightSearchTypeAhead({bloodhound: itemsBloodhound(), template: itemsTemplate()}).on('click', function() {
57
+ $('[data-featured-image-typeahead]').spotlightSearchTypeAhead({bloodhound: itemsBloodhound(), template: templateFunc}).on('click', function() {
57
58
  $(this).select();
58
59
  }).on('typeahead:selected typeahead:autocompleted', function(e, data) {
59
60
  var panel = $($(this).data('target-panel'));
@@ -1,4 +1,4 @@
1
- import Spotlight from 'spotlight'
1
+ import Core from 'spotlight/core'
2
2
 
3
3
  (function() {
4
4
  var BLOCK_REPLACER_CONTROL_TEMPLATE = function(block) {
@@ -77,8 +77,8 @@ import Spotlight from 'spotlight'
77
77
  return elButtons;
78
78
  }
79
79
 
80
- Spotlight.BlockControls = function() { };
81
- Spotlight.BlockControls.create = function(editor) {
80
+ Core.BlockControls = function() { };
81
+ Core.BlockControls.create = function(editor) {
82
82
  // REFACTOR - should probably not know about blockManager
83
83
  var el = render(SirTrevor.Blocks, editor.blockManager.blockTypes);
84
84
 
@@ -1,20 +1,20 @@
1
- import Spotlight from 'spotlight'
1
+ import Core from 'spotlight/core'
2
2
 
3
- Spotlight.BlockLimits = function(editor) {
3
+ Core.BlockLimits = function(editor) {
4
4
  this.editor = editor;
5
5
  };
6
6
 
7
- Spotlight.BlockLimits.prototype.enforceLimits = function(editor) {
7
+ Core.BlockLimits.prototype.enforceLimits = function(editor) {
8
8
  this.addEditorCallbacks(editor);
9
9
  this.checkGlobalBlockTypeLimit()();
10
10
  };
11
11
 
12
- Spotlight.BlockLimits.prototype.addEditorCallbacks = function(editor) {
12
+ Core.BlockLimits.prototype.addEditorCallbacks = function(editor) {
13
13
  SirTrevor.EventBus.on('block:create:new', this.checkBlockTypeLimitOnAdd());
14
14
  SirTrevor.EventBus.on('block:remove', this.checkGlobalBlockTypeLimit());
15
15
  };
16
16
 
17
- Spotlight.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function() {
17
+ Core.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function() {
18
18
  var editor = this.editor;
19
19
 
20
20
  return function(block) {
@@ -24,7 +24,7 @@ Spotlight.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function() {
24
24
  };
25
25
  };
26
26
 
27
- Spotlight.BlockLimits.prototype.checkGlobalBlockTypeLimit = function() {
27
+ Core.BlockLimits.prototype.checkGlobalBlockTypeLimit = function() {
28
28
  // we don't know what type of block was created or removed.. So, try them all.
29
29
  var editor = this.editor;
30
30
 
@@ -1,7 +1,7 @@
1
1
  // Visibility toggle for items in an exhibit, based on Blacklight's bookmark toggle
2
2
  // See: https://github.com/projectblacklight/blacklight/blob/main/app/javascript/blacklight/bookmark_toggle.js
3
3
 
4
- import CheckboxSubmit from 'checkbox_submit'
4
+ import CheckboxSubmit from 'spotlight/admin/checkbox_submit'
5
5
 
6
6
  const VisibilityToggle = (e) => {
7
7
  if (e.target.matches('[data-checkboxsubmit-target="checkbox"]')) {
@@ -1,10 +1,10 @@
1
- import UserIndex from 'user/index'
2
- import AdminIndex from 'admin/index'
3
- import Spotlight from 'spotlight'
1
+ import UserIndex from 'spotlight/user'
2
+ import AdminIndex from 'spotlight/admin'
3
+ import Core from 'spotlight/core'
4
4
 
5
- Spotlight.onLoad(() => {
5
+ Core.onLoad(() => {
6
6
  new UserIndex().connect()
7
7
  new AdminIndex().connect()
8
8
  })
9
9
 
10
- export default Spotlight
10
+ export default Core
@@ -1,8 +1,8 @@
1
- import BrowseGroupCateogries from 'browse_group_categories'
2
- import Carousel from 'carousel'
3
- import ClearFormButton from 'clear_form_button'
4
- import ReportProblem from 'report_a_problem'
5
- import ZprLinks from 'zpr_links'
1
+ import BrowseGroupCateogries from 'spotlight/user/browse_group_categories'
2
+ import Carousel from 'spotlight/user/carousel'
3
+ import ClearFormButton from 'spotlight/user/clear_form_button'
4
+ import ReportProblem from 'spotlight/user/report_a_problem'
5
+ import ZprLinks from 'spotlight/user/zpr_links'
6
6
 
7
7
  export default class {
8
8
  connect() {
@@ -26,9 +26,9 @@
26
26
  <%= render partial: 'shared/body_preamble' %>
27
27
  <div id="skip-link">
28
28
  <% if should_render_spotlight_search_bar? %>
29
- <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
29
+ <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3' %>
30
30
  <% end %>
31
- <%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
31
+ <%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3' %>
32
32
  <%= content_for(:skip_links) %>
33
33
  </div>
34
34
 
@@ -4,10 +4,10 @@
4
4
  <div class="page-links pt-0">
5
5
  <% if page.is_a?(Spotlight::HomePage) %>
6
6
  <%= link_to action_default_value(page, :view), current_exhibit %> &middot;
7
- <%= exhibit_edit_link page, edit_exhibit_home_page_path(page.exhibit), data: { turbolinks: false } %>
7
+ <%= exhibit_edit_link page, edit_exhibit_home_page_path(page.exhibit), data: { turbolinks: false, turbo: false } %>
8
8
  <% else %>
9
9
  <%= exhibit_view_link page %> &middot;
10
- <%= exhibit_edit_link page, data: { turbolinks: false } %>
10
+ <%= exhibit_edit_link page, data: { turbolinks: false, turbo: false } %>
11
11
  <% end %>
12
12
  </div>
13
13
  </td>
@@ -1 +1,2 @@
1
- <%= exhibit_edit_link @page, spotlight.edit_exhibit_home_page_path(@page.exhibit), class: 'edit-button float-right btn btn-primary', data: { turbolinks: false } %>
1
+ <%= exhibit_edit_link @page, spotlight.edit_exhibit_home_page_path(@page.exhibit), class: 'edit-button float-right btn btn-primary',
2
+ data: { turbolinks: false, turbo: false } %>
@@ -1 +1,2 @@
1
- <%= exhibit_edit_link @page, class: 'edit-button float-right btn btn-primary', data: { turbolinks: false } %>
1
+ <%= exhibit_edit_link @page, class: 'edit-button float-right btn btn-primary',
2
+ data: { turbolinks: false, turbo: false } %>
@@ -3,7 +3,7 @@
3
3
  <% case section when :additional_options %>
4
4
  <div class="page-links">
5
5
  <%= exhibit_view_link page %> &middot;
6
- <%= exhibit_edit_link page, data: { turbolinks: false } %> &middot;
6
+ <%= exhibit_edit_link page, data: { turbolinks: false, turbo: false } %> &middot;
7
7
  <%= exhibit_delete_link page %>
8
8
  </div>
9
9
  <%- if page.feature_page? -%>
@@ -6,7 +6,8 @@
6
6
  <ul class="dropdown-menu">
7
7
  <% locale_selecter_dropown_options.each do |language| %>
8
8
  <li>
9
- <%= link_to language.to_native, current_page_for_locale(language.locale), class: 'dropdown-item', data: { turbolinks: false } %>
9
+ <%= link_to language.to_native, current_page_for_locale(language.locale), class: 'dropdown-item',
10
+ data: { turbolinks: false, turbo: false } %>
10
11
  </li>
11
12
  <% end %>
12
13
  </ul>
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ pin_all_from File.expand_path('../app/javascript/spotlight', __dir__), under: 'spotlight'
4
+ pin_all_from File.expand_path('../vendor/assets/javascripts', __dir__)
@@ -21,6 +21,9 @@ module Spotlight
21
21
  def add_manifest
22
22
  append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
23
23
  append_to_file 'app/assets/config/manifest.js', "\n//= link spotlight/manifest.js"
24
+
25
+ # Rails installed importmap by default, but we don't have importmap + Blacklight 7 working yet.
26
+ remove_file 'app/javascript/application.js'
24
27
  end
25
28
 
26
29
  def inject_spotlight_routes
@@ -41,7 +41,6 @@ module Spotlight
41
41
  require 'redcarpet' # required for markdown support in github/markup https://github.com/github/markup#markups
42
42
  require 'github/markup'
43
43
  require 'openseadragon'
44
- require 'handlebars_assets'
45
44
 
46
45
  config.assets.precompile += %w[spotlight/fallback/*.png]
47
46
 
@@ -64,8 +63,23 @@ module Spotlight
64
63
  FactoryBot.definition_file_paths << File.expand_path('../../spec/factories', __dir__) if defined?(FactoryBot)
65
64
  end
66
65
 
66
+ PRECOMPILE_ASSETS = %w[
67
+ spotlight/blocks/sir-trevor-icons.svg
68
+ spotlight/default_thumbnail.jpg
69
+ spotlight/default_browse_thumbnail.jpg
70
+ spotlight/spotlight.js
71
+ spotlight/spotlight.js.map
72
+ spotlight/spotlight.esm.js
73
+ spotlight/spotlight.esm.js.map
74
+ ].freeze
75
+
67
76
  initializer 'spotlight.assets.precompile' do |app|
68
- app.config.assets.precompile += %w[spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg]
77
+ app.config.assets.paths << Engine.root.join('app/javascript')
78
+ app.config.assets.precompile += PRECOMPILE_ASSETS
79
+ end
80
+
81
+ initializer 'spotlight.importmap', before: 'importmap' do |app|
82
+ app.config.importmap.paths << Engine.root.join('config/importmap.rb') if app.config.respond_to?(:importmap)
69
83
  end
70
84
 
71
85
  def self.user_class
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.6.0.beta4'
4
+ VERSION = '3.6.0.beta5'
5
5
  end