blacklight 4.6.3 → 4.7.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/controllers/bookmarks_controller.rb +4 -0
  4. data/app/helpers/blacklight/blacklight_helper_behavior.rb +76 -21
  5. data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +8 -1
  6. data/app/views/catalog/_citation.html.erb +1 -1
  7. data/app/views/catalog/_did_you_mean.html.erb +1 -1
  8. data/app/views/catalog/_search_form.html.erb +1 -1
  9. data/blacklight.gemspec +1 -1
  10. data/config/locales/blacklight.en.yml +3 -0
  11. data/config/locales/blacklight.fr.yml +3 -0
  12. data/doc/Atom-Responses.md +90 -0
  13. data/doc/Blacklight-3.0-Release-Notes-And-Upgrade-Guide.md +107 -0
  14. data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +191 -0
  15. data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +37 -0
  16. data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +27 -0
  17. data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +44 -0
  18. data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +25 -0
  19. data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +80 -0
  20. data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +11 -0
  21. data/doc/Blacklight-4.0-release-notes-and-upgrade-guide.md +135 -0
  22. data/doc/Blacklight-4.1-release-notes-and-upgrade-guide.md +17 -0
  23. data/doc/Blacklight-4.2-release-notes-and-upgrade-guide.md +25 -0
  24. data/doc/Blacklight-4.3-release-notes-and-upgrade-guide.md +21 -0
  25. data/doc/Blacklight-4.4-release-notes-and-upgrade-guide.md +41 -0
  26. data/doc/Blacklight-Add-ons.md +28 -0
  27. data/doc/Blacklight-configuration.md +411 -0
  28. data/doc/Blacklight-on-Heroku.md +135 -0
  29. data/doc/Code4Lib-2014.md +48 -0
  30. data/doc/Community-principles.md +44 -0
  31. data/doc/Configuring-and-Customizing-Blacklight.md +271 -0
  32. data/doc/Configuring-rails-routes.md +13 -0
  33. data/doc/Contributing-to-Blacklight.md +25 -0
  34. data/doc/Examples.md +94 -0
  35. data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +141 -0
  36. data/doc/FAQs.md +1 -0
  37. data/doc/Home.md +80 -0
  38. data/doc/How-to-release-a-version.md +29 -0
  39. data/doc/Indexing-your-data-into-solr.md +32 -0
  40. data/doc/Integration-with-Rails-Footnotes.md +20 -0
  41. data/doc/Internationalization.md +32 -0
  42. data/doc/JSON-API.md +17 -0
  43. data/doc/Pagination.md +51 -0
  44. data/doc/Providing-your-own-view-templates.md +109 -0
  45. data/doc/Quickstart.md +115 -0
  46. data/doc/README_SOLR.md +245 -0
  47. data/doc/Release-Notes-And-Upgrade-Guides.md +20 -0
  48. data/doc/Roadmap.md +43 -0
  49. data/doc/Sunspot-for-indexing.md +46 -0
  50. data/doc/Theming.md +64 -0
  51. data/doc/User-Authentication.md +60 -0
  52. data/doc/testing.md +57 -0
  53. data/lib/blacklight.rb +6 -0
  54. data/lib/blacklight/base.rb +2 -0
  55. data/lib/blacklight/catalog.rb +4 -3
  56. data/lib/blacklight/catalog/search_context.rb +8 -1
  57. data/lib/blacklight/configurable.rb +1 -2
  58. data/lib/blacklight/solr/document.rb +2 -1
  59. data/lib/blacklight/solr_helper.rb +8 -0
  60. data/lib/blacklight/user.rb +7 -2
  61. data/lib/blacklight/utils.rb +9 -1
  62. data/lib/generators/blacklight/templates/catalog_controller.rb +1 -4
  63. data/spec/helpers/blacklight_helper_spec.rb +84 -9
  64. data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -1
  65. data/spec/lib/blacklight_spec.rb +6 -0
  66. data/spec/lib/blacklight_user_spec.rb +4 -0
  67. data/spec/lib/solr_helper_spec.rb +8 -6
  68. data/spec/lib/utils_spec.rb +35 -5
  69. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +1 -1
  70. metadata +49 -8
@@ -0,0 +1,20 @@
1
+ This is for upgrade guides for each version.
2
+ * [Blacklight 4.5 Release Notes and Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.5.0) (???)
3
+ * [Blacklight 4.4 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.4.0) (September 17, 2013)
4
+ * [Blacklight 4.3 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.3.0) (July 30, 2013)
5
+ * [Blacklight 4.2.2 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.2.2) (2013)
6
+ * [Blacklight 4.2.1 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.2.1) (2013)
7
+ * [Blacklight 4.2.0 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.2.0) (Mar 29, 2013)
8
+ * [Blacklight 4.1 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.1.0) (Mar 7, 2013)
9
+ * [Blacklight 4.0 Release Notes And Upgrade Guide](https://github.com/projectblacklight/blacklight/releases/tag/v4.0.0) (Nov 29, 2012)
10
+ * [[Blacklight 3.8 Release Notes And Upgrade Guide]] (Nov 2, 2012)
11
+ * [[Blacklight 3.7 Release Notes And Upgrade Guide]] (Sep 25, 2012)
12
+ * [[Blacklight 3.6 Release Notes And Upgrade Guide]] (Sep 10, 2012)
13
+ * [[Blacklight 3.5 Release Notes And Upgrade Guide]] (Jun 25, 2012)
14
+ * [[Blacklight 3.4 Release Notes And Upgrade Guide]] (Apr 24, 2012)
15
+ * [[Blacklight 3.3 Release Notes And Upgrade Guide]] (Mar 19, 2012)
16
+ * [[Blacklight 3.2 Release Notes And Upgrade Guide]] (Dec 15, 2011)
17
+ * [[Blacklight 3.1 Release Notes And Upgrade Guide]] (Sep 28, 2011)
18
+ * [[Blacklight 3.0 Release Notes And Upgrade Guide]] (July 11, 2011)
19
+
20
+ Unreleased
data/doc/Roadmap.md ADDED
@@ -0,0 +1,43 @@
1
+ <table>
2
+ <thead><td>Feature</td><td>What can be reused?</td><td>Who wants this</td><td>Who can work on this</td></thead>
3
+ <tbody>
4
+ <tr>
5
+ <td>Document Index view toggles</td>
6
+ <td><a href="https://revs-lib.stanford.edu/catalog?f%5Bpub_year_isim%5D%5B%5D=1930&q=&utf8=%E2%9C%93">Stanford</a>, <a href="http://levysheetmusic.mse.jhu.edu/catalog?utf8=%E2%9C%93&q=&f%5Bmods_subject_facet%5D%5B%5D=African+Americans">JHU</a></td>
7
+ <td></td>
8
+ <td></td>
9
+ </tr>
10
+ <tr>
11
+ <td>i18n files in blacklight</td>
12
+ <td>Stanford has fr + it</td>
13
+ <td></td>
14
+ <td></td>
15
+ </tr>
16
+
17
+ <tr>
18
+ <td><a href="https://groups.google.com/forum/?fromgroups=#!topic/blacklight-development/Brz3ePltc3w">Thumbnails in search results</a></td>
19
+ <td>Many places</td>
20
+ <td></td>
21
+ <td>cbeer</td>
22
+ </tr>
23
+
24
+ <tr>
25
+ <td><a href="https://groups.google.com/forum/?fromgroups#!topic/blacklight-development/LGk2DtsA8rA">Blacklight curriculum for RailsBridge</a></td>
26
+ <td></td>
27
+ <td></td>
28
+ <td>bess</td>
29
+ </tr>
30
+ <tr>
31
+ <td>Tags and Comments</td>
32
+ <td></td>
33
+ <td>afred,awead</td>
34
+ <td></td>
35
+ </tr>
36
+ <tr>
37
+ <td>Caching</td>
38
+ <td></td>
39
+ <td>jronallo</td>
40
+ <td></td>
41
+ </tr>
42
+ </tbody>
43
+ </table>
@@ -0,0 +1,46 @@
1
+ If you have a Rails application as your data store, you may look to [Sunspot](http://outoftime.github.com/sunspot/) to help index your ActiveRecord models. Sunspot provides a nice DSL that makes it easy to index your models and associations. There is one gotcha, though, for using Sunspot with Blacklight. Both Sunspot and Blacklight expect the Solr uniqueKey to be in the "id" field. Sunspot will use the class of your model plus the primary key of that instance as the value for the id field. So a value for the id field may look like this: "Resource 123".
2
+
3
+ When a Sunspot-indexed Solr is used with Blacklight your model names and primary keys are exposed in your URLs. You may want to use a different value as your id value for Blacklight to use for document recall and URLs. For instance you want to use a unique filename as your id value for Blacklight.
4
+
5
+ You can use something like the following monkeypatch of Sunspot (1.2) by placing it in config/initializers/sunspot_monkeypatch_id.rb. It takes the value of the id field that Sunspot creates (Resource 123) and places it in the resource_id_ss field. It then overwrites the id value with the value from the filename field. The second part then takes a Solr hit and reverses it so that Sunspot can retrieve your models.
6
+
7
+ ```ruby
8
+ # for using a different value for the id field of your Solr documents
9
+ Sunspot::Indexer.module_eval do
10
+ alias :old_prepare :prepare
11
+ def prepare(model)
12
+ document = old_prepare(model)
13
+ document.fields_by_name(:resource_id_ss).first.value = document.fields_by_name(:id).first.value
14
+ if !document.fields_by_name(:filename).blank? and !document.fields_by_name(:filename).first.blank?
15
+ document.fields_by_name(:id).first.value = document.fields_by_name(:filename).first.value
16
+ end
17
+ document
18
+ end
19
+
20
+ alias :old_remove :remove
21
+ def remove(*models)
22
+ @connection.delete_by_id(
23
+ models.map do |model|
24
+ prepare(model).fields_by_name(:id).first.value
25
+ end
26
+ )
27
+ end
28
+
29
+ end
30
+
31
+ # to allow searching with Sunspot's DSL as well to retrieve your models
32
+ class Sunspot::Search::Hit
33
+ def initialize(raw_hit, highlights, search)
34
+ raw_hit['id'] = raw_hit['resource_id_ss']
35
+ @class_name, @primary_key = *raw_hit['id'].match(/([^ ]+) (.+)/)[1..2]
36
+ @score = raw_hit['score']
37
+ @search = search
38
+ @stored_values = raw_hit
39
+ @stored_cache = {}
40
+ @highlights = highlights
41
+ end
42
+ end
43
+ ```
44
+
45
+
46
+
data/doc/Theming.md ADDED
@@ -0,0 +1,64 @@
1
+ # Theming Blacklight
2
+
3
+ ## Bootswatches
4
+
5
+ The Blacklight 4.x styling is [[Twitter Bootstrap|http://twitter.github.com/bootstrap]] based. While there is some Blacklight-specific code for handling layouts and positions, most (if not all) the "styling" (colors, fonts, etc) are handled by Bootstrap.
6
+
7
+ There are many sources for Bootstrap themes. We'll look at bootswatches because they are fairly painless to integrate into a Rails application.
8
+
9
+ First, add the [[bootswatch-rails gem|https://github.com/maxim/bootswatch-rails]] to your Gemfile (and run ```bundle install```):
10
+
11
+ ```ruby
12
+ gem 'bootswatch-rails'
13
+ ```
14
+
15
+ This will give you the set of themes from [[http://bootswatch.com/]], converted to SASS and exposed to the Rails asset pipeline.
16
+
17
+ Out of the box, your application's blacklight stylesheet (generated by default to ```app/assets/stylesheets/blacklight.css.scss```) looks something like:
18
+
19
+ ```css
20
+ @import 'bootstrap';
21
+ @import 'bootstrap-responsive';
22
+
23
+ @import 'blacklight/blacklight';
24
+ ```
25
+
26
+ To add the one of the bootswatch themes ('cerulean' in this example):
27
+
28
+ ```css
29
+ @import "bootswatch/cerulean/variables";
30
+
31
+ @import "bootstrap";
32
+ @import "bootstrap-responsive";
33
+
34
+ @import "bootswatch/cerulean/bootswatch";
35
+
36
+ @import 'blacklight/blacklight'
37
+ ```
38
+
39
+ ![Blacklight with the Cerulean theme applied](http://projectblacklight.org/images/blacklight-cerulean.png)
40
+
41
+ The [[bootswatch-rails|https://github.com/maxim/bootswatch-rails]] documentation provides similar directions, a list of available out-of-the-box themes, and more.
42
+
43
+ > As of this writing, not all bootswatch-rails themes seem to be bootstrap 2.1.x compatible, or do weird things to the Blacklight navbar, etc. Your milage may vary.
44
+
45
+ ## Developing a Customized "Local" Theme
46
+
47
+ In most cases, you will want to develop your own theme within your Blacklight app, outside of the Bootswatch gem. To do this, you can do the following in your ```app/assets/stylesheets``` directory:
48
+
49
+ 1. create your own _variables.scss and _bootswatch.scss files in stylesheets/ (easiest way to do this is to copy those files from the [[bootstrap-sass project|https://github.com/thomas-mcdonald/bootstrap-sass/tree/master/vendor/assets/stylesheets/bootstrap]] or an existing theme and customize from there)
50
+ 2. change application.css to application.css.scss
51
+ 3. add the import statements given in the above "theming" example to application.css.scss
52
+ 4. delete blacklight.css.scss
53
+
54
+ So, your application.css.scss should look like this:
55
+ ```css
56
+ @import "variables";
57
+
58
+ @import "bootstrap";
59
+ @import "bootstrap-responsive";
60
+
61
+ @import "bootswatch";
62
+
63
+ @import 'blacklight/blacklight'
64
+ ```
@@ -0,0 +1,60 @@
1
+ Blacklight does not require user authentication, however, if included, Blacklight can provide additional features for users ([[Bookmarks]], [[Saved Searches]], etc). Because of the wide range of institutional needs and capabilities, Blacklight does not require a specific user authentication provider.
2
+
3
+ ## Installing with Devise
4
+
5
+ If you are rolling your own user authentication system, we highly recommend [[Devise|https://github.com/plataformatec/devise]], an extremely flexible authentication solution that is relatively straightforward. For directions to install the Blacklight gem using devise, see the [[Quickstart]].
6
+
7
+ ## Install and Use (with a custom user authentication system)
8
+
9
+ Create a new rails 3 application
10
+ ```bash
11
+ $ rails new my_app
12
+ ```
13
+
14
+ Add blacklight to your gem file
15
+ ```bash
16
+ edit ./my_app/Gemfile
17
+ ```
18
+ ```ruby.
19
+ # Append this line to the end of the file:
20
+ gem 'blacklight'
21
+ ```
22
+
23
+ ```bash
24
+ $ bundle install
25
+ ```
26
+
27
+ If you have a `User` model already, the Blacklight generator will connect to it automatically during installation. However, you will need to make sure the following named routes are included in your /config/routes.rb file:
28
+
29
+ ```ruby
30
+ match 'your_login', :to => 'Your User Session Controller # Log in action', :as => 'new_user_session'
31
+ match 'your_logout', :to => 'Your User Session Controller # Log Out action', :as => 'destroy_user_session'
32
+ match 'your_account_page', :to => 'Your User Session Controller # Account edit action', :as => 'edit_user_registration'
33
+ ```
34
+
35
+ One blacklight view partial uses `#to_s` on your user model to get a user-displayable account name/identifier for the currently logged in account, so you probably want to have such a method.
36
+
37
+ Finally, you will need to make sure the following methods are available both on controllers and as helpers:
38
+
39
+ * `current_user` - Which should return an ActiveRecord-based user object that include Blacklight::User
40
+ * `user_session` - Which are included in your /config/routes.rb file:
41
+
42
+ Optionally,
43
+ * `guest_user` - Which should return an ActiveRecord-based temporary guest user object available across the current user session.
44
+ * `current_or_guest_user` - Which should return the `current_user`, if available, or `guest_user`. If you don't provide this method, a stub method (that just returns `current_user`) will be provided for you.
45
+
46
+ If you are supporting guest users, if a guest user logs in, you should call `#transfer_guest_user_actions_to_current_user` to move any persisted data to the permanent user.
47
+
48
+ > The `devise-guests` gem implements the `guest_user`, `current_or_guest_user` and callbacks for Blacklight applications using devise. It may be a useful reference for rolling your own functionality. See [DeviseGuests::Controllers::Helpers](https://github.com/cbeer/devise-guests/blob/master/lib/devise-guests/controllers/helpers.rb)
49
+
50
+ Once these are in place, you can run the Blacklight Installation Generator:
51
+
52
+ ```bash
53
+ $ rails generate blacklight [MODEL NAME]
54
+ ```
55
+ Where model name is the name of your user model.
56
+
57
+ Execute your migrations, and you should be good to go.
58
+ ```bash
59
+ $ rake db:migrate
60
+ ```
data/doc/testing.md ADDED
@@ -0,0 +1,57 @@
1
+ ## Using Blacklight source checkout as gem for development
2
+
3
+ The ordinary install instructions install the BL gem (which is not
4
+ full source code) in wherever your system installs gems.
5
+
6
+ Sometimes, especially for development, it's useful to check out
7
+ a complete copy of the blacklight source code, and link your app
8
+ to that as a 'gem' instead.
9
+
10
+ Checkout the code:
11
+
12
+ $ git clone git@github.com:projectblacklight/blacklight.git
13
+
14
+
15
+ ## Automatically generate a test application (and run the tests)
16
+
17
+ To run the Blacklight test suite, Blacklight comes with a rake task that creates local dependencies like a Solr with indexed test data and a test Rails application, and then runs tests.
18
+
19
+ Requirements:
20
+
21
+ * Java (1.6 or above) (for Solr)
22
+ * phantomjs (used by integration tests, you may be able to install with your local package manager, for instance on OSX with `brew install phantomjs`)
23
+
24
+ Then from the root directory of your blacklight git checkout:
25
+
26
+ ```
27
+ rake ci
28
+ ```
29
+ This ensure a test Solr exists and is running, creates a test application, and loads the fixtures and then runs specs and cucumber tests.
30
+
31
+ ### Step by step, with more control
32
+
33
+ `rake ci` will, every time you run it, re-index test data in solr, and re-build the test application. Re-building the test application in particular is kind of time-consuming. You may prefer to set up the environment and run tests as separate steps, to make development easier.
34
+
35
+ To create the dummy test app:
36
+
37
+ $ rake engine_cart:generate
38
+
39
+ (If you have an existing dummy app that is outdated, `rake engine_cart:clean` first, then `rake engine_cart:generate).
40
+
41
+ Then start up the test jetty with:
42
+
43
+ $ rake jetty:start
44
+
45
+ If you haven't yet indexed the test data in the test jetty. (??? Not sure how to do this. Run `rake ci` once to make sure test data has been indexed). Run `rake jetty:stop` when you're done with it.
46
+
47
+ Then run all the specs with:
48
+
49
+ $ rake spec
50
+
51
+ Or just run one spec
52
+
53
+ $ rake spec SPEC=just/one_spec.rb
54
+
55
+ And stop your test solr when you're done with it:
56
+
57
+ $ rake jetty:stop
data/lib/blacklight.rb CHANGED
@@ -30,6 +30,7 @@ module Blacklight
30
30
  autoload :Facet, 'blacklight/facet'
31
31
 
32
32
  extend SearchFields
33
+ extend Deprecation
33
34
 
34
35
  require 'blacklight/version'
35
36
  require 'blacklight/engine' if defined?(Rails)
@@ -40,6 +41,7 @@ module Blacklight
40
41
 
41
42
  # Adding a little jruby support
42
43
  def self.jruby?
44
+ Deprecation.warn(Blacklight, "Blacklight.jruby? is deprecated")
43
45
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
44
46
  end
45
47
 
@@ -52,6 +54,7 @@ module Blacklight
52
54
  end
53
55
 
54
56
  def self.solr
57
+ Deprecation.warn Blacklight, "Blacklight.solr is deprecated and will be removed in Blacklight 5.0"
55
58
  @solr ||= RSolr.connect(Blacklight.solr_config)
56
59
  end
57
60
 
@@ -116,10 +119,12 @@ module Blacklight
116
119
  # BE AWARE - When you do this, you are monkey patching Blacklight
117
120
  # we should eventually find a better way - such as the acts_as pattern
118
121
  def self.models_dir
122
+ Deprecation.warn(Blacklight, "Blacklight.models_dir is deprecated")
119
123
  "#{root}/app/models"
120
124
  end
121
125
 
122
126
  def self.controllers_dir
127
+ Deprecation.warn(Blacklight, "Blacklight.controllers_dir is deprecated")
123
128
  "#{root}/app/controllers"
124
129
  end
125
130
 
@@ -133,6 +138,7 @@ module Blacklight
133
138
  # full_path_to_solr_marc_jar = Blacklight.locate_path 'solr_marc', 'SolrMarc.jar'
134
139
 
135
140
  def self.locate_path(*subpath_fragments)
141
+ Deprecation.warn(Blacklight, "Blacklight.locate_path is deprecated")
136
142
  subpath = subpath_fragments.join('/')
137
143
  base_match = [Rails.root, self.root].find do |base|
138
144
  File.exists? File.join(base, subpath)
@@ -5,6 +5,8 @@ module Blacklight::Base
5
5
  include Blacklight::Configurable
6
6
  include Blacklight::SolrHelper
7
7
 
8
+ require 'blacklight/catalog/search_context'
9
+ include Blacklight::Catalog::SearchContext
8
10
 
9
11
  included do
10
12
  # When RSolr::RequestError is raised, the rsolr_request_error method is executed.
@@ -6,9 +6,6 @@ module Blacklight::Catalog
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  include Blacklight::Base
9
-
10
- require 'blacklight/catalog/search_context'
11
- include Blacklight::Catalog::SearchContext
12
9
 
13
10
  SearchHistoryWindow = 100 # how many searches to save in session history
14
11
 
@@ -267,6 +264,10 @@ module Blacklight::Catalog
267
264
  render "index", :status => 404
268
265
  end
269
266
 
267
+ def start_new_search_session?
268
+ action_name == "index"
269
+ end
270
+
270
271
  def blacklight_solr
271
272
  @solr ||= RSolr.connect(blacklight_solr_config)
272
273
  end
@@ -26,7 +26,7 @@ module Blacklight::Catalog::SearchContext
26
26
  # The current search session
27
27
  def current_search_session
28
28
 
29
- @current_search_session ||= if action_name == "index"
29
+ @current_search_session ||= if start_new_search_session?
30
30
  find_or_initialize_search_session_from_params params
31
31
  elsif params[:search_context] and !params[:search_context].blank?
32
32
  find_or_initialize_search_session_from_params JSON.load(params[:search_context])
@@ -52,6 +52,13 @@ module Blacklight::Catalog::SearchContext
52
52
  @current_search_session
53
53
  end
54
54
 
55
+ ##
56
+ # If the current action should start a new search session, this should be
57
+ # set to true
58
+ def start_new_search_session?
59
+ false
60
+ end
61
+
55
62
  def find_or_initialize_search_session_from_params params
56
63
  params_copy = params.reject { |k,v| blacklisted_search_session_params.include?(k.to_sym) or v.blank? }
57
64
 
@@ -41,8 +41,7 @@ module Blacklight::Configurable
41
41
  end
42
42
 
43
43
  ##
44
- # The default configuration object, by default it reads from Blacklight.config for backwards
45
- # compatibility with Blacklight <= 3.1
44
+ # The default configuration object
46
45
  def default_configuration
47
46
  Blacklight::Configurable.default_configuration.inheritable_copy
48
47
  end
@@ -172,7 +172,8 @@ module Blacklight::Solr::Document
172
172
  end
173
173
 
174
174
  def connection
175
- @connection ||= Blacklight.solr
175
+ Deprecation.warn(self, "Document.connection is deprecated and will be removed in Blacklight 5.0")
176
+ @connection ||= Blacklight.solr
176
177
  end
177
178
 
178
179
  # Returns array of hashes of registered extensions. Each hash
@@ -642,4 +642,12 @@ module Blacklight::SolrHelper
642
642
  blacklight_config.index.group
643
643
  end
644
644
 
645
+ def blacklight_solr
646
+ @solr ||= RSolr.connect(blacklight_solr_config)
647
+ end
648
+
649
+ def blacklight_solr_config
650
+ Blacklight.solr_config
651
+ end
652
+
645
653
  end
@@ -1,6 +1,9 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Blacklight::User
3
3
 
4
+ extend Deprecation
5
+ self.deprecation_horizon = 'blacklight 5.0'
6
+
4
7
  # This gives us an is_blacklight_user method that can be included in
5
8
  # the containing applications models.
6
9
  # SEE ALSO: The /lib/blacklight/engine.rb class for how when this
@@ -19,18 +22,19 @@ module Blacklight::User
19
22
  end
20
23
 
21
24
  def has_bookmarks?
25
+ Deprecation.warn(Blacklight::User, "User#has_bookmarks? is deprecated; use User#bookmarks.any? instead")
22
26
  bookmarks.any?
23
27
  end
24
28
 
25
29
  def has_searches?
30
+ Deprecation.warn(Blacklight::User, "User#has_searchs? is deprecated; use User#searches.any? instead")
26
31
  searches.any?
27
32
  end
28
33
 
29
34
  def bookmarked_document_ids
30
35
  self.bookmarks.pluck(:document_id)
31
36
  end
32
-
33
- # see #current_bookmark_for, is easier
37
+
34
38
  def document_is_bookmarked?(document_id)
35
39
  bookmarked_document_ids.include? document_id.to_s
36
40
  end
@@ -42,6 +46,7 @@ module Blacklight::User
42
46
  end
43
47
 
44
48
  def documents_to_bookmark=(docs)
49
+ Deprecation.warn(Blacklight::User, "User#documents_to_bookmarks= is deprecated and will be removed in Blacklight 5.0")
45
50
  docs.reject { |doc| document_is_bookmarked?(doc[:document_id]) }.each do |doc|
46
51
  self.bookmarks.create(doc)
47
52
  end