blacklight-spotlight 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (159) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -9
  3. data/app/assets/javascripts/spotlight/blocks/browse_block.js +1 -0
  4. data/app/assets/stylesheets/spotlight/_bootstrap_overrides.scss +1 -1
  5. data/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +2 -0
  6. data/app/assets/stylesheets/spotlight/_pages.scss +7 -1
  7. data/app/controllers/spotlight/contact_forms_controller.rb +1 -5
  8. data/app/controllers/spotlight/searches_controller.rb +7 -1
  9. data/app/helpers/spotlight/browse_helper.rb +16 -1
  10. data/app/helpers/spotlight/searches_helper.rb +8 -0
  11. data/app/mailers/spotlight/contact_mailer.rb +9 -0
  12. data/app/models/spotlight/analytics/ga.rb +14 -16
  13. data/app/models/spotlight/blacklight_configuration.rb +6 -6
  14. data/app/models/spotlight/contact_form.rb +12 -10
  15. data/app/services/spotlight/carrierwave_file_resolver.rb +8 -0
  16. data/app/views/spotlight/browse/show.html.erb +5 -1
  17. data/app/views/spotlight/contact_mailer/report_problem.html.erb +14 -0
  18. data/app/views/spotlight/dashboards/analytics.html.erb +1 -3
  19. data/app/views/spotlight/searches/_form.html.erb +5 -0
  20. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +4 -3
  21. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +3 -2
  22. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +3 -2
  23. data/config/locales/spotlight.en.yml +1 -0
  24. data/db/migrate/20160711121314_add_default_view_to_spotlight_searches.rb +5 -0
  25. data/lib/generators/spotlight/install_generator.rb +6 -0
  26. data/lib/generators/spotlight/templates/config/initializers/riiif.rb +7 -0
  27. data/lib/spotlight/version.rb +1 -1
  28. data/spec/controllers/application_controller_spec.rb +0 -2
  29. data/spec/controllers/spotlight/about_pages_controller_spec.rb +0 -2
  30. data/spec/controllers/spotlight/admin_users_controller_spec.rb +0 -2
  31. data/spec/controllers/spotlight/appearances_controller_spec.rb +0 -1
  32. data/spec/controllers/spotlight/application_controller_spec.rb +0 -2
  33. data/spec/controllers/spotlight/attachments_controller_spec.rb +0 -2
  34. data/spec/controllers/spotlight/browse_controller_spec.rb +0 -2
  35. data/spec/controllers/spotlight/catalog_controller_spec.rb +0 -2
  36. data/spec/controllers/spotlight/confirmations_controller_spec.rb +0 -2
  37. data/spec/controllers/spotlight/contact_forms_controller_spec.rb +5 -2
  38. data/spec/controllers/spotlight/contacts_controller_spec.rb +0 -2
  39. data/spec/controllers/spotlight/custom_fields_controller_spec.rb +0 -1
  40. data/spec/controllers/spotlight/dashboards_controller_spec.rb +0 -1
  41. data/spec/controllers/spotlight/exhibits_controller_spec.rb +1 -1
  42. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -1
  43. data/spec/controllers/spotlight/filters_controller_spec.rb +0 -2
  44. data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -2
  45. data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +0 -1
  46. data/spec/controllers/spotlight/resources_controller_spec.rb +0 -2
  47. data/spec/controllers/spotlight/roles_controller_spec.rb +0 -2
  48. data/spec/controllers/spotlight/search_configurations_controller_spec.rb +0 -1
  49. data/spec/controllers/spotlight/searches_controller_spec.rb +0 -2
  50. data/spec/controllers/spotlight/sites_controller_spec.rb +0 -2
  51. data/spec/controllers/spotlight/solr_controller_spec.rb +0 -2
  52. data/spec/controllers/spotlight/tags_controller_spec.rb +0 -2
  53. data/spec/controllers/spotlight/versions_controller_spec.rb +0 -2
  54. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +0 -1
  55. data/spec/features/about_page_spec.rb +0 -2
  56. data/spec/features/add_contacts_spec.rb +0 -2
  57. data/spec/features/add_custom_field_metadata_spec.rb +0 -2
  58. data/spec/features/add_items_spec.rb +0 -2
  59. data/spec/features/browse_category_admin_spec.rb +13 -2
  60. data/spec/features/browse_category_spec.rb +27 -2
  61. data/spec/features/catalog_spec.rb +0 -2
  62. data/spec/features/confirm_email_spec.rb +0 -2
  63. data/spec/features/create_exhibit_spec.rb +0 -2
  64. data/spec/features/create_page_spec.rb +0 -2
  65. data/spec/features/curator_items.rb +0 -3
  66. data/spec/features/dashboard_spec.rb +0 -2
  67. data/spec/features/edit_contact_spec.rb +0 -3
  68. data/spec/features/edit_search_fields_spec.rb +0 -2
  69. data/spec/features/exhibit_masthead_spec.rb +0 -2
  70. data/spec/features/exhibits/add_tags_spec.rb +0 -1
  71. data/spec/features/exhibits/administration_spec.rb +0 -1
  72. data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -1
  73. data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -1
  74. data/spec/features/exhibits_index_spec.rb +0 -2
  75. data/spec/features/feature_page_spec.rb +0 -2
  76. data/spec/features/home_page_spec.rb +0 -1
  77. data/spec/features/import_exhibit_spec.rb +0 -1
  78. data/spec/features/item_admin_spec.rb +0 -2
  79. data/spec/features/javascript/about_page_admin_spec.rb +0 -2
  80. data/spec/features/javascript/block_controls_spec.rb +0 -2
  81. data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +8 -0
  82. data/spec/features/javascript/edit_in_place_spec.rb +0 -2
  83. data/spec/features/javascript/feature_page_admin_spec.rb +0 -2
  84. data/spec/features/javascript/home_page_edit_spec.rb +0 -2
  85. data/spec/features/javascript/metadata_admin_spec.rb +0 -2
  86. data/spec/features/javascript/multi_image_select_spec.rb +0 -2
  87. data/spec/features/javascript/preview_block_spec.rb +0 -2
  88. data/spec/features/javascript/reindex_monitor_spec.rb +0 -2
  89. data/spec/features/javascript/roles_admin_spec.rb +0 -2
  90. data/spec/features/javascript/rule_block_spec.rb +0 -2
  91. data/spec/features/javascript/search_config_admin_spec.rb +0 -2
  92. data/spec/features/javascript/search_context_spec.rb +0 -2
  93. data/spec/features/main_navigation_spec.rb +0 -2
  94. data/spec/features/metadata_admin_spec.rb +0 -2
  95. data/spec/features/report_a_problem_spec.rb +0 -2
  96. data/spec/features/site_admin_management_spec.rb +0 -2
  97. data/spec/features/site_masthead_spec.rb +0 -6
  98. data/spec/features/slideshow_spec.rb +0 -2
  99. data/spec/features/tags_admin_spec.rb +0 -2
  100. data/spec/features/user_admin_spec.rb +0 -2
  101. data/spec/helpers/spotlight/application_helper_spec.rb +0 -1
  102. data/spec/helpers/spotlight/browse_helper_spec.rb +0 -1
  103. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +0 -1
  104. data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -1
  105. data/spec/helpers/spotlight/main_app_helpers_spec.rb +0 -1
  106. data/spec/helpers/spotlight/navbar_helper_spec.rb +0 -1
  107. data/spec/helpers/spotlight/pages_helper_spec.rb +0 -1
  108. data/spec/helpers/spotlight/roles_helper_spec.rb +0 -1
  109. data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -1
  110. data/spec/helpers/spotlight/title_helper_spec.rb +0 -1
  111. data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -1
  112. data/spec/jobs/spotlight/reindex_job_spec.rb +0 -1
  113. data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -1
  114. data/spec/lib/spotlight/controller_spec.rb +0 -1
  115. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -1
  116. data/spec/models/solr_document_spec.rb +0 -2
  117. data/spec/models/spotlight/ability_spec.rb +0 -1
  118. data/spec/models/spotlight/about_page_spec.rb +0 -2
  119. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +0 -2
  120. data/spec/models/spotlight/blacklight_configuration_spec.rb +10 -2
  121. data/spec/models/spotlight/contact_email_spec.rb +0 -8
  122. data/spec/models/spotlight/contact_form_spec.rb +0 -2
  123. data/spec/models/spotlight/contact_spec.rb +0 -2
  124. data/spec/models/spotlight/custom_field_spec.rb +0 -1
  125. data/spec/models/spotlight/default_thumbnailable_concern_spec.rb +0 -2
  126. data/spec/models/spotlight/exhibit_spec.rb +0 -2
  127. data/spec/models/spotlight/feature_page_spec.rb +0 -2
  128. data/spec/models/spotlight/featured_image_spec.rb +0 -2
  129. data/spec/models/spotlight/field_metadata_spec.rb +0 -2
  130. data/spec/models/spotlight/filter_spec.rb +0 -2
  131. data/spec/models/spotlight/home_page_spec.rb +0 -2
  132. data/spec/models/spotlight/image_derivatives_spec.rb +0 -2
  133. data/spec/models/spotlight/main_navigation_spec.rb +0 -2
  134. data/spec/models/spotlight/masthead_spec.rb +0 -2
  135. data/spec/models/spotlight/page_spec.rb +0 -2
  136. data/spec/models/spotlight/reindex_progress_spec.rb +0 -2
  137. data/spec/models/spotlight/resource_spec.rb +0 -2
  138. data/spec/models/spotlight/role_spec.rb +0 -2
  139. data/spec/models/spotlight/search_spec.rb +0 -2
  140. data/spec/models/spotlight/site_spec.rb +0 -2
  141. data/spec/models/spotlight/sitemap_spec.rb +0 -1
  142. data/spec/models/spotlight/solr_document_sidecar_spec.rb +0 -2
  143. data/spec/models/spotlight/user_spec.rb +0 -2
  144. data/spec/routing/spotlight/exhibit_catalog_spec.rb +0 -1
  145. data/spec/routing/spotlight/pages_routing_spec.rb +30 -34
  146. data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +0 -2
  147. data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +14 -0
  148. data/spec/spec_helper.rb +8 -2
  149. data/spec/uploaders/spotlight/item_uploader_spec.rb +0 -1
  150. data/spec/views/_user_util_links.html.erb_spec.rb +70 -74
  151. data/spec/views/shared/_analytics.html.erb_spec.rb +10 -15
  152. data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +0 -2
  153. data/spec/views/shared/_footer.html.erb_spec.rb +15 -19
  154. data/spec/views/shared/_header_navbar.html.erb_spec.rb +7 -12
  155. data/spec/views/shared/_masthead.html.erb_spec.rb +0 -13
  156. data/spec/views/spotlight/roles/index.html.erb_spec.rb +6 -5
  157. data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +1 -1
  158. metadata +37 -30
  159. data/app/views/spotlight/contact_forms/show.html.erb +0 -4
@@ -8,6 +8,7 @@
8
8
  <div class="col-sm-6">
9
9
  <div class="carousel-inner">
10
10
  <% solr_documents_features_block.each_document.each_with_index do |(block_options, document), index| %>
11
+ <% doc_presenter = index_presenter(document) %>
11
12
  <div class="item <%= 'active' if index == 0 %>" data-id="<%= document.id %>">
12
13
  <% if block_thumb = block_options[:full_image_url] %>
13
14
  <%= link_to_document(document, image_tag(block_thumb), counter: -1) %>
@@ -18,11 +19,11 @@
18
19
 
19
20
  <% indicators << capture do %>
20
21
  <li data-target="#<%= html_id %>" data-slide-to="<%= index %>" class="list-group-item <%= 'active' if index == 0 %>">
21
- <a href="#" title="<%= (caption_text = render_index_field_value(document, (solr_documents_features_block.primary_caption_field if solr_documents_features_block.primary_caption?) || document_show_link_field)) %>">
22
+ <a href="#" title="<%= (caption_text = doc_presenter.field_value(solr_documents_features_block.primary_caption? ? solr_documents_features_block.primary_caption_field : document_show_link_field)) %>">
22
23
  <%= truncate(caption_text, length: 95) %>
23
24
  </a>
24
25
  <% if solr_documents_features_block.secondary_caption? %>
25
- <p><%= render_index_field_value(document, solr_documents_features_block.secondary_caption_field) %></p>
26
+ <p><%= doc_presenter.field_value solr_documents_features_block.secondary_caption_field %></p>
26
27
  <% end %>
27
28
  </li>
28
29
  <% end %>
@@ -593,6 +593,7 @@ en:
593
593
  search_description: "Description"
594
594
  search_masthead: "Masthead"
595
595
  search_thumbnail: "Thumbnail"
596
+ default_index_view_type: Default view
596
597
  masthead:
597
598
  help: >
598
599
  You can select and crop an image to use as a browse category-specific masthead, instead
@@ -0,0 +1,5 @@
1
+ class AddDefaultViewToSpotlightSearches < ActiveRecord::Migration
2
+ def change
3
+ add_column :spotlight_searches, :default_index_view_type, :string
4
+ end
5
+ end
@@ -21,6 +21,12 @@ module Spotlight
21
21
  generate 'friendly_id'
22
22
  end
23
23
 
24
+ def riiif
25
+ gem 'riiif', '~> 0.4.0'
26
+ route "mount Riiif::Engine => '/images', as: 'riiif'"
27
+ copy_file 'config/initializers/riiif.rb'
28
+ end
29
+
24
30
  def paper_trail
25
31
  generate 'paper_trail:install'
26
32
  end
@@ -0,0 +1,7 @@
1
+ Riiif::Image.file_resolver = Spotlight::CarrierwaveFileResolver.new
2
+
3
+ # Riiif::Image.authorization_service = IIIFAuthorizationService
4
+
5
+ # Riiif.not_found_image = 'app/assets/images/us_404.svg'
6
+ #
7
+ Riiif::Engine.config.cache_duration_in_days = 365
@@ -1,4 +1,4 @@
1
1
  #
2
2
  module Spotlight
3
- VERSION = '0.18.0'.freeze
3
+ VERSION = '0.19.0'.freeze
4
4
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe ApplicationController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::AboutPagesController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:valid_attributes) { { 'title' => 'MyString' } }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::AdminUsersController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
 
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  describe Spotlight::AppearancesController, type: :controller do
3
2
  routes { Spotlight::Engine.routes }
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::ApplicationController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::AttachmentsController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::BrowseController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::CatalogController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::ConfirmationsController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  before do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::ContactFormsController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -16,6 +14,11 @@ describe Spotlight::ContactFormsController, type: :controller do
16
14
  end
17
15
  end
18
16
  describe 'POST create' do
17
+ it 'sends an email' do
18
+ expect do
19
+ post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
20
+ end.to change { ActionMailer::Base.deliveries.count }.by(1)
21
+ end
19
22
  it 'redirects back' do
20
23
  post :create, exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com' }
21
24
  expect(response).to redirect_to :back
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::ContactsController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  describe 'when not logged in' do
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  describe Spotlight::CustomFieldsController, type: :controller do
3
2
  routes { Spotlight::Engine.routes }
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
 
3
2
  describe Spotlight::DashboardsController, type: :controller do
4
3
  routes { Spotlight::Engine.routes }
@@ -1,5 +1,5 @@
1
- require 'spec_helper'
2
1
  require 'rack/test'
2
+
3
3
  describe Spotlight::ExhibitsController, type: :controller do
4
4
  routes { Spotlight::Engine.routes }
5
5
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  describe Spotlight::FeaturePagesController, type: :controller do
3
2
  routes { Spotlight::Engine.routes }
4
3
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::FiltersController do
4
2
  routes { Spotlight::Engine.routes }
5
3
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::HomePagesController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:valid_attributes) { { 'title' => 'MyString' } }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  describe Spotlight::MetadataConfigurationsController, type: :controller do
3
2
  routes { Spotlight::Engine.routes }
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::ResourcesController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::RolesController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  describe Spotlight::SearchConfigurationsController, type: :controller do
3
2
  routes { Spotlight::Engine.routes }
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::SearchesController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::SitesController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
 
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::SolrController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::TagsController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe Spotlight::VersionsController, type: :controller do
4
2
  routes { Spotlight::Engine.routes }
5
3
 
@@ -1,4 +1,3 @@
1
- require 'spec_helper'
2
1
  describe Spotlight::ViewConfigurationsController, type: :controller do
3
2
  routes { Spotlight::Engine.routes }
4
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'About page', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Add a contact to an exhibit', type: :feature do
4
2
  let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Adding custom metadata field data', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Uploading a non-repository item', type: :feature do
4
2
  let!(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let!(:custom_field) { FactoryGirl.create(:custom_field, exhibit: exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Browse Category Administration', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
@@ -63,6 +61,19 @@ describe 'Browse Category Administration', type: :feature do
63
61
  expect(search.thumbnail.image.thumb).not_to be_nil
64
62
  expect(search.thumbnail.image.path).to end_with 'avatar.png'
65
63
  end
64
+
65
+ it 'can select a default index view type' do
66
+ visit spotlight.edit_exhibit_search_path exhibit, search
67
+ choose 'List'
68
+
69
+ click_button 'Save changes'
70
+
71
+ expect(page).to have_content('The search was successfully updated.')
72
+
73
+ search.reload
74
+
75
+ expect(search.default_index_view_type).to eq 'list'
76
+ end
66
77
  end
67
78
  describe 'destroy' do
68
79
  it 'destroys a tag' do
@@ -1,10 +1,15 @@
1
- require 'spec_helper'
2
-
3
1
  feature 'Browse pages' do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
 
6
4
  context 'a browse page' do
7
5
  let!(:search) { FactoryGirl.create(:search, title: 'Some Saved Search', exhibit: exhibit, published: true) }
6
+
7
+ let(:mock_response) { Blacklight::Solr::Response.new({ response: { numFound: 10, docs: mock_documents } }, {}) }
8
+ let(:mock_documents) { [] }
9
+ before do
10
+ allow_any_instance_of(Spotlight::BrowseController).to receive(:search_results).and_return([mock_response, mock_documents])
11
+ end
12
+
8
13
  context 'with the standard exhibit masthead' do
9
14
  it 'includes the search title and resource count in the body' do
10
15
  visit spotlight.exhibit_browse_path(exhibit, search)
@@ -61,5 +66,25 @@ feature 'Browse pages' do
61
66
  expect(page).not_to have_selector '.breadcrumbs-container'
62
67
  end
63
68
  end
69
+
70
+ context 'without a curator-selected view' do
71
+ it 'renders the gallery view' do
72
+ visit spotlight.exhibit_browse_path(exhibit, search)
73
+ expect(page).to have_selector '.view-type-gallery.active'
74
+ expect(page).to have_selector '#documents.gallery'
75
+ end
76
+ end
77
+
78
+ context 'with a curator-selected default view' do
79
+ before do
80
+ search.update(default_index_view_type: 'list')
81
+ end
82
+
83
+ it 'renders the selected view' do
84
+ visit spotlight.exhibit_browse_path(exhibit, search)
85
+ expect(page).to have_selector '.view-type-list.active'
86
+ expect(page).to have_selector '#documents.documents-list'
87
+ end
88
+ end
64
89
  end
65
90
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Catalog', type: :feature do
4
2
  describe 'admin' do
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Confirming an email', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:contact_email) { Spotlight::ContactEmail.create!(email: 'justin@example.com', exhibit: exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Create a new exhibit', type: :feature do
4
2
  let(:user) { FactoryGirl.create(:site_admin) }
5
3
  before do
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Creating a page', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'A curator can see the items page', type: :feature do
4
2
  let(:exhibit_curator) { FactoryGirl.create(:exhibit_curator) }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -7,7 +5,6 @@ describe 'A curator can see the items page', type: :feature do
7
5
  it 'works' do
8
6
  login_as exhibit_curator
9
7
  visit spotlight.exhibit_dashboard_path(exhibit)
10
-
11
8
  expect(page).to have_content 'Items'
12
9
  end
13
10
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Dashboard', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Add a contact to an exhibit', type: :feature do
4
2
  let(:curator) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) }
5
3
  let(:exhibit) { FactoryGirl.create(:exhibit) }
@@ -14,7 +12,6 @@ describe 'Add a contact to an exhibit', type: :feature do
14
12
  end
15
13
 
16
14
  click_button 'Save'
17
-
18
15
  expect(page).to have_content 'The contact was successfully updated.'
19
16
  end
20
17
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
2
-
3
1
  describe 'Search Administration', type: :feature do
4
2
  let(:exhibit) { FactoryGirl.create(:exhibit) }
5
3
  let(:exhibit_admin) { FactoryGirl.create(:exhibit_admin, exhibit: exhibit) }