blacklight 5.9.4 → 5.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/VERSION +1 -1
  4. data/app/assets/stylesheets/blacklight/_facets.scss +11 -10
  5. data/app/helpers/blacklight/blacklight_helper_behavior.rb +14 -14
  6. data/app/helpers/blacklight/configuration_helper_behavior.rb +16 -10
  7. data/app/helpers/blacklight/facets_helper_behavior.rb +15 -14
  8. data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
  9. data/app/models/bookmark.rb +1 -4
  10. data/app/models/search.rb +3 -6
  11. data/app/views/catalog/_facet_layout.html.erb +2 -2
  12. data/app/views/catalog/_facet_limit.html.erb +5 -3
  13. data/app/views/catalog/_facet_pivot.html.erb +4 -4
  14. data/app/views/catalog/_home_text.html.erb +8 -48
  15. data/app/views/catalog/_index_default.html.erb +3 -3
  16. data/app/views/catalog/_show_default.html.erb +3 -3
  17. data/app/views/catalog/_sms_form.html.erb +1 -1
  18. data/app/views/catalog/facet.html.erb +1 -1
  19. data/blacklight.gemspec +1 -1
  20. data/config/jetty.yml +0 -3
  21. data/config/locales/blacklight.de.yml +2 -0
  22. data/config/locales/blacklight.en.yml +2 -0
  23. data/config/locales/blacklight.es.yml +2 -0
  24. data/config/locales/blacklight.fr.yml +2 -0
  25. data/config/locales/blacklight.pt-BR.yml +2 -0
  26. data/lib/blacklight.rb +70 -26
  27. data/lib/blacklight/abstract_repository.rb +29 -0
  28. data/lib/blacklight/base.rb +7 -7
  29. data/lib/blacklight/bookmarks.rb +5 -5
  30. data/lib/blacklight/catalog.rb +34 -19
  31. data/lib/blacklight/catalog/search_context.rb +1 -1
  32. data/lib/blacklight/configuration.rb +112 -46
  33. data/lib/blacklight/configuration/facet_field.rb +9 -7
  34. data/lib/blacklight/configuration/field.rb +27 -0
  35. data/lib/blacklight/configuration/fields.rb +25 -20
  36. data/lib/blacklight/configuration/search_field.rb +6 -8
  37. data/lib/blacklight/configuration/solr_field.rb +3 -18
  38. data/lib/blacklight/configuration/sort_field.rb +6 -7
  39. data/lib/blacklight/document.rb +156 -0
  40. data/lib/blacklight/document/dublin_core.rb +41 -0
  41. data/lib/blacklight/document/email.rb +16 -0
  42. data/lib/blacklight/document/export.rb +107 -0
  43. data/lib/blacklight/document/extensions.rb +56 -0
  44. data/lib/blacklight/document/schema_org.rb +7 -0
  45. data/lib/blacklight/document/semantic_fields.rb +51 -0
  46. data/lib/blacklight/document/sms.rb +14 -0
  47. data/lib/blacklight/document_presenter.rb +3 -3
  48. data/lib/blacklight/exceptions.rb +9 -2
  49. data/lib/blacklight/facet.rb +21 -16
  50. data/lib/blacklight/request_builders.rb +60 -284
  51. data/lib/blacklight/routes.rb +1 -1
  52. data/lib/blacklight/search_builder.rb +130 -0
  53. data/lib/blacklight/search_helper.rb +316 -0
  54. data/lib/blacklight/solr.rb +1 -0
  55. data/lib/blacklight/solr/document.rb +4 -187
  56. data/lib/blacklight/solr/document/dublin_core.rb +3 -37
  57. data/lib/blacklight/solr/document/email.rb +4 -13
  58. data/lib/blacklight/solr/document/export.rb +3 -103
  59. data/lib/blacklight/solr/document/extensions.rb +4 -52
  60. data/lib/blacklight/solr/document/more_like_this.rb +1 -1
  61. data/lib/blacklight/solr/document/schema_org.rb +4 -4
  62. data/lib/blacklight/solr/document/sms.rb +4 -11
  63. data/lib/blacklight/solr/facet_paginator.rb +2 -2
  64. data/lib/blacklight/solr/search_builder.rb +264 -0
  65. data/lib/blacklight/solr_helper.rb +6 -261
  66. data/lib/blacklight/solr_repository.rb +30 -24
  67. data/lib/blacklight/solr_response.rb +3 -3
  68. data/lib/blacklight/user.rb +1 -2
  69. data/lib/blacklight/utils.rb +0 -23
  70. data/lib/generators/blacklight/controller_generator.rb +38 -0
  71. data/lib/generators/blacklight/document_generator.rb +20 -0
  72. data/lib/generators/blacklight/install_generator.rb +38 -39
  73. data/lib/generators/blacklight/models_generator.rb +2 -62
  74. data/lib/generators/blacklight/templates/catalog_controller.rb +3 -4
  75. data/lib/generators/blacklight/templates/config/{solr.yml → blacklight.yml} +3 -0
  76. data/lib/generators/blacklight/templates/config/jetty.yml +0 -3
  77. data/lib/generators/blacklight/templates/solr_document.rb +6 -6
  78. data/lib/generators/blacklight/test_support_generator.rb +1 -6
  79. data/lib/generators/blacklight/user_generator.rb +59 -0
  80. data/lib/railties/blacklight.rake +16 -7
  81. data/spec/controllers/catalog_controller_spec.rb +9 -15
  82. data/spec/features/facets_spec.rb +8 -0
  83. data/spec/helpers/configuration_helper_spec.rb +6 -13
  84. data/spec/helpers/facets_helper_spec.rb +3 -2
  85. data/spec/lib/blacklight/configuration_spec.rb +11 -38
  86. data/spec/lib/blacklight/{solr/document → document}/dublin_core_spec.rb +4 -4
  87. data/spec/lib/blacklight/{solr/document → document}/email_spec.rb +2 -2
  88. data/spec/lib/blacklight/{solr/document → document}/sms_spec.rb +2 -2
  89. data/spec/lib/blacklight/search_builder_spec.rb +145 -0
  90. data/spec/lib/blacklight/search_helper_spec.rb +775 -0
  91. data/spec/lib/blacklight/solr/document/more_like_this_spec.rb +1 -1
  92. data/spec/lib/blacklight/solr/search_builder_spec.rb +561 -0
  93. data/spec/lib/blacklight/solr_helper_spec.rb +5 -1291
  94. data/spec/lib/blacklight/solr_repository_spec.rb +13 -13
  95. data/spec/models/record_mailer_spec.rb +2 -2
  96. data/spec/spec_helper.rb +1 -0
  97. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  98. data/spec/views/catalog/_constraints.html.erb_spec.rb +1 -1
  99. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -2
  100. data/spec/views/catalog/index.atom.builder_spec.rb +1 -1
  101. data/tasks/blacklight.rake +1 -1
  102. data/template.demo.rb +1 -1
  103. metadata +33 -45
  104. data/doc/Adding-new-document-actions.md +0 -94
  105. data/doc/Atom-Responses.md +0 -90
  106. data/doc/Blacklight-Add-ons.md +0 -23
  107. data/doc/Blacklight-configuration.md +0 -411
  108. data/doc/Blacklight-on-Heroku.md +0 -100
  109. data/doc/Blacklight-out-of-the-box.md +0 -47
  110. data/doc/Bookmarks.md +0 -1
  111. data/doc/Code4Lib-2014.md +0 -94
  112. data/doc/Configuration---Facet-Fields.md +0 -130
  113. data/doc/Configuration---Results-View.md +0 -224
  114. data/doc/Configuration---Solr-fields.md +0 -106
  115. data/doc/Configuring-and-Customizing-Blacklight.md +0 -257
  116. data/doc/Configuring-rails-routes.md +0 -13
  117. data/doc/Contributing-to-Blacklight.md +0 -43
  118. data/doc/Examples.md +0 -120
  119. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +0 -141
  120. data/doc/Home.md +0 -100
  121. data/doc/How-to-release-a-version.md +0 -45
  122. data/doc/Indexing-your-data-into-solr.md +0 -36
  123. data/doc/Internationalization.md +0 -32
  124. data/doc/JSON-API.md +0 -83
  125. data/doc/Pagination.md +0 -52
  126. data/doc/Providing-your-own-view-templates.md +0 -69
  127. data/doc/Quickstart.md +0 -153
  128. data/doc/README_SOLR.md +0 -245
  129. data/doc/Saved-Searches.md +0 -5
  130. data/doc/Solr-Configuration.md +0 -154
  131. data/doc/Sunspot-for-indexing.md +0 -46
  132. data/doc/Support.md +0 -33
  133. data/doc/Theming.md +0 -62
  134. data/doc/Understanding-Rails-and-Blacklight.md +0 -75
  135. data/doc/User-Authentication.md +0 -60
  136. data/doc/_Sidebar.md +0 -9
  137. 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.blacklight_solr).to receive(:send_and_receive).with('abc', anything).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('xyz', anything).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', hash_including(params: { id: '123', qt: 'document'})).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', hash_including(params: { id: '123', qt: 'abc'})).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('xyz', anything).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', hash_including(params: { qt: 'xyz'})).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', hash_including(params: { qt: 'abc'})).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive).with('select', anything).and_return(mock_response)
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.blacklight_solr).to receive(:send_and_receive) do |path, params|
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.blacklight_solr).to receive(:send_and_receive) do |path, params|
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::Solr::Document::Email )
9
- SolrDocument.use_extension( Blacklight::Solr::Document::Sms )
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
@@ -15,6 +15,7 @@ if ENV["COVERAGE"] or ENV["CI"]
15
15
  end
16
16
  end
17
17
 
18
+ require 'rsolr'
18
19
  require 'blacklight'
19
20
  require 'blacklight/marc'
20
21
 
@@ -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.5.0"
20
+ gem 'blacklight-marc', "~> 5.0", :github => 'projectblacklight/blacklight_marc'
21
21
 
22
22
  Bundler.with_clean_env do
23
23
  run "bundle install"
@@ -32,4 +32,4 @@ describe "catalog/constraints" do
32
32
  expect(rendered).to have_link("Start Over", :href => 'http://xyz?view=xyz')
33
33
  end
34
34
 
35
- end
35
+ end
@@ -15,10 +15,10 @@ describe "catalog/_paginate_compact.html.erb" do
15
15
  0
16
16
  end
17
17
 
18
- include Blacklight::SolrHelper
18
+ include Blacklight::SearchHelper
19
19
 
20
20
  it "should render solr responses" do
21
- solr_response, document_list = get_search_results(:q => '')
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.get_search_results(@params)
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" })
@@ -1,4 +1,4 @@
1
- ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.4.zip"
1
+ ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.3.zip"
2
2
 
3
3
  require 'jettywrapper'
4
4
  require 'engine_cart/rake_task'
data/template.demo.rb CHANGED
@@ -16,6 +16,6 @@ rake "db:migrate"
16
16
  if options =~ /jettywrapper/
17
17
  rake "jetty:clean"
18
18
  rake "jetty:start"
19
- rake "blacklight:solr:seed"
19
+ rake "blacklight:index:seed"
20
20
  rake "jetty:stop"
21
21
  end
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.9.4
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-24 00:00:00.000000000 Z
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.6
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.6
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/solr/document/dublin_core_spec.rb
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/solr/document/dublin_core_spec.rb
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.