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.
- checksums.yaml +4 -4
- data/README.md +3 -9
- data/app/assets/javascripts/spotlight/blocks/browse_block.js +1 -0
- data/app/assets/stylesheets/spotlight/_bootstrap_overrides.scss +1 -1
- data/app/assets/stylesheets/spotlight/_multi_up_item_grid.scss +2 -0
- data/app/assets/stylesheets/spotlight/_pages.scss +7 -1
- data/app/controllers/spotlight/contact_forms_controller.rb +1 -5
- data/app/controllers/spotlight/searches_controller.rb +7 -1
- data/app/helpers/spotlight/browse_helper.rb +16 -1
- data/app/helpers/spotlight/searches_helper.rb +8 -0
- data/app/mailers/spotlight/contact_mailer.rb +9 -0
- data/app/models/spotlight/analytics/ga.rb +14 -16
- data/app/models/spotlight/blacklight_configuration.rb +6 -6
- data/app/models/spotlight/contact_form.rb +12 -10
- data/app/services/spotlight/carrierwave_file_resolver.rb +8 -0
- data/app/views/spotlight/browse/show.html.erb +5 -1
- data/app/views/spotlight/contact_mailer/report_problem.html.erb +14 -0
- data/app/views/spotlight/dashboards/analytics.html.erb +1 -3
- data/app/views/spotlight/searches/_form.html.erb +5 -0
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb +4 -3
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb +3 -2
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +3 -2
- data/config/locales/spotlight.en.yml +1 -0
- data/db/migrate/20160711121314_add_default_view_to_spotlight_searches.rb +5 -0
- data/lib/generators/spotlight/install_generator.rb +6 -0
- data/lib/generators/spotlight/templates/config/initializers/riiif.rb +7 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/admin_users_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/appearances_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/application_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/attachments_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/browse_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/catalog_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/confirmations_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/contact_forms_controller_spec.rb +5 -2
- data/spec/controllers/spotlight/contacts_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/custom_fields_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/dashboards_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/exhibits_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/filters_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/metadata_configurations_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/resources_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/roles_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/search_configurations_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/searches_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/sites_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/solr_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/tags_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/versions_controller_spec.rb +0 -2
- data/spec/controllers/spotlight/view_configurations_controller_spec.rb +0 -1
- data/spec/features/about_page_spec.rb +0 -2
- data/spec/features/add_contacts_spec.rb +0 -2
- data/spec/features/add_custom_field_metadata_spec.rb +0 -2
- data/spec/features/add_items_spec.rb +0 -2
- data/spec/features/browse_category_admin_spec.rb +13 -2
- data/spec/features/browse_category_spec.rb +27 -2
- data/spec/features/catalog_spec.rb +0 -2
- data/spec/features/confirm_email_spec.rb +0 -2
- data/spec/features/create_exhibit_spec.rb +0 -2
- data/spec/features/create_page_spec.rb +0 -2
- data/spec/features/curator_items.rb +0 -3
- data/spec/features/dashboard_spec.rb +0 -2
- data/spec/features/edit_contact_spec.rb +0 -3
- data/spec/features/edit_search_fields_spec.rb +0 -2
- data/spec/features/exhibit_masthead_spec.rb +0 -2
- data/spec/features/exhibits/add_tags_spec.rb +0 -1
- data/spec/features/exhibits/administration_spec.rb +0 -1
- data/spec/features/exhibits/custom_metadata_fields_spec.rb +0 -1
- data/spec/features/exhibits/edit_metadata_fields_spec.rb +0 -1
- data/spec/features/exhibits_index_spec.rb +0 -2
- data/spec/features/feature_page_spec.rb +0 -2
- data/spec/features/home_page_spec.rb +0 -1
- data/spec/features/import_exhibit_spec.rb +0 -1
- data/spec/features/item_admin_spec.rb +0 -2
- data/spec/features/javascript/about_page_admin_spec.rb +0 -2
- data/spec/features/javascript/block_controls_spec.rb +0 -2
- data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +8 -0
- data/spec/features/javascript/edit_in_place_spec.rb +0 -2
- data/spec/features/javascript/feature_page_admin_spec.rb +0 -2
- data/spec/features/javascript/home_page_edit_spec.rb +0 -2
- data/spec/features/javascript/metadata_admin_spec.rb +0 -2
- data/spec/features/javascript/multi_image_select_spec.rb +0 -2
- data/spec/features/javascript/preview_block_spec.rb +0 -2
- data/spec/features/javascript/reindex_monitor_spec.rb +0 -2
- data/spec/features/javascript/roles_admin_spec.rb +0 -2
- data/spec/features/javascript/rule_block_spec.rb +0 -2
- data/spec/features/javascript/search_config_admin_spec.rb +0 -2
- data/spec/features/javascript/search_context_spec.rb +0 -2
- data/spec/features/main_navigation_spec.rb +0 -2
- data/spec/features/metadata_admin_spec.rb +0 -2
- data/spec/features/report_a_problem_spec.rb +0 -2
- data/spec/features/site_admin_management_spec.rb +0 -2
- data/spec/features/site_masthead_spec.rb +0 -6
- data/spec/features/slideshow_spec.rb +0 -2
- data/spec/features/tags_admin_spec.rb +0 -2
- data/spec/features/user_admin_spec.rb +0 -2
- data/spec/helpers/spotlight/application_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/browse_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +0 -1
- data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/main_app_helpers_spec.rb +0 -1
- data/spec/helpers/spotlight/navbar_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/pages_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/roles_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/title_helper_spec.rb +0 -1
- data/spec/jobs/spotlight/default_thumbnail_job_spec.rb +0 -1
- data/spec/jobs/spotlight/reindex_job_spec.rb +0 -1
- data/spec/jobs/spotlight/rename_sidecar_field_job_spec.rb +0 -1
- data/spec/lib/spotlight/controller_spec.rb +0 -1
- data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +0 -1
- data/spec/models/solr_document_spec.rb +0 -2
- data/spec/models/spotlight/ability_spec.rb +0 -1
- data/spec/models/spotlight/about_page_spec.rb +0 -2
- data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +0 -2
- data/spec/models/spotlight/blacklight_configuration_spec.rb +10 -2
- data/spec/models/spotlight/contact_email_spec.rb +0 -8
- data/spec/models/spotlight/contact_form_spec.rb +0 -2
- data/spec/models/spotlight/contact_spec.rb +0 -2
- data/spec/models/spotlight/custom_field_spec.rb +0 -1
- data/spec/models/spotlight/default_thumbnailable_concern_spec.rb +0 -2
- data/spec/models/spotlight/exhibit_spec.rb +0 -2
- data/spec/models/spotlight/feature_page_spec.rb +0 -2
- data/spec/models/spotlight/featured_image_spec.rb +0 -2
- data/spec/models/spotlight/field_metadata_spec.rb +0 -2
- data/spec/models/spotlight/filter_spec.rb +0 -2
- data/spec/models/spotlight/home_page_spec.rb +0 -2
- data/spec/models/spotlight/image_derivatives_spec.rb +0 -2
- data/spec/models/spotlight/main_navigation_spec.rb +0 -2
- data/spec/models/spotlight/masthead_spec.rb +0 -2
- data/spec/models/spotlight/page_spec.rb +0 -2
- data/spec/models/spotlight/reindex_progress_spec.rb +0 -2
- data/spec/models/spotlight/resource_spec.rb +0 -2
- data/spec/models/spotlight/role_spec.rb +0 -2
- data/spec/models/spotlight/search_spec.rb +0 -2
- data/spec/models/spotlight/site_spec.rb +0 -2
- data/spec/models/spotlight/sitemap_spec.rb +0 -1
- data/spec/models/spotlight/solr_document_sidecar_spec.rb +0 -2
- data/spec/models/spotlight/user_spec.rb +0 -2
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +0 -1
- data/spec/routing/spotlight/pages_routing_spec.rb +30 -34
- data/spec/serializers/spotlight/exhibit_export_serializer_spec.rb +0 -2
- data/spec/services/spotlight/carrierwave_file_resolver_spec.rb +14 -0
- data/spec/spec_helper.rb +8 -2
- data/spec/uploaders/spotlight/item_uploader_spec.rb +0 -1
- data/spec/views/_user_util_links.html.erb_spec.rb +70 -74
- data/spec/views/shared/_analytics.html.erb_spec.rb +10 -15
- data/spec/views/shared/_exhibit_navbar.html.erb_spec.rb +0 -2
- data/spec/views/shared/_footer.html.erb_spec.rb +15 -19
- data/spec/views/shared/_header_navbar.html.erb_spec.rb +7 -12
- data/spec/views/shared/_masthead.html.erb_spec.rb +0 -13
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +6 -5
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +1 -1
- metadata +37 -30
- data/app/views/spotlight/contact_forms/show.html.erb +0 -4
@@ -1,44 +1,40 @@
|
|
1
|
-
|
1
|
+
describe 'FeaturePagesController and AboutPagesController', type: :routing do
|
2
|
+
describe 'routing' do
|
3
|
+
routes { Spotlight::Engine.routes }
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
it 'routes to #index' do
|
9
|
-
expect(get('/1/feature')).to route_to('spotlight/feature_pages#index', exhibit_id: '1')
|
10
|
-
expect(get('/1/about')).to route_to('spotlight/about_pages#index', exhibit_id: '1')
|
11
|
-
end
|
5
|
+
it 'routes to #index' do
|
6
|
+
expect(get('/1/feature')).to route_to('spotlight/feature_pages#index', exhibit_id: '1')
|
7
|
+
expect(get('/1/about')).to route_to('spotlight/about_pages#index', exhibit_id: '1')
|
8
|
+
end
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
it 'routes to #new' do
|
11
|
+
expect(get('/1/feature/new')).to route_to('spotlight/feature_pages#new', exhibit_id: '1')
|
12
|
+
expect(get('/1/about/new')).to route_to('spotlight/about_pages#new', exhibit_id: '1')
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
it 'routes to #show' do
|
16
|
+
expect(get('/1/feature/2')).to route_to('spotlight/feature_pages#show', id: '2', exhibit_id: '1')
|
17
|
+
expect(get('/1/about/2')).to route_to('spotlight/about_pages#show', id: '2', exhibit_id: '1')
|
18
|
+
end
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
it 'routes to #edit' do
|
21
|
+
expect(get('/1/feature/2/edit')).to route_to('spotlight/feature_pages#edit', id: '2', exhibit_id: '1')
|
22
|
+
expect(get('/1/about/2/edit')).to route_to('spotlight/about_pages#edit', id: '2', exhibit_id: '1')
|
23
|
+
end
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
25
|
+
it 'routes to #create' do
|
26
|
+
expect(post('/1/feature')).to route_to('spotlight/feature_pages#create', exhibit_id: '1')
|
27
|
+
expect(post('/1/about')).to route_to('spotlight/about_pages#create', exhibit_id: '1')
|
28
|
+
end
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
it 'routes to #update' do
|
31
|
+
expect(put('/1/feature/2')).to route_to('spotlight/feature_pages#update', id: '2', exhibit_id: '1')
|
32
|
+
expect(put('/1/about/2')).to route_to('spotlight/about_pages#update', id: '2', exhibit_id: '1')
|
33
|
+
end
|
37
34
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
35
|
+
it 'routes to #destroy' do
|
36
|
+
expect(delete('/1/feature/2')).to route_to('spotlight/feature_pages#destroy', id: '2', exhibit_id: '1')
|
37
|
+
expect(delete('/1/about/2')).to route_to('spotlight/about_pages#destroy', id: '2', exhibit_id: '1')
|
42
38
|
end
|
43
39
|
end
|
44
40
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Spotlight::CarrierwaveFileResolver do
|
4
|
+
let(:masthead) { FactoryGirl.create(:masthead) }
|
5
|
+
let(:resolver) { described_class.new }
|
6
|
+
|
7
|
+
describe 'finding the file' do
|
8
|
+
subject { Riiif::Image.file_resolver.find(masthead.id) }
|
9
|
+
|
10
|
+
it 'is found' do
|
11
|
+
expect(subject).to be_kind_of Riiif::File
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -68,8 +68,14 @@ RSpec.configure do |config|
|
|
68
68
|
|
69
69
|
config.filter_run_excluding js: true if ENV['CI']
|
70
70
|
|
71
|
-
|
72
|
-
|
71
|
+
if defined? Devise::Test::ControllerHelpers
|
72
|
+
config.include Devise::Test::ControllerHelpers, type: :controller
|
73
|
+
config.include Devise::Test::ControllerHelpers, type: :view
|
74
|
+
else
|
75
|
+
config.include Devise::TestHelpers, type: :controller
|
76
|
+
config.include Devise::TestHelpers, type: :view
|
77
|
+
end
|
78
|
+
|
73
79
|
config.include Spotlight::TestViewHelpers, type: :view
|
74
80
|
config.include Warden::Test::Helpers, type: :feature
|
75
81
|
|
@@ -1,89 +1,85 @@
|
|
1
|
-
|
1
|
+
describe '_user_util_links', type: :view do
|
2
|
+
let(:current_exhibit) { FactoryGirl.create(:exhibit) }
|
3
|
+
before do
|
4
|
+
allow(view).to receive(:blacklight_config).and_return(Blacklight::Configuration.new)
|
5
|
+
allow(view).to receive(:current_user).and_return(current_user)
|
6
|
+
allow(view).to receive(:current_exhibit).and_return(current_exhibit)
|
7
|
+
allow(view).to receive_messages(show_contact_form?: true)
|
8
|
+
end
|
2
9
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
allow(view).to receive(:current_exhibit).and_return(current_exhibit)
|
10
|
-
allow(view).to receive_messages(show_contact_form?: true)
|
10
|
+
describe 'when user is not logged in' do
|
11
|
+
let(:current_user) { nil }
|
12
|
+
it 'renders the links' do
|
13
|
+
render
|
14
|
+
expect(rendered).to have_link 'Sign in'
|
15
|
+
expect(rendered).to have_link 'Feedback'
|
11
16
|
end
|
17
|
+
end
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
expect(rendered).to have_link 'Sign in'
|
18
|
-
expect(rendered).to have_link 'Feedback'
|
19
|
-
end
|
19
|
+
describe 'when show_contact_form is false' do
|
20
|
+
let(:current_user) { nil }
|
21
|
+
before do
|
22
|
+
allow(view).to receive_messages(show_contact_form?: false)
|
20
23
|
end
|
24
|
+
it 'does not render the feedback link' do
|
25
|
+
render
|
26
|
+
expect(rendered).to_not have_link 'Feedback'
|
27
|
+
end
|
28
|
+
end
|
21
29
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
render
|
30
|
-
expect(rendered).to_not have_link 'Feedback'
|
31
|
-
end
|
30
|
+
describe 'when user is logged in' do
|
31
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
32
|
+
it 'renders the links' do
|
33
|
+
render
|
34
|
+
expect(rendered).to have_link 'Feedback'
|
35
|
+
expect(rendered).to_not have_link 'Dashboard'
|
36
|
+
expect(rendered).to have_link 'Sign out'
|
32
37
|
end
|
38
|
+
end
|
33
39
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
describe 'when user is a curator' do
|
41
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
42
|
+
before do
|
43
|
+
allow(view).to receive(:can?).with(:update, current_exhibit).and_return(false)
|
44
|
+
allow(view).to receive(:can?).with(:create, Spotlight::Exhibit).and_return(false)
|
45
|
+
allow(view).to receive(:can?).with(:curate, current_exhibit).and_return(true)
|
46
|
+
end
|
47
|
+
it 'renders the links' do
|
48
|
+
render
|
49
|
+
expect(rendered).to have_link 'Feedback'
|
50
|
+
expect(rendered).to have_link 'Dashboard'
|
51
|
+
expect(rendered).to have_link 'Sign out'
|
42
52
|
end
|
53
|
+
end
|
43
54
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
it 'renders the links' do
|
52
|
-
render
|
53
|
-
expect(rendered).to have_link 'Feedback'
|
54
|
-
expect(rendered).to have_link 'Dashboard'
|
55
|
-
expect(rendered).to have_link 'Sign out'
|
56
|
-
end
|
55
|
+
describe 'when user is an admin' do
|
56
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
57
|
+
before do
|
58
|
+
allow(view).to receive(:can?).with(:update, current_exhibit).and_return(true)
|
59
|
+
allow(view).to receive(:can?).with(:create, Spotlight::Exhibit).and_return(false)
|
60
|
+
allow(view).to receive(:can?).with(:curate, current_exhibit).and_return(true)
|
57
61
|
end
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
allow(view).to receive(:can?).with(:curate, current_exhibit).and_return(true)
|
64
|
-
end
|
65
|
-
it 'renders the links' do
|
66
|
-
render
|
67
|
-
expect(rendered).to have_link 'Feedback'
|
68
|
-
expect(rendered).to have_link 'Dashboard'
|
69
|
-
expect(rendered).to have_link 'Sign out'
|
70
|
-
end
|
62
|
+
it 'renders the links' do
|
63
|
+
render
|
64
|
+
expect(rendered).to have_link 'Feedback'
|
65
|
+
expect(rendered).to have_link 'Dashboard'
|
66
|
+
expect(rendered).to have_link 'Sign out'
|
71
67
|
end
|
68
|
+
end
|
72
69
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
end
|
70
|
+
describe 'when user is a site-wide admin' do
|
71
|
+
let(:current_user) { Spotlight::Engine.user_class.new }
|
72
|
+
before do
|
73
|
+
allow(view).to receive(:can?).with(:update, current_exhibit).and_return(true)
|
74
|
+
allow(view).to receive(:can?).with(:create, Spotlight::Exhibit).and_return(true)
|
75
|
+
allow(view).to receive(:can?).with(:curate, current_exhibit).and_return(true)
|
76
|
+
end
|
77
|
+
it 'renders the links' do
|
78
|
+
render
|
79
|
+
expect(rendered).to have_link 'Feedback'
|
80
|
+
expect(rendered).to have_link 'Dashboard'
|
81
|
+
expect(rendered).to have_link 'Create Exhibit'
|
82
|
+
expect(rendered).to have_link 'Sign out'
|
87
83
|
end
|
88
84
|
end
|
89
85
|
end
|
@@ -1,17 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
allow(Spotlight::Engine.config).to receive(:ga_web_property_id).and_return('XYZ-234')
|
12
|
-
render
|
13
|
-
expect(rendered).to have_selector 'script', visible: false
|
14
|
-
expect(rendered).to have_content 'XYZ-234'
|
15
|
-
end
|
1
|
+
describe 'shared/_analytics', type: :view do
|
2
|
+
it 'is empty without Google Analytics configured' do
|
3
|
+
render
|
4
|
+
expect(rendered).to be_empty
|
5
|
+
end
|
6
|
+
it 'renders the GA script tag if the web property id is configured' do
|
7
|
+
allow(Spotlight::Engine.config).to receive(:ga_web_property_id).and_return('XYZ-234')
|
8
|
+
render
|
9
|
+
expect(rendered).to have_selector 'script', visible: false
|
10
|
+
expect(rendered).to have_content 'XYZ-234'
|
16
11
|
end
|
17
12
|
end
|