blacklight-spotlight 0.19.0 → 0.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/app/helpers/spotlight/title_helper.rb +1 -1
- data/lib/generators/spotlight/install_generator.rb +1 -1
- data/lib/spotlight/version.rb +1 -2
- data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +0 -1
- data/spec/controllers/spotlight/resources/upload_controller_spec.rb +0 -1
- data/spec/features/javascript/blocks/featured_browse_categories_block_spec.rb +0 -1
- data/spec/features/javascript/blocks/featured_pages_block_spec.rb +0 -1
- data/spec/features/javascript/blocks/search_result_block_spec.rb +0 -1
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +0 -1
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +0 -1
- data/spec/helpers/spotlight/application_helper_spec.rb +4 -11
- data/spec/helpers/spotlight/browse_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/crud_link_helpers_spec.rb +124 -127
- data/spec/helpers/spotlight/jcrop_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/navbar_helper_spec.rb +16 -19
- data/spec/helpers/spotlight/pages_helper_spec.rb +74 -76
- data/spec/helpers/spotlight/roles_helper_spec.rb +0 -1
- data/spec/helpers/spotlight/search_configurations_helper_spec.rb +0 -2
- data/spec/helpers/spotlight/title_helper_spec.rb +0 -1
- data/spec/models/sir_trevor_rails/blocks/browse_block_spec.rb +0 -1
- data/spec/models/sir_trevor_rails/blocks/solr_documents_block_spec.rb +0 -1
- data/spec/models/sir_trevor_rails/blocks/textable_spec.rb +0 -1
- data/spec/models/spotlight/analytics/ga_spec.rb +0 -1
- data/spec/models/spotlight/resources/open_graph_spec.rb +0 -1
- data/spec/models/spotlight/resources/upload_spec.rb +0 -1
- data/spec/models/spotlight/resources/web_spec.rb +0 -1
- data/spec/models/spotlight/solr_document/atomic_updates_spec.rb +0 -1
- data/spec/models/spotlight/solr_document/spotlight_images_spec.rb +0 -1
- data/spec/models/spotlight/solr_document/uploaded_resource_spec.rb +0 -1
- data/spec/routing/spotlight/exhibit_catalog_spec.rb +5 -8
- data/spec/test_app_templates/catalog_controller.rb +1 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +0 -1
- data/spec/views/spotlight/about_pages/_empty.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/about_pages/_sidebar.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/about_pages/index.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/browse/_search.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/browse/_sort_and_per_page.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/browse/index.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/browse/show.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/catalog/_edit_default.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/catalog/admin.html.erb_spec.rb +31 -35
- data/spec/views/spotlight/catalog/edit.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/dashboards/_analytics.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/dashboards/analytics.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/exhibits/_exhibit_card_front.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +19 -21
- data/spec/views/spotlight/exhibits/index.html.erb_spec.rb +95 -99
- data/spec/views/spotlight/feature_pages/_empty.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/home_pages/_empty.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/home_pages/_sidebar.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +19 -23
- data/spec/views/spotlight/metadata_configurations/edit.html.erb_spec.rb +16 -20
- data/spec/views/spotlight/pages/edit.html.erb_spec.rb +43 -47
- data/spec/views/spotlight/pages/index.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/pages/new.html.erb_spec.rb +12 -16
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +66 -61
- data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/resources/new.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/roles/index.html.erb_spec.rb +20 -25
- data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +20 -24
- data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +31 -45
- data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +19 -24
- data/spec/views/spotlight/searches/_search.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/searches/edit.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/searches/index.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_browse_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_rule_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_carousel_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb +0 -1
- data/spec/views/spotlight/sites/edit_exhibits.html.erb_spec.rb +18 -24
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -1
- metadata +180 -181
- data/lib/generators/spotlight/templates/jetty.rake +0 -19
@@ -1,27 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
select_deselect_button: nil
|
15
|
-
)
|
16
|
-
end
|
1
|
+
describe 'spotlight/metadata_configurations/_metadata_field', type: :view do
|
2
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
3
|
+
let(:p) { 'spotlight/metadata_configurations/metadata_field.html.erb' }
|
4
|
+
before do
|
5
|
+
assign(:exhibit, exhibit)
|
6
|
+
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
7
|
+
allow(view).to receive_messages(
|
8
|
+
current_exhibit: exhibit,
|
9
|
+
blacklight_config: exhibit.blacklight_configuration,
|
10
|
+
available_view_fields: { some_view_type: 1, another_view_type: 2 },
|
11
|
+
select_deselect_button: nil
|
12
|
+
)
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
15
|
+
let(:facet_field) { Blacklight::Configuration::FacetField.new }
|
16
|
+
let(:builder) { ActionView::Helpers::FormBuilder.new 'z', nil, view, {} }
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
18
|
+
it 'uses the index_field_label helper to render the label' do
|
19
|
+
allow(view).to receive(:index_field_label).with(nil, 'some_key').and_return 'Some label'
|
20
|
+
render partial: p, locals: { key: 'some_key', config: facet_field, f: builder }
|
21
|
+
expect(rendered).to have_selector '.field-label', text: 'Some label'
|
26
22
|
end
|
27
23
|
end
|
@@ -1,23 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
select_deselect_button: nil
|
14
|
-
)
|
15
|
-
end
|
1
|
+
describe 'spotlight/metadata_configurations/edit', type: :view do
|
2
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
3
|
+
before do
|
4
|
+
assign(:exhibit, exhibit)
|
5
|
+
assign(:blacklight_configuration, exhibit.blacklight_configuration)
|
6
|
+
allow(view).to receive_messages(
|
7
|
+
current_exhibit: exhibit,
|
8
|
+
blacklight_config: exhibit.blacklight_configuration,
|
9
|
+
available_view_fields: { some_view_type: 1, another_view_type: 2 },
|
10
|
+
select_deselect_button: nil
|
11
|
+
)
|
12
|
+
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
14
|
+
it 'has columns for the available view types' do
|
15
|
+
render
|
16
|
+
expect(rendered).to have_selector 'th', text: 'Some View Type'
|
17
|
+
expect(rendered).to have_selector 'th', text: 'Another View Type'
|
22
18
|
end
|
23
19
|
end
|
@@ -1,68 +1,64 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
assign(:page, page)
|
9
|
-
allow(view).to receive_messages(default_thumbnail_jcrop_options: {}, available_index_fields: [], available_view_fields: [])
|
10
|
-
end
|
1
|
+
describe 'spotlight/pages/edit', type: :view do
|
2
|
+
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
3
|
+
let(:page) { stub_model(Spotlight::FeaturePage, exhibit: exhibit) }
|
4
|
+
before do
|
5
|
+
assign(:page, page)
|
6
|
+
allow(view).to receive_messages(default_thumbnail_jcrop_options: {}, available_index_fields: [], available_view_fields: [])
|
7
|
+
end
|
11
8
|
|
12
|
-
|
13
|
-
|
9
|
+
it 'renders the edit page form' do
|
10
|
+
render
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
12
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
13
|
+
assert_select 'form[action=?][method=?]', spotlight.exhibit_feature_page_path(page.exhibit, page), 'post' do
|
14
|
+
assert_select 'input#feature_page_title[name=?]', 'feature_page[title]'
|
15
|
+
assert_select 'textarea#feature_page_content[name=?]', 'feature_page[content]'
|
20
16
|
end
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
19
|
+
describe 'locks' do
|
20
|
+
let(:lock) { Spotlight::Lock.create! on: page }
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
before do
|
23
|
+
page.lock = lock
|
24
|
+
end
|
28
25
|
|
29
|
-
|
30
|
-
|
26
|
+
it 'renders a lock' do
|
27
|
+
render
|
31
28
|
|
32
|
-
|
33
|
-
|
29
|
+
expect(rendered).to have_css '.alert-lock'
|
30
|
+
end
|
34
31
|
|
35
|
-
|
36
|
-
|
32
|
+
it 'does not render an old lock' do
|
33
|
+
lock.created_at -= 1.day
|
37
34
|
|
38
|
-
|
35
|
+
render
|
39
36
|
|
40
|
-
|
41
|
-
|
37
|
+
expect(rendered).not_to have_css '.alert-lock'
|
38
|
+
end
|
42
39
|
|
43
|
-
|
44
|
-
|
40
|
+
it 'does not render a lock held by the current session' do
|
41
|
+
lock.current_session!
|
45
42
|
|
46
|
-
|
43
|
+
render
|
47
44
|
|
48
|
-
|
49
|
-
|
45
|
+
expect(rendered).not_to have_css '.alert-lock'
|
46
|
+
end
|
50
47
|
|
51
|
-
|
52
|
-
|
48
|
+
it 'attaches a data-lock attribute to the cancel button' do
|
49
|
+
lock.current_session!
|
53
50
|
|
54
|
-
|
51
|
+
render
|
55
52
|
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
expect(rendered).to have_link 'Cancel'
|
54
|
+
expect(rendered).to have_css "a[data-lock=\"#{url_for([spotlight, page.exhibit, lock])}\"]", text: 'Cancel'
|
55
|
+
end
|
59
56
|
|
60
|
-
|
61
|
-
|
57
|
+
it "does not have data-lock attribute if the lock doesn't belong to this session" do
|
58
|
+
render
|
62
59
|
|
63
|
-
|
64
|
-
|
65
|
-
end
|
60
|
+
expect(rendered).to have_link 'Cancel'
|
61
|
+
expect(rendered).not_to have_css 'a[data-lock]', text: 'Cancel'
|
66
62
|
end
|
67
63
|
end
|
68
64
|
end
|
@@ -1,21 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
assign(:page, stub_model(FeaturePage, exhibit: exhibit).as_new_record)
|
8
|
-
allow(view).to receive_messages(default_thumbnail_jcrop_options: {}, available_index_fields: [], available_view_fields: [])
|
9
|
-
end
|
1
|
+
describe 'spotlight/pages/new', type: :view do
|
2
|
+
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
3
|
+
before do
|
4
|
+
assign(:page, stub_model(Spotlight::FeaturePage, exhibit: exhibit).as_new_record)
|
5
|
+
allow(view).to receive_messages(default_thumbnail_jcrop_options: {}, available_index_fields: [], available_view_fields: [])
|
6
|
+
end
|
10
7
|
|
11
|
-
|
12
|
-
|
8
|
+
it 'renders new page form' do
|
9
|
+
render
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
11
|
+
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
12
|
+
assert_select 'form[action=?][method=?]', spotlight.exhibit_feature_pages_path(exhibit), 'post' do
|
13
|
+
assert_select 'input#feature_page_title[name=?]', 'feature_page[title]'
|
14
|
+
assert_select 'textarea#feature_page_content[name=?]', 'feature_page[content]'
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
@@ -1,63 +1,68 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
1
|
+
describe 'spotlight/pages/show', type: :view do
|
2
|
+
let(:exhibit) { stub_model(Spotlight::Exhibit) }
|
3
|
+
let(:page) do
|
4
|
+
stub_model(Spotlight::FeaturePage,
|
5
|
+
exhibit: exhibit,
|
6
|
+
title: 'Title',
|
7
|
+
content: '[]')
|
8
|
+
end
|
9
|
+
before(:each) do
|
10
|
+
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
11
|
+
assign(:page, page)
|
12
|
+
stub_template 'spotlight/pages/_sidebar.html.erb' => 'Sidebar'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'renders the title as a heading' do
|
16
|
+
render
|
17
|
+
expect(rendered).to have_css('.page-title', text: page.title)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'does not render an empty heading' do
|
21
|
+
allow(page).to receive_messages(title: nil)
|
22
|
+
render
|
23
|
+
expect(rendered).to_not have_css('.page-title')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'injects the page title into the html title' do
|
27
|
+
expect(view).to receive(:set_html_page_title)
|
28
|
+
render
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'does not double-escape HTML entities in the HTML title' do
|
32
|
+
allow(page).to receive_messages(title: 'Abbott & Costello')
|
33
|
+
stub_template '_user_util_links.html.erb' => ''
|
34
|
+
stub_template 'shared/_masthead.html.erb' => ''
|
35
|
+
render template: 'spotlight/pages/show', layout: 'layouts/spotlight/spotlight'
|
36
|
+
expect(rendered).to have_content('Abbott & Costello | Blacklight')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'does not include the page title' do
|
40
|
+
allow(page).to receive_messages(should_display_title?: false)
|
41
|
+
expect(view).to_not receive(:set_html_page_title)
|
42
|
+
render
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'renders attributes in <p>' do
|
46
|
+
render
|
47
|
+
expect(rendered).to match(/Title/)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'renders the sidebar' do
|
51
|
+
page.display_sidebar = true
|
52
|
+
render
|
53
|
+
expect(rendered).to match('Sidebar')
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'does not render the sidebar if the page has it disabled' do
|
57
|
+
allow(page).to receive_messages(display_sidebar?: false)
|
58
|
+
render
|
59
|
+
expect(rendered).to_not match('Sidebar')
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'renders an empty partial if the page has no content' do
|
63
|
+
allow(page).to receive_messages(content?: false)
|
64
|
+
stub_template 'spotlight/pages/_empty.html.erb' => 'Empty message'
|
65
|
+
render
|
66
|
+
expect(rendered).to have_content('Empty message')
|
62
67
|
end
|
63
68
|
end
|
@@ -1,31 +1,26 @@
|
|
1
|
-
|
1
|
+
describe 'spotlight/roles/index', type: :view do
|
2
|
+
let(:user) { stub_model(Spotlight::Engine.user_class, email: 'jane@example.com') }
|
3
|
+
let(:exhibit) { FactoryGirl.create(:exhibit) }
|
4
|
+
let(:admin_role) { FactoryGirl.create(:role, role: 'admin', user: user, resource: exhibit) }
|
5
|
+
let(:roles) { [admin_role] }
|
2
6
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
let(:admin_role) { FactoryGirl.create(:role, role: 'admin', user: user, resource: exhibit) }
|
9
|
-
let(:roles) { [admin_role] }
|
10
|
-
|
11
|
-
before do
|
12
|
-
assign(:exhibit, exhibit)
|
13
|
-
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
14
|
-
allow(exhibit).to receive(:roles).and_return roles
|
15
|
-
end
|
7
|
+
before do
|
8
|
+
assign(:exhibit, exhibit)
|
9
|
+
allow(view).to receive(:current_exhibit).and_return(exhibit)
|
10
|
+
allow(exhibit).to receive(:roles).and_return roles
|
11
|
+
end
|
16
12
|
|
17
|
-
|
18
|
-
|
13
|
+
it 'renders the index page form' do
|
14
|
+
render
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
16
|
+
action = spotlight.update_all_exhibit_roles_path(exhibit)
|
17
|
+
assert_select "form[action='#{action}'][method='post']" do
|
18
|
+
assert_select "tr[data-show-for='#{admin_role.id}']"
|
19
|
+
assert_select "tr[data-edit-for='#{admin_role.id}']"
|
20
|
+
assert_select "input[type='submit'][data-behavior='destroy-user'][data-target='#{admin_role.id}']"
|
21
|
+
assert_select "input[type='hidden'][data-destroy-for='#{admin_role.id}']"
|
22
|
+
assert_select "a[data-behavior='cancel-edit']"
|
23
|
+
assert_select "input[type='submit'][value='Save changes']"
|
29
24
|
end
|
30
25
|
end
|
31
26
|
end
|