blacklight 5.9.4 → 5.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_facets.scss +11 -10
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +14 -14
- data/app/helpers/blacklight/configuration_helper_behavior.rb +16 -10
- data/app/helpers/blacklight/facets_helper_behavior.rb +15 -14
- data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
- data/app/models/bookmark.rb +1 -4
- data/app/models/search.rb +3 -6
- data/app/views/catalog/_facet_layout.html.erb +2 -2
- data/app/views/catalog/_facet_limit.html.erb +5 -3
- data/app/views/catalog/_facet_pivot.html.erb +4 -4
- data/app/views/catalog/_home_text.html.erb +8 -48
- data/app/views/catalog/_index_default.html.erb +3 -3
- data/app/views/catalog/_show_default.html.erb +3 -3
- data/app/views/catalog/_sms_form.html.erb +1 -1
- data/app/views/catalog/facet.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/jetty.yml +0 -3
- data/config/locales/blacklight.de.yml +2 -0
- data/config/locales/blacklight.en.yml +2 -0
- data/config/locales/blacklight.es.yml +2 -0
- data/config/locales/blacklight.fr.yml +2 -0
- data/config/locales/blacklight.pt-BR.yml +2 -0
- data/lib/blacklight.rb +70 -26
- data/lib/blacklight/abstract_repository.rb +29 -0
- data/lib/blacklight/base.rb +7 -7
- data/lib/blacklight/bookmarks.rb +5 -5
- data/lib/blacklight/catalog.rb +34 -19
- data/lib/blacklight/catalog/search_context.rb +1 -1
- data/lib/blacklight/configuration.rb +112 -46
- data/lib/blacklight/configuration/facet_field.rb +9 -7
- data/lib/blacklight/configuration/field.rb +27 -0
- data/lib/blacklight/configuration/fields.rb +25 -20
- data/lib/blacklight/configuration/search_field.rb +6 -8
- data/lib/blacklight/configuration/solr_field.rb +3 -18
- data/lib/blacklight/configuration/sort_field.rb +6 -7
- data/lib/blacklight/document.rb +156 -0
- data/lib/blacklight/document/dublin_core.rb +41 -0
- data/lib/blacklight/document/email.rb +16 -0
- data/lib/blacklight/document/export.rb +107 -0
- data/lib/blacklight/document/extensions.rb +56 -0
- data/lib/blacklight/document/schema_org.rb +7 -0
- data/lib/blacklight/document/semantic_fields.rb +51 -0
- data/lib/blacklight/document/sms.rb +14 -0
- data/lib/blacklight/document_presenter.rb +3 -3
- data/lib/blacklight/exceptions.rb +9 -2
- data/lib/blacklight/facet.rb +21 -16
- data/lib/blacklight/request_builders.rb +60 -284
- data/lib/blacklight/routes.rb +1 -1
- data/lib/blacklight/search_builder.rb +130 -0
- data/lib/blacklight/search_helper.rb +316 -0
- data/lib/blacklight/solr.rb +1 -0
- data/lib/blacklight/solr/document.rb +4 -187
- data/lib/blacklight/solr/document/dublin_core.rb +3 -37
- data/lib/blacklight/solr/document/email.rb +4 -13
- data/lib/blacklight/solr/document/export.rb +3 -103
- data/lib/blacklight/solr/document/extensions.rb +4 -52
- data/lib/blacklight/solr/document/more_like_this.rb +1 -1
- data/lib/blacklight/solr/document/schema_org.rb +4 -4
- data/lib/blacklight/solr/document/sms.rb +4 -11
- data/lib/blacklight/solr/facet_paginator.rb +2 -2
- data/lib/blacklight/solr/search_builder.rb +264 -0
- data/lib/blacklight/solr_helper.rb +6 -261
- data/lib/blacklight/solr_repository.rb +30 -24
- data/lib/blacklight/solr_response.rb +3 -3
- data/lib/blacklight/user.rb +1 -2
- data/lib/blacklight/utils.rb +0 -23
- data/lib/generators/blacklight/controller_generator.rb +38 -0
- data/lib/generators/blacklight/document_generator.rb +20 -0
- data/lib/generators/blacklight/install_generator.rb +38 -39
- data/lib/generators/blacklight/models_generator.rb +2 -62
- data/lib/generators/blacklight/templates/catalog_controller.rb +3 -4
- data/lib/generators/blacklight/templates/config/{solr.yml → blacklight.yml} +3 -0
- data/lib/generators/blacklight/templates/config/jetty.yml +0 -3
- data/lib/generators/blacklight/templates/solr_document.rb +6 -6
- data/lib/generators/blacklight/test_support_generator.rb +1 -6
- data/lib/generators/blacklight/user_generator.rb +59 -0
- data/lib/railties/blacklight.rake +16 -7
- data/spec/controllers/catalog_controller_spec.rb +9 -15
- data/spec/features/facets_spec.rb +8 -0
- data/spec/helpers/configuration_helper_spec.rb +6 -13
- data/spec/helpers/facets_helper_spec.rb +3 -2
- data/spec/lib/blacklight/configuration_spec.rb +11 -38
- data/spec/lib/blacklight/{solr/document → document}/dublin_core_spec.rb +4 -4
- data/spec/lib/blacklight/{solr/document → document}/email_spec.rb +2 -2
- data/spec/lib/blacklight/{solr/document → document}/sms_spec.rb +2 -2
- data/spec/lib/blacklight/search_builder_spec.rb +145 -0
- data/spec/lib/blacklight/search_helper_spec.rb +775 -0
- data/spec/lib/blacklight/solr/document/more_like_this_spec.rb +1 -1
- data/spec/lib/blacklight/solr/search_builder_spec.rb +561 -0
- data/spec/lib/blacklight/solr_helper_spec.rb +5 -1291
- data/spec/lib/blacklight/solr_repository_spec.rb +13 -13
- data/spec/models/record_mailer_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -1
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -2
- data/spec/views/catalog/index.atom.builder_spec.rb +1 -1
- data/tasks/blacklight.rake +1 -1
- data/template.demo.rb +1 -1
- metadata +33 -45
- data/doc/Adding-new-document-actions.md +0 -94
- data/doc/Atom-Responses.md +0 -90
- data/doc/Blacklight-Add-ons.md +0 -23
- data/doc/Blacklight-configuration.md +0 -411
- data/doc/Blacklight-on-Heroku.md +0 -100
- data/doc/Blacklight-out-of-the-box.md +0 -47
- data/doc/Bookmarks.md +0 -1
- data/doc/Code4Lib-2014.md +0 -94
- data/doc/Configuration---Facet-Fields.md +0 -130
- data/doc/Configuration---Results-View.md +0 -224
- data/doc/Configuration---Solr-fields.md +0 -106
- data/doc/Configuring-and-Customizing-Blacklight.md +0 -257
- data/doc/Configuring-rails-routes.md +0 -13
- data/doc/Contributing-to-Blacklight.md +0 -43
- data/doc/Examples.md +0 -120
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
- data/doc/Home.md +0 -100
- data/doc/How-to-release-a-version.md +0 -45
- data/doc/Indexing-your-data-into-solr.md +0 -36
- data/doc/Internationalization.md +0 -32
- data/doc/JSON-API.md +0 -83
- data/doc/Pagination.md +0 -52
- data/doc/Providing-your-own-view-templates.md +0 -69
- data/doc/Quickstart.md +0 -153
- data/doc/README_SOLR.md +0 -245
- data/doc/Saved-Searches.md +0 -5
- data/doc/Solr-Configuration.md +0 -154
- data/doc/Sunspot-for-indexing.md +0 -46
- data/doc/Support.md +0 -33
- data/doc/Theming.md +0 -62
- data/doc/Understanding-Rails-and-Blacklight.md +0 -75
- data/doc/User-Authentication.md +0 -60
- data/doc/_Sidebar.md +0 -9
- data/doc/testing.md +0 -58
@@ -22,30 +22,30 @@ describe Blacklight::SolrRepository do
|
|
22
22
|
it "should use the document-specific solr path" do
|
23
23
|
blacklight_config.document_solr_path = 'abc'
|
24
24
|
blacklight_config.solr_path = 'xyz'
|
25
|
-
allow(subject.
|
25
|
+
allow(subject.connection).to receive(:send_and_receive).with('abc', anything).and_return(mock_response)
|
26
26
|
expect(subject.find("123")).to be_a_kind_of Blacklight::SolrResponse
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should use the default solr path" do
|
30
30
|
blacklight_config.solr_path = 'xyz'
|
31
|
-
allow(subject.
|
31
|
+
allow(subject.connection).to receive(:send_and_receive).with('xyz', anything).and_return(mock_response)
|
32
32
|
expect(subject.find("123")).to be_a_kind_of Blacklight::SolrResponse
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should use a default :qt param" do
|
36
|
-
allow(subject.
|
36
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', hash_including(params: { id: '123', qt: 'document'})).and_return(mock_response)
|
37
37
|
expect(subject.find("123", {})).to be_a_kind_of Blacklight::SolrResponse
|
38
38
|
end
|
39
39
|
|
40
40
|
it "should use the provided :qt param" do
|
41
41
|
blacklight_config.document_solr_request_handler = 'xyz'
|
42
|
-
allow(subject.
|
42
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', hash_including(params: { id: '123', qt: 'abc'})).and_return(mock_response)
|
43
43
|
expect(subject.find("123", {qt: 'abc'})).to be_a_kind_of Blacklight::SolrResponse
|
44
44
|
end
|
45
45
|
|
46
46
|
it "should preserve the class of the incoming params" do
|
47
47
|
doc_params = HashWithIndifferentAccess.new
|
48
|
-
allow(subject.
|
48
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
|
49
49
|
response = subject.find("123", doc_params)
|
50
50
|
expect(response).to be_a_kind_of Blacklight::SolrResponse
|
51
51
|
expect(response.params).to be_a_kind_of HashWithIndifferentAccess
|
@@ -55,31 +55,31 @@ describe Blacklight::SolrRepository do
|
|
55
55
|
describe "#search" do
|
56
56
|
it "should use the search-specific solr path" do
|
57
57
|
blacklight_config.solr_path = 'xyz'
|
58
|
-
allow(subject.
|
58
|
+
allow(subject.connection).to receive(:send_and_receive).with('xyz', anything).and_return(mock_response)
|
59
59
|
expect(subject.search({})).to be_a_kind_of Blacklight::SolrResponse
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should use the default solr path" do
|
63
|
-
allow(subject.
|
63
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
|
64
64
|
expect(subject.search({})).to be_a_kind_of Blacklight::SolrResponse
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should use a default :qt param" do
|
68
68
|
blacklight_config.qt = 'xyz'
|
69
|
-
allow(subject.
|
69
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', hash_including(params: { qt: 'xyz'})).and_return(mock_response)
|
70
70
|
expect(subject.search({})).to be_a_kind_of Blacklight::SolrResponse
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should use the provided :qt param" do
|
74
74
|
blacklight_config.qt = 'xyz'
|
75
|
-
allow(subject.
|
75
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', hash_including(params: { qt: 'abc'})).and_return(mock_response)
|
76
76
|
expect(subject.search({qt: 'abc'})).to be_a_kind_of Blacklight::SolrResponse
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should preserve the class of the incoming params" do
|
80
80
|
search_params = HashWithIndifferentAccess.new
|
81
81
|
search_params[:q] = "query"
|
82
|
-
allow(subject.
|
82
|
+
allow(subject.connection).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
|
83
83
|
|
84
84
|
response = subject.search(search_params)
|
85
85
|
expect(response).to be_a_kind_of Blacklight::SolrResponse
|
@@ -93,7 +93,7 @@ describe Blacklight::SolrRepository do
|
|
93
93
|
|
94
94
|
it "defaults to get" do
|
95
95
|
expect(blacklight_config.http_method).to eq :get
|
96
|
-
allow(subject.
|
96
|
+
allow(subject.connection).to receive(:send_and_receive) do |path, params|
|
97
97
|
expect(path).to eq 'select'
|
98
98
|
expect(params[:method]).to eq :get
|
99
99
|
expect(params[:params]).to include(:q)
|
@@ -107,7 +107,7 @@ describe Blacklight::SolrRepository do
|
|
107
107
|
|
108
108
|
it "keep value set to post" do
|
109
109
|
expect(blacklight_config.http_method).to eq :post
|
110
|
-
allow(subject.
|
110
|
+
allow(subject.connection).to receive(:send_and_receive) do |path, params|
|
111
111
|
expect(path).to eq 'select'
|
112
112
|
expect(params[:method]).to eq :post
|
113
113
|
expect(params[:data]).to include(:q)
|
@@ -128,4 +128,4 @@ describe Blacklight::SolrRepository do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
|
131
|
-
end
|
131
|
+
end
|
@@ -5,8 +5,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
5
5
|
describe RecordMailer do
|
6
6
|
before(:each) do
|
7
7
|
allow(RecordMailer).to receive(:default) { { :from => 'no-reply@projectblacklight.org' } }
|
8
|
-
SolrDocument.use_extension( Blacklight::
|
9
|
-
SolrDocument.use_extension( Blacklight::
|
8
|
+
SolrDocument.use_extension( Blacklight::Document::Email )
|
9
|
+
SolrDocument.use_extension( Blacklight::Document::Sms )
|
10
10
|
document = SolrDocument.new({:id=>"123456", :format=>["book"], :title_display => "The horn", :language_facet => "English", :author_display => "Janetzky, Kurt"})
|
11
11
|
@documents = [document]
|
12
12
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,7 @@ class TestAppGenerator < Rails::Generators::Base
|
|
17
17
|
|
18
18
|
def run_blacklight_generator
|
19
19
|
say_status("warning", "GENERATING BL", :yellow)
|
20
|
-
gem 'blacklight-marc', "5.
|
20
|
+
gem 'blacklight-marc', "~> 5.0", :github => 'projectblacklight/blacklight_marc'
|
21
21
|
|
22
22
|
Bundler.with_clean_env do
|
23
23
|
run "bundle install"
|
@@ -15,10 +15,10 @@ describe "catalog/_paginate_compact.html.erb" do
|
|
15
15
|
0
|
16
16
|
end
|
17
17
|
|
18
|
-
include Blacklight::
|
18
|
+
include Blacklight::SearchHelper
|
19
19
|
|
20
20
|
it "should render solr responses" do
|
21
|
-
solr_response, document_list =
|
21
|
+
solr_response, document_list = search_results({ q: '' }, CatalogController.search_params_logic)
|
22
22
|
|
23
23
|
render :partial => 'catalog/paginate_compact', :object => solr_response
|
24
24
|
expect(rendered).to have_selector ".page_entries"
|
@@ -15,7 +15,7 @@ describe "catalog/index" do
|
|
15
15
|
# run a solr query to get our data
|
16
16
|
c = CatalogController.new
|
17
17
|
c.blacklight_config = @config
|
18
|
-
@response, @document_list = c.
|
18
|
+
@response, @document_list = c.search_results(@params, c.search_params_logic)
|
19
19
|
|
20
20
|
# munge the solr response to match test expectations
|
21
21
|
@document_list[1] = SolrDocument.new(@document_list[1].with_indifferent_access.reject! { |k,v| k == "author_display" })
|
data/tasks/blacklight.rake
CHANGED
data/template.demo.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2015-03-
|
20
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: 1.0.
|
76
|
+
version: 1.0.11
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 1.0.
|
83
|
+
version: 1.0.11
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: bootstrap-sass
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -404,41 +404,8 @@ files:
|
|
404
404
|
- db/migrate/20140202020201_create_searches.rb
|
405
405
|
- db/migrate/20140202020202_create_bookmarks.rb
|
406
406
|
- db/migrate/20140320000000_add_polymorphic_type_to_bookmarks.rb
|
407
|
-
- doc/Adding-new-document-actions.md
|
408
|
-
- doc/Atom-Responses.md
|
409
|
-
- doc/Blacklight-Add-ons.md
|
410
|
-
- doc/Blacklight-configuration.md
|
411
|
-
- doc/Blacklight-on-Heroku.md
|
412
|
-
- doc/Blacklight-out-of-the-box.md
|
413
|
-
- doc/Bookmarks.md
|
414
|
-
- doc/Code4Lib-2014.md
|
415
|
-
- doc/Configuration---Facet-Fields.md
|
416
|
-
- doc/Configuration---Results-View.md
|
417
|
-
- doc/Configuration---Solr-fields.md
|
418
|
-
- doc/Configuring-and-Customizing-Blacklight.md
|
419
|
-
- doc/Configuring-rails-routes.md
|
420
|
-
- doc/Contributing-to-Blacklight.md
|
421
|
-
- doc/Examples.md
|
422
|
-
- doc/Extending-or-Modifying-Blacklight-Search-Behavior.md
|
423
|
-
- doc/Home.md
|
424
|
-
- doc/How-to-release-a-version.md
|
425
|
-
- doc/Indexing-your-data-into-solr.md
|
426
|
-
- doc/Internationalization.md
|
427
|
-
- doc/JSON-API.md
|
428
|
-
- doc/Pagination.md
|
429
|
-
- doc/Providing-your-own-view-templates.md
|
430
|
-
- doc/Quickstart.md
|
431
|
-
- doc/README_SOLR.md
|
432
|
-
- doc/Saved-Searches.md
|
433
|
-
- doc/Solr-Configuration.md
|
434
|
-
- doc/Sunspot-for-indexing.md
|
435
|
-
- doc/Support.md
|
436
|
-
- doc/Theming.md
|
437
|
-
- doc/Understanding-Rails-and-Blacklight.md
|
438
|
-
- doc/User-Authentication.md
|
439
|
-
- doc/_Sidebar.md
|
440
|
-
- doc/testing.md
|
441
407
|
- lib/blacklight.rb
|
408
|
+
- lib/blacklight/abstract_repository.rb
|
442
409
|
- lib/blacklight/base.rb
|
443
410
|
- lib/blacklight/bookmarks.rb
|
444
411
|
- lib/blacklight/catalog.rb
|
@@ -447,6 +414,7 @@ files:
|
|
447
414
|
- lib/blacklight/configurable.rb
|
448
415
|
- lib/blacklight/configuration.rb
|
449
416
|
- lib/blacklight/configuration/facet_field.rb
|
417
|
+
- lib/blacklight/configuration/field.rb
|
450
418
|
- lib/blacklight/configuration/fields.rb
|
451
419
|
- lib/blacklight/configuration/search_field.rb
|
452
420
|
- lib/blacklight/configuration/solr_field.rb
|
@@ -454,6 +422,14 @@ files:
|
|
454
422
|
- lib/blacklight/configuration/tool_config.rb
|
455
423
|
- lib/blacklight/configuration/view_config.rb
|
456
424
|
- lib/blacklight/controller.rb
|
425
|
+
- lib/blacklight/document.rb
|
426
|
+
- lib/blacklight/document/dublin_core.rb
|
427
|
+
- lib/blacklight/document/email.rb
|
428
|
+
- lib/blacklight/document/export.rb
|
429
|
+
- lib/blacklight/document/extensions.rb
|
430
|
+
- lib/blacklight/document/schema_org.rb
|
431
|
+
- lib/blacklight/document/semantic_fields.rb
|
432
|
+
- lib/blacklight/document/sms.rb
|
457
433
|
- lib/blacklight/document_presenter.rb
|
458
434
|
- lib/blacklight/engine.rb
|
459
435
|
- lib/blacklight/exceptions.rb
|
@@ -461,7 +437,9 @@ files:
|
|
461
437
|
- lib/blacklight/rails/routes.rb
|
462
438
|
- lib/blacklight/request_builders.rb
|
463
439
|
- lib/blacklight/routes.rb
|
440
|
+
- lib/blacklight/search_builder.rb
|
464
441
|
- lib/blacklight/search_fields.rb
|
442
|
+
- lib/blacklight/search_helper.rb
|
465
443
|
- lib/blacklight/solr.rb
|
466
444
|
- lib/blacklight/solr/document.rb
|
467
445
|
- lib/blacklight/solr/document/dublin_core.rb
|
@@ -473,6 +451,7 @@ files:
|
|
473
451
|
- lib/blacklight/solr/document/sms.rb
|
474
452
|
- lib/blacklight/solr/facet_paginator.rb
|
475
453
|
- lib/blacklight/solr/request.rb
|
454
|
+
- lib/blacklight/solr/search_builder.rb
|
476
455
|
- lib/blacklight/solr_helper.rb
|
477
456
|
- lib/blacklight/solr_repository.rb
|
478
457
|
- lib/blacklight/solr_response.rb
|
@@ -488,17 +467,20 @@ files:
|
|
488
467
|
- lib/blacklight/utils.rb
|
489
468
|
- lib/blacklight/version.rb
|
490
469
|
- lib/generators/blacklight/assets_generator.rb
|
470
|
+
- lib/generators/blacklight/controller_generator.rb
|
471
|
+
- lib/generators/blacklight/document_generator.rb
|
491
472
|
- lib/generators/blacklight/install_generator.rb
|
492
473
|
- lib/generators/blacklight/models_generator.rb
|
493
474
|
- lib/generators/blacklight/templates/alternate_controller.rb
|
494
475
|
- lib/generators/blacklight/templates/blacklight.css.scss
|
495
476
|
- lib/generators/blacklight/templates/blacklight.en.yml
|
496
477
|
- lib/generators/blacklight/templates/catalog_controller.rb
|
478
|
+
- lib/generators/blacklight/templates/config/blacklight.yml
|
497
479
|
- lib/generators/blacklight/templates/config/initializers/blacklight_initializer.rb
|
498
480
|
- lib/generators/blacklight/templates/config/jetty.yml
|
499
|
-
- lib/generators/blacklight/templates/config/solr.yml
|
500
481
|
- lib/generators/blacklight/templates/solr_document.rb
|
501
482
|
- lib/generators/blacklight/test_support_generator.rb
|
483
|
+
- lib/generators/blacklight/user_generator.rb
|
502
484
|
- lib/railties/blacklight.rake
|
503
485
|
- solr/sample_solr_documents.yml
|
504
486
|
- spec/controllers/alternate_controller_spec.rb
|
@@ -533,15 +515,18 @@ files:
|
|
533
515
|
- spec/lib/blacklight/catalog/component_configuration_spec.rb
|
534
516
|
- spec/lib/blacklight/configurable_spec.rb
|
535
517
|
- spec/lib/blacklight/configuration_spec.rb
|
518
|
+
- spec/lib/blacklight/document/dublin_core_spec.rb
|
519
|
+
- spec/lib/blacklight/document/email_spec.rb
|
520
|
+
- spec/lib/blacklight/document/sms_spec.rb
|
536
521
|
- spec/lib/blacklight/facet_paginator_spec.rb
|
537
522
|
- spec/lib/blacklight/routes_spec.rb
|
523
|
+
- spec/lib/blacklight/search_builder_spec.rb
|
538
524
|
- spec/lib/blacklight/search_fields_spec.rb
|
539
|
-
- spec/lib/blacklight/
|
540
|
-
- spec/lib/blacklight/solr/document/email_spec.rb
|
525
|
+
- spec/lib/blacklight/search_helper_spec.rb
|
541
526
|
- spec/lib/blacklight/solr/document/more_like_this_spec.rb
|
542
|
-
- spec/lib/blacklight/solr/document/sms_spec.rb
|
543
527
|
- spec/lib/blacklight/solr/document_spec.rb
|
544
528
|
- spec/lib/blacklight/solr/request_spec.rb
|
529
|
+
- spec/lib/blacklight/solr/search_builder_spec.rb
|
545
530
|
- spec/lib/blacklight/solr_helper_spec.rb
|
546
531
|
- spec/lib/blacklight/solr_repository_spec.rb
|
547
532
|
- spec/lib/blacklight/solr_response/facets_spec.rb
|
@@ -648,15 +633,18 @@ test_files:
|
|
648
633
|
- spec/lib/blacklight/catalog/component_configuration_spec.rb
|
649
634
|
- spec/lib/blacklight/configurable_spec.rb
|
650
635
|
- spec/lib/blacklight/configuration_spec.rb
|
636
|
+
- spec/lib/blacklight/document/dublin_core_spec.rb
|
637
|
+
- spec/lib/blacklight/document/email_spec.rb
|
638
|
+
- spec/lib/blacklight/document/sms_spec.rb
|
651
639
|
- spec/lib/blacklight/facet_paginator_spec.rb
|
652
640
|
- spec/lib/blacklight/routes_spec.rb
|
641
|
+
- spec/lib/blacklight/search_builder_spec.rb
|
653
642
|
- spec/lib/blacklight/search_fields_spec.rb
|
654
|
-
- spec/lib/blacklight/
|
655
|
-
- spec/lib/blacklight/solr/document/email_spec.rb
|
643
|
+
- spec/lib/blacklight/search_helper_spec.rb
|
656
644
|
- spec/lib/blacklight/solr/document/more_like_this_spec.rb
|
657
|
-
- spec/lib/blacklight/solr/document/sms_spec.rb
|
658
645
|
- spec/lib/blacklight/solr/document_spec.rb
|
659
646
|
- spec/lib/blacklight/solr/request_spec.rb
|
647
|
+
- spec/lib/blacklight/solr/search_builder_spec.rb
|
660
648
|
- spec/lib/blacklight/solr_helper_spec.rb
|
661
649
|
- spec/lib/blacklight/solr_repository_spec.rb
|
662
650
|
- spec/lib/blacklight/solr_response/facets_spec.rb
|
@@ -1,94 +0,0 @@
|
|
1
|
-
In your `CatalogController`, you can register document actions that display in various places within the default Blacklight UI:
|
2
|
-
|
3
|
-
- `add_show_tools_partial`: displays on the `catalog#show` page, using the `render_show_doc_actions` helper
|
4
|
-
- `add_results_document_tool`: displays on every search result, using the `render_index_doc_actions` helper
|
5
|
-
- `add_results_collection_tool`: displays at the top of a search result page, using the `render_results_collection_tools` helper
|
6
|
-
- `add_nav_action`: displays in the top application navbar, using the `render_nav_actions` helper
|
7
|
-
|
8
|
-
All types of actions take the same parameters, e.g.:
|
9
|
-
|
10
|
-
```ruby
|
11
|
-
##
|
12
|
-
# Add a partial to the tools for rendering a document
|
13
|
-
# @param partial [String] the name of the document partial
|
14
|
-
# @param opts [Hash]
|
15
|
-
# @option opts [String] :partial render this action using the provided partial
|
16
|
-
# @option opts [Symbol,Proc] :if render this action if the method identified by the symbol or the proc evaluates to true.
|
17
|
-
# The proc will receive the action configuration and the document or documents for the action.
|
18
|
-
# @option opts [Symbol,Proc] :unless render this action unless the method identified by the symbol or the proc evaluates to true
|
19
|
-
# The proc will receive the action configuration and the document or documents for the action.
|
20
|
-
def add_show_tools_partial name, opts = {}
|
21
|
-
```
|
22
|
-
|
23
|
-
Examples:
|
24
|
-
|
25
|
-
```
|
26
|
-
class CatalogController
|
27
|
-
...
|
28
|
-
|
29
|
-
# only show patron information if a user is logged in. Note that `current_user?` has to be defined as a helper method
|
30
|
-
add_nav_action :patron_information, if: :current_user?
|
31
|
-
|
32
|
-
# In Rails 4+, this can also be defined using an inline proc:
|
33
|
-
add_nav_action :patron_information, if: Proc.new { |context, config, options| context.current_user? }
|
34
|
-
|
35
|
-
# Actions can also trigger based on properties of the document:
|
36
|
-
add_show_tools_partial :download_image_widget, if: Proc.new { |context, config, options| options[:document].image? }
|
37
|
-
|
38
|
-
...
|
39
|
-
end
|
40
|
-
```
|
41
|
-
|
42
|
-
|
43
|
-
## Show Tools
|
44
|
-
You can register an action that displays on the document show page using the `add_show_tools_partial` controller method. In addition to the functionality offered by the other types of tools and actions, show tools also offer conventional defaults.
|
45
|
-
|
46
|
-
Here is a trivial example of registering a new type of action:
|
47
|
-
|
48
|
-
```ruby
|
49
|
-
# app/controllers/catalog_controller.rb
|
50
|
-
class CatalogController
|
51
|
-
add_show_tools_partial :my_custom_action
|
52
|
-
|
53
|
-
## OPTIONAL
|
54
|
-
# def my_custom_action
|
55
|
-
# # render some content..
|
56
|
-
# # by default, Blacklight will try to render the partial of the same name (i.e. `app/views/catalog/my_custom_action.html.erb`)
|
57
|
-
# end
|
58
|
-
end
|
59
|
-
|
60
|
-
# config/routes
|
61
|
-
Rails.application.routes.draw do
|
62
|
-
...
|
63
|
-
get '/catalog/:id/my_custom_action' => 'catalog#my_custom_action', as: 'my_custom_action_catalog'
|
64
|
-
end
|
65
|
-
```
|
66
|
-
|
67
|
-
|
68
|
-
If the action will receive form data from a `POST` request, you can also register a callback for handling that request. Optionally, the `POST` params can be validated using a helper method.
|
69
|
-
|
70
|
-
```ruby
|
71
|
-
class CatalogController
|
72
|
-
include Blacklight::Catalog
|
73
|
-
...
|
74
|
-
|
75
|
-
# Register a new action called "email".
|
76
|
-
# On a POST request, validate the params using the `#validate_email_params` method
|
77
|
-
# and process the request using `#email_action`.
|
78
|
-
add_show_tools_partial :email, callback: :email_action, validator: :validate_email_params
|
79
|
-
|
80
|
-
def validate_email_params
|
81
|
-
# validate that the posted params are suitable for the action
|
82
|
-
end
|
83
|
-
|
84
|
-
def email_action documents
|
85
|
-
# send an email with the attached documents
|
86
|
-
end
|
87
|
-
|
88
|
-
...
|
89
|
-
end
|
90
|
-
```
|
91
|
-
|
92
|
-
By convention, the action name is used to determine the route name for the action. For this email action, Blacklight will link to `email_catalog_path`.
|
93
|
-
|
94
|
-
The action will render the template [`catalog/email.html.erb`](https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/email.html.erb) template when the action is selected. This template provides a form, which, when submitted, will trigger the `email_action` method and will render the [`catalog/email_success.html.erb`](https://github.com/projectblacklight/blacklight/blob/master/app/views/catalog/email_success.html.erb) template.
|