blacklight-spotlight 3.0.3 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/spotlight/admin/blocks/block.js +4 -0
  4. data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +2 -4
  5. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +2 -2
  6. data/app/controllers/concerns/spotlight/controller.rb +13 -12
  7. data/app/controllers/spotlight/attachments_controller.rb +1 -1
  8. data/app/controllers/spotlight/custom_search_fields_controller.rb +1 -1
  9. data/app/controllers/spotlight/pages_controller.rb +2 -6
  10. data/app/controllers/spotlight/searches_controller.rb +6 -1
  11. data/app/helpers/spotlight/application_helper.rb +1 -1
  12. data/app/helpers/spotlight/job_trackers_helper.rb +1 -1
  13. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  14. data/app/jobs/spotlight/reindex_exhibit_job.rb +9 -1
  15. data/app/mailers/spotlight/confirmation_mailer.rb +2 -1
  16. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +2 -2
  17. data/app/models/spotlight/contact_email.rb +1 -1
  18. data/app/models/spotlight/page.rb +8 -0
  19. data/app/models/spotlight/page_configurations.rb +1 -1
  20. data/app/services/spotlight/exhibit_import_export_service.rb +1 -1
  21. data/app/views/layouts/spotlight/base.html.erb +5 -2
  22. data/app/views/shared/_body_preamble.html.erb +0 -0
  23. data/app/views/shared/_footer.html.erb +0 -1
  24. data/app/views/shared/_masthead.html.erb +1 -1
  25. data/app/views/shared/_user_util_links.html.erb +8 -2
  26. data/app/views/spotlight/catalog/admin.html.erb +1 -1
  27. data/app/views/spotlight/confirmation_mailer/confirmation_instructions.html.erb +3 -3
  28. data/app/views/spotlight/exhibits/_import.html.erb +1 -1
  29. data/app/views/spotlight/exhibits/_languages.html.erb +2 -2
  30. data/app/views/spotlight/filters/_form.html.erb +1 -1
  31. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  32. data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +1 -1
  33. data/app/views/spotlight/search_configurations/_facet_metadata.html.erb +4 -2
  34. data/app/views/spotlight/search_configurations/_facets.html.erb +1 -1
  35. data/app/views/spotlight/searches/_form.html.erb +1 -1
  36. data/app/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb +1 -1
  37. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -0
  38. data/app/views/spotlight/translations/_browse_categories.html.erb +1 -1
  39. data/app/views/spotlight/translations/_groups.html.erb +1 -1
  40. data/app/views/spotlight/translations/_import.html.erb +1 -1
  41. data/app/views/spotlight/translations/_metadata.html.erb +1 -1
  42. data/app/views/spotlight/translations/_search_fields.html.erb +1 -1
  43. data/config/i18n-tasks.yml +1 -1
  44. data/config/locales/spotlight.en.yml +13 -4
  45. data/lib/generators/spotlight/install_generator.rb +16 -7
  46. data/lib/generators/spotlight/templates/config/initializers/translation.rb +13 -11
  47. data/lib/spotlight/engine.rb +3 -1
  48. data/lib/spotlight/version.rb +1 -1
  49. data/lib/tasks/spotlight_tasks.rake +21 -3
  50. data/spec/examples.txt +1508 -1496
  51. data/spec/features/edit_search_fields_spec.rb +1 -1
  52. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +2 -0
  53. data/spec/features/report_a_problem_spec.rb +1 -0
  54. data/spec/fixtures/iiif_responses.rb +81 -81
  55. data/spec/helpers/spotlight/pages_helper_spec.rb +1 -1
  56. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +19 -1
  57. data/spec/models/solr_document_spec.rb +3 -3
  58. data/spec/models/spotlight/page_configurations_spec.rb +2 -2
  59. data/spec/models/spotlight/page_spec.rb +1 -1
  60. data/spec/spec_helper.rb +1 -1
  61. data/spec/test_app_templates/catalog_controller.rb +3 -4
  62. data/spec/views/spotlight/pages/show.html.erb_spec.rb +17 -6
  63. data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +27 -1
  64. data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -1
  65. metadata +14 -9
  66. data/spec/views/shared/_footer.html.erb_spec.rb +0 -15
@@ -39,8 +39,7 @@ module Spotlight
39
39
 
40
40
  def friendly_id
41
41
  gem 'friendly_id'
42
- # we need to immediately run `bundle install` while pointing at github.
43
- Bundler.with_clean_env { run 'bundle install' }
42
+ bundle_install
44
43
  generate 'friendly_id'
45
44
  end
46
45
 
@@ -56,7 +55,7 @@ module Spotlight
56
55
  def sitemaps
57
56
  gem 'sitemap_generator'
58
57
 
59
- Bundler.with_clean_env { run 'bundle install' }
58
+ bundle_install
60
59
 
61
60
  copy_file 'config/sitemap.rb', 'config/sitemap.rb'
62
61
 
@@ -91,7 +90,7 @@ module Spotlight
91
90
  end
92
91
 
93
92
  def add_model_mixin
94
- if File.exist? 'app/models/solr_document.rb'
93
+ if File.exist? File.expand_path('app/models/solr_document.rb', destination_root)
95
94
  inject_into_file 'app/models/solr_document.rb', after: 'include Blacklight::Solr::Document' do
96
95
  "\n include Spotlight::SolrDocument\n"
97
96
  end
@@ -101,7 +100,7 @@ module Spotlight
101
100
  end
102
101
 
103
102
  def add_solr_indexing_mixin
104
- if File.exist? 'app/models/solr_document.rb'
103
+ if File.exist? File.expand_path('app/models/solr_document.rb', destination_root)
105
104
  inject_into_file 'app/models/solr_document.rb', after: "include Spotlight::SolrDocument\n" do
106
105
  "\n include #{options[:solr_update_class]}\n"
107
106
  end
@@ -111,7 +110,7 @@ module Spotlight
111
110
  end
112
111
 
113
112
  def add_search_builder_mixin
114
- if File.exist? 'app/models/search_builder.rb'
113
+ if File.exist? File.expand_path('app/models/search_builder.rb', destination_root)
115
114
  inject_into_file 'app/models/search_builder.rb', after: "include Blacklight::Solr::SearchBuilderBehavior\n" do
116
115
  "\n include Spotlight::SearchBuilder\n"
117
116
  end
@@ -126,12 +125,13 @@ module Spotlight
126
125
 
127
126
  def add_osd_viewer
128
127
  gem 'blacklight-gallery', '~> 3.0'
128
+ bundle_install
129
129
  generate 'blacklight_gallery:install'
130
130
  end
131
131
 
132
132
  def add_oembed
133
133
  gem 'blacklight-oembed', '~> 1.0'
134
- Bundler.with_clean_env { run 'bundle install' }
134
+ bundle_install
135
135
  generate 'blacklight_oembed:install'
136
136
  copy_file 'config/initializers/oembed.rb'
137
137
  end
@@ -160,6 +160,7 @@ module Spotlight
160
160
 
161
161
  def generate_devise_invitable
162
162
  gem 'devise_invitable'
163
+ bundle_install
163
164
  generate 'devise_invitable:install'
164
165
  generate 'devise_invitable', 'User'
165
166
  end
@@ -167,5 +168,13 @@ module Spotlight
167
168
  def add_translations
168
169
  copy_file 'config/initializers/translation.rb'
169
170
  end
171
+
172
+ private
173
+
174
+ def bundle_install
175
+ inside destination_root do
176
+ Bundler.with_clean_env { run 'bundle install' }
177
+ end
178
+ end
170
179
  end
171
180
  end
@@ -5,17 +5,19 @@ require 'i18n/backend/fallbacks'
5
5
 
6
6
  Translation = I18n::Backend::ActiveRecord::Translation
7
7
 
8
- if Translation.table_exists?
9
- ##
10
- # Sets up the new Spotlight Translation backend, backed by ActiveRecord. To
11
- # turn on the ActiveRecord backend, uncomment the following lines.
8
+ ActiveSupport::Reloader.to_prepare do
9
+ if Translation.table_exists?
10
+ ##
11
+ # Sets up the new Spotlight Translation backend, backed by ActiveRecord. To
12
+ # turn on the ActiveRecord backend, uncomment the following lines.
12
13
 
13
- I18n.backend = I18n::Backend::ActiveRecord.new
14
- I18n::Backend::ActiveRecord.include I18n::Backend::Memoize
15
- Translation.include Spotlight::CustomTranslationExtension
16
- I18n::Backend::Simple.include I18n::Backend::Memoize
17
- I18n::Backend::Simple.include I18n::Backend::Pluralization
18
- I18n::Backend::Simple.include I18n::Backend::Fallbacks
14
+ I18n.backend = I18n::Backend::ActiveRecord.new
15
+ I18n::Backend::ActiveRecord.include I18n::Backend::Memoize
16
+ Translation.include Spotlight::CustomTranslationExtension
17
+ I18n::Backend::Simple.include I18n::Backend::Memoize
18
+ I18n::Backend::Simple.include I18n::Backend::Pluralization
19
+ I18n::Backend::Simple.include I18n::Backend::Fallbacks
19
20
 
20
- I18n.backend = I18n::Backend::Chain.new(I18n.backend, I18n::Backend::Simple.new)
21
+ I18n.backend = I18n::Backend::Chain.new(I18n.backend, I18n::Backend::Simple.new)
22
+ end
21
23
  end
@@ -179,7 +179,9 @@ module Spotlight
179
179
  config.analytics_provider = nil
180
180
 
181
181
  initializer 'analytics.initialize' do
182
- Spotlight::Engine.config.analytics_provider = Spotlight::Analytics::Ga
182
+ ActiveSupport::Reloader.to_prepare do
183
+ Spotlight::Engine.config.analytics_provider = Spotlight::Analytics::Ga
184
+ end
183
185
  end
184
186
 
185
187
  # If you use Google Analytics, you need to wire your site to report to a Google Analytics property.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.0.3'
4
+ VERSION = '3.3.0'
5
5
  end
@@ -18,10 +18,10 @@ namespace :spotlight do
18
18
 
19
19
  desc 'Create a new exhibit'
20
20
  task exhibit: :environment do
21
- print 'Exhibit title: '
22
- title = $stdin.gets.chomp
21
+ title = prompt_for_title
22
+ slug = prompt_for_slug
23
23
 
24
- exhibit = Spotlight::Exhibit.create!(title: title)
24
+ exhibit = Spotlight::Exhibit.create!({ title: title, slug: slug })
25
25
 
26
26
  puts 'Who can admin this exhibit?'
27
27
 
@@ -88,11 +88,15 @@ namespace :spotlight do
88
88
  end
89
89
 
90
90
  def prompt_for_email
91
+ return ENV['SPOTLIGHT_USER_EMAIL'] if ENV['SPOTLIGHT_USER_EMAIL']
92
+
91
93
  print 'Email: '
92
94
  $stdin.gets.chomp
93
95
  end
94
96
 
95
97
  def prompt_for_password
98
+ return ENV['SPOTLIGHT_USER_PASSWORD'] if ENV['SPOTLIGHT_USER_PASSWORD']
99
+
96
100
  begin
97
101
  system 'stty -echo'
98
102
  print 'Password (must be 8+ characters): '
@@ -104,6 +108,20 @@ namespace :spotlight do
104
108
  password
105
109
  end
106
110
 
111
+ def prompt_for_title
112
+ return ENV['SPOTLIGHT_EXHIBIT_TITLE'] if ENV['SPOTLIGHT_EXHIBIT_TITLE']
113
+
114
+ print 'Exhibit title: '
115
+ $stdin.gets.chomp
116
+ end
117
+
118
+ def prompt_for_slug
119
+ return ENV['SPOTLIGHT_EXHIBIT_SLUG'] if ENV['SPOTLIGHT_EXHIBIT_SLUG']
120
+
121
+ print 'Exhibit URL slug: '
122
+ $stdin.gets.chomp
123
+ end
124
+
107
125
  namespace :check do
108
126
  desc 'Check the Solr connection and controller configuration'
109
127
  task :solr, [:model_name] => ['blacklight:check:solr', :environment] do |_, _args|