blacklight-spotlight 3.5.0.4 → 3.6.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -0
  3. data/Rakefile +6 -7
  4. data/app/assets/config/spotlight/manifest.js +1 -0
  5. data/app/assets/javascripts/spotlight/application.js +14 -14
  6. data/app/assets/javascripts/spotlight/spotlight.esm.js +7148 -0
  7. data/app/assets/javascripts/spotlight/spotlight.esm.js.map +1 -0
  8. data/app/assets/javascripts/spotlight/spotlight.js +7148 -15
  9. data/app/assets/javascripts/spotlight/spotlight.js.map +1 -0
  10. data/app/assets/stylesheets/spotlight/_catalog.scss +16 -0
  11. data/app/controllers/concerns/spotlight/base.rb +2 -1
  12. data/app/controllers/concerns/spotlight/controller.rb +10 -0
  13. data/app/controllers/spotlight/admin_users_controller.rb +4 -4
  14. data/app/controllers/spotlight/appearances_controller.rb +6 -6
  15. data/app/controllers/spotlight/browse_controller.rb +1 -1
  16. data/app/controllers/spotlight/catalog_controller.rb +20 -15
  17. data/app/controllers/spotlight/concerns/application_controller.rb +1 -0
  18. data/app/controllers/spotlight/concerns/catalog_search_context.rb +2 -2
  19. data/app/controllers/spotlight/contacts_controller.rb +6 -6
  20. data/app/controllers/spotlight/dashboards_controller.rb +2 -2
  21. data/app/controllers/spotlight/exhibits_controller.rb +19 -19
  22. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  23. data/app/controllers/spotlight/home_pages_controller.rb +7 -7
  24. data/app/controllers/spotlight/lock_controller.rb +1 -1
  25. data/app/controllers/spotlight/metadata_configurations_controller.rb +2 -2
  26. data/app/controllers/spotlight/pages_controller.rb +4 -3
  27. data/app/controllers/spotlight/search_configurations_controller.rb +6 -6
  28. data/app/controllers/spotlight/searches_controller.rb +22 -22
  29. data/app/controllers/spotlight/solr_controller.rb +1 -1
  30. data/app/controllers/spotlight/translations_controller.rb +8 -10
  31. data/app/controllers/spotlight/versions_controller.rb +2 -1
  32. data/app/helpers/spotlight/application_helper.rb +33 -17
  33. data/app/helpers/spotlight/crud_link_helpers.rb +12 -2
  34. data/app/helpers/spotlight/pages_helper.rb +1 -1
  35. data/app/helpers/spotlight/roles_helper.rb +2 -2
  36. data/app/helpers/spotlight/title_helper.rb +1 -1
  37. data/app/helpers/spotlight/translations_helper.rb +1 -3
  38. data/app/javascript/spotlight/admin/add_another.es6 +24 -0
  39. data/app/javascript/spotlight/admin/add_image_selector.es6 +38 -0
  40. data/app/javascript/spotlight/admin/add_new_button.es6 +77 -0
  41. data/app/javascript/spotlight/admin/appearance.es6 +22 -0
  42. data/app/javascript/spotlight/admin/blacklight_configuration.es6 +65 -0
  43. data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/autocompleteable.js +8 -8
  44. data/app/{assets/javascripts → javascript}/spotlight/admin/block_mixins/formable.js +1 -1
  45. data/app/javascript/spotlight/admin/block_mixins/plustextable.js +58 -0
  46. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/block.js +2 -1
  47. data/app/javascript/spotlight/admin/blocks/browse_block.js +86 -0
  48. data/app/javascript/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
  49. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/iframe_block.js +7 -11
  50. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/link_to_search_block.js +0 -2
  51. data/app/javascript/spotlight/admin/blocks/oembed_block.js +41 -0
  52. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/pages_block.js +1 -1
  53. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/resources_block.js +45 -42
  54. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/rule_block.js +2 -4
  55. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/search_result_block.js +7 -9
  56. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_base_block.js +22 -22
  57. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_block.js +7 -7
  58. data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_carousel_block.js +14 -15
  59. data/app/javascript/spotlight/admin/blocks/uploaded_items_block.js +147 -0
  60. data/app/javascript/spotlight/admin/checkbox_submit.es6 +75 -0
  61. data/app/javascript/spotlight/admin/copy_email_addresses.es6 +5 -0
  62. data/app/{assets/javascripts/spotlight/admin/crop.es6 → javascript/spotlight/admin/crop.js} +5 -4
  63. data/app/javascript/spotlight/admin/croppable.es6 +10 -0
  64. data/app/{assets/javascripts/spotlight/admin/edit_in_place.js → javascript/spotlight/admin/edit_in_place.es6} +6 -13
  65. data/app/javascript/spotlight/admin/exhibit_tag_autocomplete.es6 +39 -0
  66. data/app/javascript/spotlight/admin/exhibits.es6 +59 -0
  67. data/app/{assets/javascripts/spotlight/admin/form_observer.js → javascript/spotlight/admin/form_observer.es6} +23 -21
  68. data/app/javascript/spotlight/admin/index.js +85 -0
  69. data/app/javascript/spotlight/admin/locks.es6 +12 -0
  70. data/app/{assets/javascripts → javascript}/spotlight/admin/multi_image_selector.js +2 -1
  71. data/app/javascript/spotlight/admin/pages.es6 +42 -0
  72. data/app/{assets/javascripts/spotlight/admin/progress_monitor.js → javascript/spotlight/admin/progress_monitor.es6} +5 -9
  73. data/app/javascript/spotlight/admin/readonly_checkbox.es6 +8 -0
  74. data/app/{assets/javascripts → javascript}/spotlight/admin/search_typeahead.js +3 -46
  75. data/app/{assets/javascripts/spotlight/admin/select_related_input.js → javascript/spotlight/admin/select_related_input.es6} +6 -3
  76. data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_controls.js +6 -4
  77. data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/block_limits.js +2 -0
  78. data/app/{assets/javascripts → javascript}/spotlight/admin/spotlight_nestable.js +4 -8
  79. data/app/javascript/spotlight/admin/tabs.es6 +8 -0
  80. data/app/{assets/javascripts/spotlight/admin/translation_progress.js → javascript/spotlight/admin/translation_progress.es6} +6 -13
  81. data/app/{assets/javascripts/spotlight/admin/users.js → javascript/spotlight/admin/users.es6} +7 -17
  82. data/app/javascript/spotlight/admin/visibility_toggle.es6 +23 -0
  83. data/app/javascript/spotlight/index.js +10 -0
  84. data/app/javascript/spotlight/spotlight.js +32 -0
  85. data/app/{assets/javascripts/spotlight/user/analytics.js → javascript/spotlight/user/analytics.es6} +4 -4
  86. data/app/{assets/javascripts/spotlight/user/browse_group_categories.js → javascript/spotlight/user/browse_group_categories.es6} +4 -13
  87. data/app/javascript/spotlight/user/carousel.es6 +5 -0
  88. data/app/{assets/javascripts/spotlight/user/clear_form_button.js → javascript/spotlight/user/clear_form_button.es6} +5 -9
  89. data/app/javascript/spotlight/user/index.js +17 -0
  90. data/app/{assets/javascripts/spotlight/user/report_a_problem.js → javascript/spotlight/user/report_a_problem.es6} +6 -15
  91. data/app/javascript/spotlight/user/zpr_links.es6 +44 -0
  92. data/app/jobs/spotlight/add_uploads_from_csv.rb +1 -2
  93. data/app/models/concerns/spotlight/browse_category_search_builder.rb +1 -10
  94. data/app/models/concerns/spotlight/exhibit_defaults.rb +1 -1
  95. data/app/models/concerns/spotlight/exhibit_documents.rb +2 -2
  96. data/app/models/concerns/spotlight/resources/web.rb +1 -1
  97. data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +1 -1
  98. data/app/models/concerns/spotlight/solr_document/finder.rb +2 -2
  99. data/app/models/concerns/spotlight/solr_document.rb +2 -2
  100. data/app/models/concerns/spotlight/translatables.rb +1 -1
  101. data/app/models/sir_trevor_rails/blocks/displayable.rb +2 -2
  102. data/app/models/sir_trevor_rails/blocks/solr_documents_block.rb +17 -6
  103. data/app/models/spotlight/analytics/ga.rb +5 -5
  104. data/app/models/spotlight/blacklight_configuration.rb +12 -12
  105. data/app/models/spotlight/bulk_update.rb +1 -0
  106. data/app/models/spotlight/contact_email.rb +1 -1
  107. data/app/models/spotlight/contact_form.rb +1 -1
  108. data/app/models/spotlight/exhibit.rb +1 -1
  109. data/app/models/spotlight/featured_image.rb +1 -2
  110. data/app/models/spotlight/lock.rb +1 -1
  111. data/app/models/spotlight/main_navigation.rb +1 -5
  112. data/app/models/spotlight/page.rb +1 -1
  113. data/app/models/spotlight/resources/iiif_manifest.rb +4 -4
  114. data/app/models/spotlight/resources/iiif_service.rb +1 -1
  115. data/app/models/spotlight/resources/upload.rb +3 -6
  116. data/app/models/spotlight/search.rb +2 -2
  117. data/app/models/translation.rb +2 -0
  118. data/app/presenters/spotlight/iiif_manifest_presenter.rb +2 -1
  119. data/app/services/spotlight/etl/solr_loader.rb +1 -1
  120. data/app/services/spotlight/iiif_resource_resolver.rb +10 -10
  121. data/app/uploaders/spotlight/bulk_updates_uploader.rb +1 -0
  122. data/app/views/layouts/spotlight/base.html.erb +1 -0
  123. data/app/views/shared/_exhibit_navbar.html.erb +6 -1
  124. data/app/views/spotlight/admin_users/index.html.erb +9 -3
  125. data/app/views/spotlight/browse/show.html.erb +2 -2
  126. data/app/views/spotlight/catalog/_admin_header.html.erb +3 -1
  127. data/app/views/spotlight/catalog/_document_visibility_control.html.erb +21 -2
  128. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -1
  129. data/app/views/spotlight/exhibits/_confirmation_status.html.erb +3 -1
  130. data/app/views/spotlight/exhibits/_contact.html.erb +5 -1
  131. data/app/views/spotlight/shared/_exhibit_sidebar.html.erb +2 -0
  132. data/app/views/spotlight/shared/_report_a_problem.html.erb +1 -1
  133. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -2
  134. data/app/views/spotlight/translations/_page.html.erb +6 -1
  135. data/config/locales/spotlight.en.yml +4 -9
  136. data/lib/generators/spotlight/install_generator.rb +15 -23
  137. data/lib/generators/spotlight/scaffold_resource_generator.rb +12 -12
  138. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +3 -0
  139. data/lib/generators/spotlight/templates/solr/conf/_rest_managed.json +3 -0
  140. data/lib/generators/spotlight/templates/solr/conf/admin-extra.html +31 -0
  141. data/lib/generators/spotlight/templates/solr/conf/elevate.xml +36 -0
  142. data/lib/generators/spotlight/templates/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
  143. data/lib/generators/spotlight/templates/solr/conf/protwords.txt +21 -0
  144. data/lib/generators/spotlight/templates/solr/{config → conf}/schema.xml +17 -0
  145. data/lib/generators/spotlight/templates/solr/conf/scripts.conf +24 -0
  146. data/lib/generators/spotlight/templates/solr/{config → conf}/solrconfig.xml +55 -24
  147. data/lib/generators/spotlight/templates/solr/conf/spellings.txt +2 -0
  148. data/lib/generators/spotlight/templates/solr/conf/stopwords.txt +58 -0
  149. data/lib/generators/spotlight/templates/solr/conf/stopwords_en.txt +58 -0
  150. data/lib/generators/spotlight/templates/solr/conf/synonyms.txt +31 -0
  151. data/lib/generators/spotlight/templates/solr/conf/xslt/example.xsl +132 -0
  152. data/lib/generators/spotlight/templates/solr/conf/xslt/example_atom.xsl +67 -0
  153. data/lib/generators/spotlight/templates/solr/conf/xslt/example_rss.xsl +66 -0
  154. data/lib/generators/spotlight/templates/solr/conf/xslt/luke.xsl +337 -0
  155. data/lib/generators/spotlight/templates/spotlight.js +1 -1
  156. data/lib/migration/iiif.rb +3 -7
  157. data/lib/spotlight/engine.rb +18 -16
  158. data/lib/spotlight/riiif_service.rb +31 -0
  159. data/lib/spotlight/search_state.rb +19 -0
  160. data/lib/spotlight/upload_field_config.rb +1 -1
  161. data/lib/spotlight/version.rb +1 -1
  162. data/lib/tasks/spotlight_tasks.rake +1 -1
  163. data/spec/factories/searches.rb +0 -12
  164. data/spec/fixtures/iiif_responses.rb +64 -64
  165. data/vendor/assets/javascripts/nestable.js +1 -1
  166. data/vendor/assets/javascripts/parameterize.js +2 -2
  167. data/vendor/assets/javascripts/sir-trevor.js +22460 -20591
  168. data/vendor/assets/stylesheets/sir-trevor/_icons.scss +0 -0
  169. data/vendor/assets/stylesheets/sir-trevor/_variables.scss +16 -18
  170. data/vendor/assets/stylesheets/sir-trevor/base.scss +11 -0
  171. data/vendor/assets/stylesheets/sir-trevor/block-addition-top.scss +4 -1
  172. data/vendor/assets/stylesheets/sir-trevor/block-addition.scss +3 -2
  173. data/vendor/assets/stylesheets/sir-trevor/block-controls.scss +4 -0
  174. data/vendor/assets/stylesheets/sir-trevor/block-positioner.scss +0 -0
  175. data/vendor/assets/stylesheets/sir-trevor/block-replacer.scss +0 -0
  176. data/vendor/assets/stylesheets/sir-trevor/block-ui.scss +10 -0
  177. data/vendor/assets/stylesheets/sir-trevor/block.scss +19 -5
  178. data/vendor/assets/stylesheets/sir-trevor/errors.scss +0 -0
  179. data/vendor/assets/stylesheets/sir-trevor/format-bar.scss +0 -0
  180. data/vendor/assets/stylesheets/sir-trevor/inputs.scss +0 -0
  181. data/vendor/assets/stylesheets/sir-trevor/main.scss +0 -0
  182. data/vendor/assets/stylesheets/sir-trevor/patterns/ui-popup.scss +0 -0
  183. data/vendor/assets/stylesheets/sir-trevor/utils.scss +0 -0
  184. metadata +118 -131
  185. data/app/assets/javascripts/spotlight/admin/add_another.js +0 -22
  186. data/app/assets/javascripts/spotlight/admin/add_new_button.js +0 -81
  187. data/app/assets/javascripts/spotlight/admin/appearance.js +0 -24
  188. data/app/assets/javascripts/spotlight/admin/attachments.js +0 -2
  189. data/app/assets/javascripts/spotlight/admin/blacklight_configuration.js +0 -63
  190. data/app/assets/javascripts/spotlight/admin/block_mixins/plustextable.js +0 -57
  191. data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +0 -87
  192. data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +0 -88
  193. data/app/assets/javascripts/spotlight/admin/blocks/oembed_block.js +0 -40
  194. data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +0 -145
  195. data/app/assets/javascripts/spotlight/admin/catalog_edit.js +0 -16
  196. data/app/assets/javascripts/spotlight/admin/copy_email_addresses.js +0 -9
  197. data/app/assets/javascripts/spotlight/admin/croppable.js +0 -25
  198. data/app/assets/javascripts/spotlight/admin/exhibit_tag_autocomplete.js +0 -37
  199. data/app/assets/javascripts/spotlight/admin/exhibits.js +0 -58
  200. data/app/assets/javascripts/spotlight/admin/index.js +0 -16
  201. data/app/assets/javascripts/spotlight/admin/locks.js +0 -12
  202. data/app/assets/javascripts/spotlight/admin/pages.js.erb +0 -40
  203. data/app/assets/javascripts/spotlight/admin/readonly_checkbox.js +0 -6
  204. data/app/assets/javascripts/spotlight/admin/tabs.js +0 -6
  205. data/app/assets/javascripts/spotlight/user/carousel.js +0 -3
  206. data/app/assets/javascripts/spotlight/user/index.js +0 -8
  207. data/app/assets/javascripts/spotlight/user/zpr_links.js.erb +0 -45
  208. data/vendor/assets/javascripts/MutationObserver.js +0 -625
  209. data/vendor/assets/javascripts/eventable.js +0 -205
  210. data/vendor/assets/javascripts/polyfill.min.js +0 -4
  211. /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_embed_block.js +0 -0
  212. /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_features_block.js +0 -0
  213. /data/app/{assets/javascripts → javascript}/spotlight/admin/blocks/solr_documents_grid_block.js +0 -0
  214. /data/app/{assets/javascripts/spotlight/admin/iiif.es6 → javascript/spotlight/admin/iiif.js} +0 -0
  215. /data/app/{assets/javascripts → javascript}/spotlight/admin/sir-trevor/locales.js +0 -0
@@ -0,0 +1,88 @@
1
+ /*
2
+ Sir Trevor BrowseGroupCategories
3
+ */
4
+ import Spotlight from 'spotlight'
5
+
6
+ SirTrevor.Blocks.BrowseGroupCategories = (function(){
7
+
8
+ return Spotlight.Block.Resources.extend({
9
+ type: "browse_group_categories",
10
+ icon_name: "browse",
11
+ bloodhoundOptions: function() {
12
+ var that = this;
13
+ return {
14
+ prefetch: {
15
+ url: this.autocomplete_url(),
16
+ ttl: 0,
17
+ filter: function(response) {
18
+ // Let the dom know that the response has been returned
19
+ $(that.inner).attr('data-browse-groups-fetched', true);
20
+ return response;
21
+ }
22
+ }
23
+ };
24
+ },
25
+
26
+ autocomplete_control: function() {
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
+ },
29
+ autocomplete_template: function() { return '<div class="autocomplete-item{{#unless published}} blacklight-private{{/unless}}"><span class="autocomplete-title">{{title}}</span><br/></div>' },
30
+ autocomplete_url: function() { return $(this.inner).closest('form[data-autocomplete-exhibit-browse-groups-path]').data('autocomplete-exhibit-browse-groups-path').replace("%25QUERY", "%QUERY"); },
31
+ _itemPanel: function(data) {
32
+ var index = "item_" + this.globalIndex++;
33
+ var checked;
34
+ if (data.display == "true") {
35
+ checked = "checked='checked'"
36
+ } else {
37
+ checked = "";
38
+ }
39
+ var resource_id = data.slug || data.id;
40
+ var markup = `
41
+ <li class="field form-inline dd-item dd3-item" data-resource-id="${resource_id}" data-id="${index}" id="${this.formId("item_" + data.id)}">
42
+ <input type="hidden" name="item[${index}][id]" value="${resource_id}" />
43
+ <input type="hidden" name="item[${index}][title]" value="${data.title}" />
44
+ <input data-property="weight" type="hidden" name="item[${index}][weight]" value="${data.weight}" />
45
+ <div class="card d-flex dd3-content">
46
+ <div class="dd-handle dd3-handle">${i18n.t("blocks:resources:panel:drag")}</div>
47
+ <div class="d-flex card-header item-grid justify-content-between">
48
+ <div class="d-flex flex-grow-1">
49
+ <div class="checkbox">
50
+ <input name="item[${index}][display]" type="hidden" value="false" />
51
+ <input name="item[${index}][display]" id="${this.formId(this.display_checkbox + '_' + data.id)}" type="checkbox" ${checked} class="item-grid-checkbox" value="true" />
52
+ <label class="sr-only" for="${this.formId(this.display_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:panel:display")}</label>
53
+ </div>
54
+ <div class="main">
55
+ <div class="title card-title">${data.title}</div>
56
+ </div>
57
+ </div>
58
+ <div class="d-flex">
59
+ <a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
60
+ </div>
61
+ </div>
62
+ </div>
63
+ </li>`
64
+
65
+ const panel = $(markup);
66
+ var context = this;
67
+
68
+ $('a[data-item-grid-panel-remove]', panel).on('click', function(e) {
69
+ e.preventDefault();
70
+ $(this).closest('.field').remove();
71
+ context.afterPanelDelete();
72
+
73
+ });
74
+
75
+ this.afterPanelRender(data, panel);
76
+
77
+ return panel;
78
+ },
79
+
80
+ item_options: function() { return `
81
+ '<label>
82
+ <input type="hidden" name="display-item-counts" value="false" />
83
+ <input type="checkbox" name="display-item-counts" value="true" checked />
84
+ ${i18n.t("blocks:browse_group_categories:item_counts")}
85
+ </label>`
86
+ },
87
+ });
88
+ })();
@@ -19,16 +19,12 @@ SirTrevor.Blocks.Iframe = (function(){
19
19
  icon_name: "iframe",
20
20
 
21
21
  editorHTML: function() {
22
- return _.template(this.template, this)(this);
23
- },
24
-
25
- template: [
26
- '<div class="clearfix">',
27
- '<div class="widget-header">',
28
- '<%= description() %>',
29
- '</div>',
30
- '<textarea name="code" class="form-control" rows="5" placeholder="<%= i18n.t("blocks:iframe:placeholder") %>"></textarea>',
31
- '</div>'
32
- ].join("\n"),
22
+ return `<div class="clearfix">
23
+ <div class="widget-header">
24
+ ${this.description()}
25
+ </div>
26
+ <textarea name="code" class="form-control" rows="5" placeholder="${i18n.t("blocks:iframe:placeholder")}"></textarea>
27
+ </div>`;
28
+ }
33
29
  });
34
30
  })();
@@ -1,5 +1,3 @@
1
- //= require spotlight/admin/blocks/browse_block
2
-
3
1
  SirTrevor.Blocks.LinkToSearch = (function(){
4
2
 
5
3
  return SirTrevor.Blocks.Browse.extend({
@@ -0,0 +1,41 @@
1
+ /*
2
+ Sir Trevor ItemText Block.
3
+ This block takes an ID,
4
+ fetches the record from solr,
5
+ displays the image, title,
6
+ and any provided text
7
+ and displays them.
8
+ */
9
+ import Spotlight from 'spotlight'
10
+
11
+ SirTrevor.Blocks.Oembed = (function(){
12
+
13
+ return Spotlight.Block.extend({
14
+ plustextable: true,
15
+
16
+ id_key:"url",
17
+
18
+ type: "oembed",
19
+
20
+ title: function() { return i18n.t('blocks:oembed:title'); },
21
+ description: function() { return i18n.t('blocks:oembed:description'); },
22
+
23
+ icon_name: "oembed",
24
+ show_heading: false,
25
+
26
+ editorHTML: function () {
27
+ return `<div class="form oembed-text-admin clearfix">
28
+ <div class="widget-header">
29
+ ${this.description()}
30
+ </div>
31
+ <div class="row">
32
+ <div class="form-group col-md-8">
33
+ <label for="${this.formId(id_key)}">${i18n.t("blocks:oembed:url")}</label>
34
+ <input name="${id_key}" class="form-control col-md-6" type="text" id="${this.formId(id_key)}" />
35
+ </div>
36
+ </div>
37
+ ${this.text_area()}
38
+ </div>`
39
+ }
40
+ });
41
+ })();
@@ -1,4 +1,4 @@
1
- //= require spotlight/admin/blocks/resources_block
1
+ import Spotlight from 'spotlight'
2
2
 
3
3
  SirTrevor.Blocks.FeaturedPages = (function(){
4
4
 
@@ -1,3 +1,6 @@
1
+ import Spotlight from 'spotlight'
2
+ import SpotlightNestable from 'spotlight_nestable'
3
+
1
4
  Spotlight.Block.Resources = (function(){
2
5
 
3
6
  return Spotlight.Block.extend({
@@ -34,39 +37,39 @@ Spotlight.Block.Resources = (function(){
34
37
  checked = "";
35
38
  }
36
39
  var resource_id = data.slug || data.id;
37
- var markup = [
38
- '<li class="field form-inline dd-item dd3-item" data-resource-id="' + resource_id + '" data-id="' + index + '" id="' + this.formId("item_" + data.id) + '">',
39
- '<input type="hidden" name="item[' + index + '][id]" value="' + resource_id + '" />',
40
- '<input type="hidden" name="item[' + index + '][title]" value="' + data.title + '" />',
41
- this._itemPanelIiifFields(index, data),
42
- '<input data-property="weight" type="hidden" name="item[' + index + '][weight]" value="' + data.weight + '" />',
43
- '<div class="card d-flex dd3-content">',
44
- '<div class="dd-handle dd3-handle"><%= i18n.t("blocks:resources:panel:drag") %></div>',
45
- '<div class="card-header item-grid">',
46
- '<div class="d-flex">',
47
- '<div class="checkbox">',
48
- '<input name="item[' + index + '][display]" type="hidden" value="false" />',
49
- '<input name="item[' + index + '][display]" id="'+ this.formId(this.display_checkbox + '_' + data.id) + '" type="checkbox" ' + checked + ' class="item-grid-checkbox" value="true" />',
50
- '<label class="sr-only" for="'+ this.formId(this.display_checkbox + '_' + data.id) +'"><%= i18n.t("blocks:resources:panel:display") %></label>',
51
- '</div>',
52
- '<div class="pic">',
53
- '<img class="img-thumbnail" src="' + (data.thumbnail_image_url || ((data.iiif_tilesource || "").replace("/info.json", "/full/!100,100/0/default.jpg"))) + '" />',
54
- '</div>',
55
- '<div class="main">',
56
- '<div class="title card-title">' + data.title + '</div>',
57
- '<div>' + (data.slug || data.id) + '</div>',
58
- '</div>',
59
- '<div class="remove float-right">',
60
- '<a data-item-grid-panel-remove="true" href="#"><%= i18n.t("blocks:resources:panel:remove") %></a>',
61
- '</div>',
62
- '</div>',
63
- '<div data-panel-image-pagination="true"></div>',
64
- '</div>',
65
- '</div>',
66
- '</li>'
67
- ].join("\n");
68
-
69
- var panel = $(_.template(markup)(this));
40
+ var markup = `
41
+ <li class="field form-inline dd-item dd3-item" data-resource-id="${resource_id}" data-id="${index}" id="${this.formId("item_" + data.id)}">
42
+ <input type="hidden" name="item[${index}][id]" value="${resource_id}" />
43
+ <input type="hidden" name="item[${index}][title]" value="${data.title}" />
44
+ ${this._itemPanelIiifFields(index, data)}
45
+ <input data-property="weight" type="hidden" name="item[${index}][weight]" value="${data.weight}" />
46
+ <div class="card d-flex dd3-content">
47
+ <div class="dd-handle dd3-handle">${i18n.t("blocks:resources:panel:drag")}</div>
48
+ <div class="card-header item-grid">
49
+ <div class="d-flex">
50
+ <div class="checkbox">
51
+ <input name="item[${index}][display]" type="hidden" value="false" />
52
+ <input name="item[${index}][display]" id="${this.formId(this.display_checkbox + '_' + data.id)}" type="checkbox" ${checked} class="item-grid-checkbox" value="true" />
53
+ <label class="sr-only" for="${this.formId(this.display_checkbox + '_' + data.id)}">${i18n.t("blocks:resources:panel:display")}</label>
54
+ </div>
55
+ <div class="pic">
56
+ <img class="img-thumbnail" src="${(data.thumbnail_image_url || ((data.iiif_tilesource || "").replace("/info.json", "/full/!100,100/0/default.jpg")))}" />
57
+ </div>
58
+ <div class="main">
59
+ <div class="title card-title">${data.title}</div>
60
+ <div>${(data.slug || data.id)}</div>
61
+ </div>
62
+ <div class="remove float-right">
63
+ <a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
64
+ </div>
65
+ </div>
66
+ <div data-panel-image-pagination="true"></div>
67
+ </div>
68
+ </div>
69
+ </li>
70
+ `
71
+
72
+ const panel = $(markup);
70
73
  var context = this;
71
74
 
72
75
  $('.remove a', panel).on('click', function(e) {
@@ -102,7 +105,7 @@ Spotlight.Block.Resources = (function(){
102
105
  if (this.plustextable) {
103
106
  templates.push(this.text_area());
104
107
  }
105
- return _.template(templates.join("<hr />\n"))(this);
108
+ return templates.join("<hr />\n");
106
109
  },
107
110
 
108
111
  items_selector: function() { return [
@@ -119,14 +122,14 @@ Spotlight.Block.Resources = (function(){
119
122
  '</div>'].join("\n")
120
123
  },
121
124
 
122
- template: [
123
- '<div class="form resources-admin clearfix">',
124
- '<div class="widget-header">',
125
- '<%= description() %>',
126
- '</div>',
127
- '<%= content() %>',
128
- '</div>'
129
- ].join("\n"),
125
+ editorHTML: function() {
126
+ return `<div class="form resources-admin clearfix">
127
+ <div class="widget-header">
128
+ ${this.description()}
129
+ </div>
130
+ ${this.content()}
131
+ </div>`
132
+ },
130
133
 
131
134
  onBlockRender: function() {
132
135
  SpotlightNestable.init($('[data-behavior="nestable"]', this.inner));
@@ -17,9 +17,7 @@ SirTrevor.Blocks.Rule = (function(){
17
17
  icon_name: "rule",
18
18
 
19
19
  editorHTML: function() {
20
- return _.template(this.template, this)(this);
21
- },
22
-
23
- template: '<hr />'
20
+ return '<hr />'
21
+ }
24
22
  });
25
23
  })();
@@ -13,7 +13,7 @@ SirTrevor.Blocks.SearchResults = (function(){
13
13
  plustextable: false,
14
14
 
15
15
  content: function() {
16
- return _.template([this.items_selector()].join("<hr />\n"))(this);
16
+ return this.items_selector()
17
17
  },
18
18
 
19
19
  item_options: function() {
@@ -21,14 +21,12 @@ SirTrevor.Blocks.SearchResults = (function(){
21
21
  var fields = $('[data-blacklight-configuration-search-views]').data('blacklight-configuration-search-views');
22
22
 
23
23
  return $.map(fields, function(field) {
24
- checkbox = ""
25
- checkbox += "<div>";
26
- checkbox += "<label for='" + block.formId(block.view_key + field.key) + "'>";
27
- checkbox += "<input id='" + block.formId(block.view_key + field.key) + "' name='" + block.view_key + "[]' type='checkbox' value='" + field.key + "' /> ";
28
- checkbox += field.label;
29
- checkbox += "</label>";
30
- checkbox += "</div>";
31
- return checkbox;
24
+ return `<div>
25
+ <label for='${block.formId(block.view_key + field.key)}'>
26
+ <input id='${block.formId(block.view_key + field.key)}' name='${block.view_key}[]' type='checkbox' value='${field.key}' />
27
+ ${field.label}
28
+ </label>
29
+ </div>`
32
30
  }).join("\n");
33
31
  },
34
32
 
@@ -1,4 +1,5 @@
1
- //= require spotlight/admin/blocks/resources_block
1
+ import Iiif from '../iiif'
2
+ import Spotlight from 'spotlight'
2
3
 
3
4
  SirTrevor.Blocks.SolrDocumentsBase = (function(){
4
5
 
@@ -23,26 +24,26 @@ SirTrevor.Blocks.SolrDocumentsBase = (function(){
23
24
 
24
25
  item_options: function() { return this.caption_options(); },
25
26
 
26
- caption_options: function() { return [
27
- '<div class="field-select primary-caption" data-behavior="item-caption-admin">',
28
- '<input name="<%= show_primary_field_key %>" type="hidden" value="false" />',
29
- '<input data-input-select-target="#<%= formId(primary_field_key) %>" name="<%= show_primary_field_key %>" id="<%= formId(show_primary_field_key) %>" type="checkbox" value="true" />',
30
- '<label for="<%= formId(show_primary_field_key) %>"><%= i18n.t("blocks:solr_documents:caption:primary") %></label>',
31
- '<select data-input-select-target="#<%= formId(show_primary_field_key) %>" name="<%= primary_field_key %>" id="<%= formId(primary_field_key) %>">',
32
- '<option value=""><%= i18n.t("blocks:solr_documents:caption:placeholder") %></option>',
33
- '<%= caption_option_values() %>',
34
- '</select>',
35
- '</div>',
36
- '<div class="field-select secondary-caption" data-behavior="item-caption-admin">',
37
- '<input name="<%= show_secondary_field_key %>" type="hidden" value="false" />',
38
- '<input data-input-select-target="#<%= formId(secondary_field_key) %>" name="<%= show_secondary_field_key %>" id="<%= formId(show_secondary_field_key) %>" type="checkbox" value="true" />',
39
- '<label for="<%= formId(show_secondary_field_key) %>"><%= i18n.t("blocks:solr_documents:caption:secondary") %></label>',
40
- '<select data-input-select-target="#<%= formId(show_secondary_field_key) %>" name="<%= secondary_field_key %>" id="<%= formId(secondary_field_key) %>">',
41
- '<option value=""><%= i18n.t("blocks:solr_documents:caption:placeholder") %></option>',
42
- '<%= caption_option_values() %>',
43
- '</select>',
44
- '</div>',
45
- ].join("\n") },
27
+ caption_options: function() { return `
28
+ <div class="field-select primary-caption" data-behavior="item-caption-admin">
29
+ <input name="${this.show_primary_field_key}" type="hidden" value="false" />
30
+ <input data-input-select-target="#${this.formId(this.primary_field_key)}" name="${this.show_primary_field_key}" id="${this.formId(this.show_primary_field_key)}" type="checkbox" value="true" />
31
+ <label for="${this.formId(this.show_primary_field_key)}">${i18n.t("blocks:solr_documents:caption:primary")}</label>
32
+ <select data-input-select-target="#${this.formId(this.show_primary_field_key)}" name="${this.primary_field_key}" id="${this.formId(this.primary_field_key)}">
33
+ <option value="">${i18n.t("blocks:solr_documents:caption:placeholder")}</option>
34
+ ${this.caption_option_values()}
35
+ </select>
36
+ </div>
37
+ <div class="field-select secondary-caption" data-behavior="item-caption-admin">
38
+ <input name="${this.show_secondary_field_key}" type="hidden" value="false" />
39
+ <input data-input-select-target="#${this.formId(this.secondary_field_key)}" name="${this.show_secondary_field_key}" id="${this.formId(this.show_secondary_field_key)}" type="checkbox" value="true" />
40
+ <label for="${this.formId(this.show_secondary_field_key)}">${i18n.t("blocks:solr_documents:caption:secondary")}</label>
41
+ <select data-input-select-target="#${this.formId(this.show_secondary_field_key)}" name="${this.secondary_field_key}" id="${this.formId(this.secondary_field_key)}">
42
+ <option value="">${i18n.t("blocks:solr_documents:caption:placeholder")}</option>
43
+ ${this.caption_option_values()}
44
+ </select>
45
+ </div>
46
+ `},
46
47
 
47
48
  _itemPanelIiifFields: function(index, data) {
48
49
  return [
@@ -85,7 +86,6 @@ SirTrevor.Blocks.SolrDocumentsBase = (function(){
85
86
 
86
87
  $.ajax(manifestUrl).done(
87
88
  function(manifest) {
88
- var Iiif = spotlightAdminIiif;
89
89
  var iiifManifest = new Iiif(manifestUrl, manifest);
90
90
 
91
91
  var thumbs = iiifManifest.imagesArray();
@@ -10,13 +10,13 @@ SirTrevor.Blocks.SolrDocuments = (function(){
10
10
  item_options: function() { return this.caption_options() + this.zpr_option(); },
11
11
 
12
12
  zpr_option: function() {
13
- return [
14
- '<div>',
15
- '<input name="<%= zpr_key %>" type="hidden" value="false" />',
16
- '<input name="<%= zpr_key %>" id="<%= formId(zpr_key) %>" data-key="<%= zpr_key %>" type="checkbox" value="true" />',
17
- '<label for="<%= formId(zpr_key) %>"><%= i18n.t("blocks:solr_documents:zpr:title") %></label>',
18
- '</div>'
19
- ].join("\n");
13
+ return `
14
+ <div>
15
+ <input name="${this.zpr_key}" type="hidden" value="false" />
16
+ <input name="${this.zpr_key}" id="${this.formId(this.zpr_key)}" data-key="${this.zpr_key}" type="checkbox" value="true" />
17
+ <label for="${this.formId(this.zpr_key)}">${i18n.t("blocks:solr_documents:zpr:title")}</label>
18
+ </div>
19
+ `
20
20
  },
21
21
 
22
22
  zpr_key: 'zpr_link'
@@ -25,21 +25,20 @@ SirTrevor.Blocks.SolrDocumentsCarousel = (function(){
25
25
  },
26
26
 
27
27
  item_options: function() {
28
- return [this.caption_options(),
29
- '<div class="field-select auto-cycle-images" data-behavior="auto-cycle-images">',
30
- '<input name="<%= auto_play_images_key %>" type="hidden" value="false" />',
31
- '<input name="<%= auto_play_images_key %>" id="<%= formId(auto_play_images_key) %>" data-key="<%= auto_play_images_key %>" type="checkbox" value="true" checked/>',
32
- '<label for="<%= formId(auto_play_images_key) %>"><%= i18n.t("blocks:solr_documents_carousel:interval:title") %></label>',
33
- '<select name="<%= auto_play_images_interval_key %>" id="<%= formId(auto_play_images_interval_key) %>" data=key="<%= auto_play_images_interval_key %>">',
34
- '<option value=""><%= i18n.t("blocks:solr_documents_carousel:interval:placeholder") %></option>',
35
- '<%= addCarouselCycleOptions(carouselCycleTimesInSeconds) %>',
36
- '</select>',
37
- '</div>',
38
- '<div class="field-select max-heights" data-behavior="max-heights">',
39
- '<label for="<%= formId(max_height_key) %>"><%= i18n.t("blocks:solr_documents_carousel:height:title") %></label><br/>',
40
- '<%= addCarouselMaxHeightOptions(carouselMaxHeights) %>',
41
- '</div>',
42
- ].join("\n");
28
+ return `${this.caption_options()}
29
+ <div class="field-select auto-cycle-images" data-behavior="auto-cycle-images">
30
+ <input name="${this.auto_play_images_key}" type="hidden" value="false" />
31
+ <input name="${this.auto_play_images_key}" id="${this.formId(this.auto_play_images_key)}" data-key="${this.auto_play_images_key}" type="checkbox" value="true" checked/>
32
+ <label for="${this.formId(this.auto_play_images_key)}">${i18n.t("blocks:solr_documents_carousel:interval:title")}</label>
33
+ <select name="${this.auto_play_images_interval_key}" id="${this.formId(this.auto_play_images_interval_key)}" data=key="${this.auto_play_images_interval_key}">
34
+ <option value="">${i18n.t("blocks:solr_documents_carousel:interval:placeholder")}</option>
35
+ ${this.addCarouselCycleOptions(this.carouselCycleTimesInSeconds)}
36
+ </select>
37
+ </div>
38
+ <div class="field-select max-heights" data-behavior="max-heights">
39
+ <label for="${this.formId(this.max_height_key)}">${i18n.t("blocks:solr_documents_carousel:height:title")}</label><br/>
40
+ ${this.addCarouselMaxHeightOptions(this.carouselMaxHeights)}
41
+ </div>`
43
42
  },
44
43
 
45
44
  addCarouselCycleOptions: function(options) {
@@ -0,0 +1,147 @@
1
+ import SpotlightNestable from 'spotlight_nestable'
2
+ import Spotlight from 'spotlight'
3
+
4
+ SirTrevor.Blocks.UploadedItems = (function(){
5
+ return Spotlight.Block.Resources.extend({
6
+ plustextable: true,
7
+ uploadable: true,
8
+ autocompleteable: false,
9
+
10
+ id_key: 'file',
11
+
12
+ type: 'uploaded_items',
13
+
14
+ icon_name: 'items',
15
+
16
+ blockGroup: 'undefined',
17
+
18
+ // Clear out the default Uploadable upload options
19
+ // since we will be using our own custom controls
20
+ upload_options: { html: '' },
21
+
22
+ fileInput: function() { return $(this.inner).find('input[type="file"]'); },
23
+
24
+ onBlockRender: function(){
25
+ SpotlightNestable.init($(this.inner).find('[data-behavior="nestable"]'));
26
+
27
+ this.fileInput().on('change', (function(ev) {
28
+ this.onDrop(ev.currentTarget);
29
+ }).bind(this));
30
+ },
31
+
32
+ onDrop: function(transferData){
33
+ var file = transferData.files[0],
34
+ urlAPI = (typeof URL !== "undefined") ? URL : (typeof webkitURL !== "undefined") ? webkitURL : null;
35
+
36
+ // Handle one upload at a time
37
+ if (/image/.test(file.type)) {
38
+ this.loading();
39
+
40
+ this.uploader(
41
+ file,
42
+ function(data) {
43
+ this.createItemPanel(data);
44
+ this.fileInput().val('');
45
+ this.ready();
46
+ },
47
+ function(error) {
48
+ this.addMessage(i18n.t('blocks:image:upload_error'));
49
+ this.ready();
50
+ }
51
+ );
52
+ }
53
+ },
54
+
55
+ title: function() { return i18n.t('blocks:uploaded_items:title'); },
56
+ description: function() { return i18n.t('blocks:uploaded_items:description'); },
57
+
58
+ globalIndex: 0,
59
+
60
+ _itemPanel: function(data) {
61
+ var index = "file_" + this.globalIndex++;
62
+ var checked = 'checked="checked"';
63
+
64
+ if (data.display == 'false') {
65
+ checked = '';
66
+ }
67
+
68
+ var dataId = data.id || data.uid;
69
+ var dataTitle = data.title || data.name;
70
+ var dataUrl = data.url || data.file.url;
71
+
72
+ var markup = `
73
+ <li class="field form-inline dd-item dd3-item" data-id="${index}" id="${this.formId("item_" + dataId)}">
74
+ <input type="hidden" name="item[${index}][id]" value="${dataId}" />
75
+ <input type="hidden" name="item[${index}][title]" value="${dataTitle}" />
76
+ <input type="hidden" name="item[${index}][url]" data-item-grid-thumbnail="true" value="${dataUrl}"/>
77
+ <input data-property="weight" type="hidden" name="item[${index}][weight]" value="${data.weight}" />
78
+ <div class="card d-flex dd3-content">
79
+ <div class="dd-handle dd3-handle">${i18n.t("blocks:resources:panel:drag")}</div>
80
+ <div class="card-header d-flex item-grid">
81
+ <div class="checkbox">
82
+ <input name="item[${index}][display]" type="hidden" value="false" />
83
+ <input name="item[${index}][display]" id="${this.formId(this.display_checkbox + '_' + dataId)}" type="checkbox" ${checked} class="item-grid-checkbox" value="true" />
84
+ <label class="sr-only" for="${this.formId(this.display_checkbox + '_' + dataId)}">${i18n.t("blocks:resources:panel:display")}</label>
85
+ </div>
86
+ <div class="pic">
87
+ <img class="img-thumbnail" src="${dataUrl}" />
88
+ </div>
89
+ <div class="main form-horizontal">
90
+ <div class="title card-title">${dataTitle}</div>
91
+ <div class="field row mr-3">
92
+ <label for="${this.formId('caption_' + dataId)}" class="col-form-label col-md-3">${i18n.t("blocks:uploaded_items:caption")}</label>
93
+ <input type="text" class="form-control col" id="${this.formId('caption_' + dataId)}" name="item[${index}][caption]" data-field="caption"/>
94
+ </div>
95
+ <div class="field row mr-3">
96
+ <label for="${this.formId('link_' + dataId)}" class="col-form-label col-md-3">${i18n.t("blocks:uploaded_items:link")}</label>
97
+ <input type="text" class="form-control col" id="${this.formId('link_' + dataId)}" name="item[${index}][link]" data-field="link"/>
98
+ </div>
99
+ </div>
100
+ <div class="remove float-right">
101
+ <a data-item-grid-panel-remove="true" href="#">${i18n.t("blocks:resources:panel:remove")}</a>
102
+ </div>
103
+ </div>
104
+ </li>`
105
+
106
+ const panel = $(markup);
107
+ panel.find('[data-field="caption"]').val(data.caption);
108
+ panel.find('[data-field="link"]').val(data.link);
109
+ var context = this;
110
+
111
+ $('.remove a', panel).on('click', function(e) {
112
+ e.preventDefault();
113
+ $(this).closest('.field').remove();
114
+ context.afterPanelDelete();
115
+ });
116
+
117
+ this.afterPanelRender(data, panel);
118
+
119
+ return panel;
120
+ },
121
+
122
+ editorHTML: function() {
123
+ return `<div class="form oembed-text-admin clearfix">
124
+ <div class="widget-header">
125
+ ${this.description()}
126
+ </div>
127
+ <div class="row">
128
+ <div class="form-group col-md-8">
129
+ <div class="panels dd nestable-item-grid" data-behavior="nestable" data-max-depth="1">
130
+ <ol class="dd-list">
131
+ </ol>
132
+ </div>,
133
+ <input type="file" id="uploaded_item_url" name="file[file_0][file_data]" />
134
+ </div>'
135
+ <div class="col-md-4">
136
+ <input name="${this.zpr_key}" type="hidden" value="false" />
137
+ <input name="${this.zpr_key}" id="${this.formId(this.zpr_key)}" data-key=${this.zpr_key}" type="checkbox" value="true" />
138
+ <label for="${this.formId(this.zpr_key)}">${ i18n.t("blocks:solr_documents:zpr:title")}</label>
139
+ </div>
140
+ </div>
141
+ ${this.text_area()}
142
+ </div>`
143
+ },
144
+
145
+ zpr_key: 'zpr_link'
146
+ });
147
+ })();