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,191 @@
1
+ ## Overview
2
+
3
+ Blacklight 3.2 introduces a number of new features to Blacklight, including the Rails asset pipeline, a configuration refactor, and support for Solr 3.x by default.
4
+
5
+ ### Upgrading to Rails 3.1
6
+
7
+ If you are still using Rails 3.0, you should first update your project to work with Rails 3.1. Start by fixing any Rails 3.0 deprecation warnings (as those features may no longer exist or fail silently in Rails 3.1). There are some good resources to help you with the upgrade (e.g. [[http://railscasts.com/episodes/282-upgrading-to-rails-3-1?view=asciicast]]).
8
+
9
+ ### Assets (CODEBASE-363)
10
+ Blacklight 3.2 uses the Rails 3.1 asset pipeline for all assets, stylesheets and javascript. The CSS has been refactored and now uses SCSS to enable easy changing of some common parameters/colors. In addition, it no longer uses YUI-grids CSS framework. (Instead it uses Susy grid css framework).
11
+
12
+ What does this mean for you?
13
+
14
+ * Small (hopefully) upgrade costs.
15
+
16
+ * Use of the asset pipeline to compress and streamline all css files into one.
17
+
18
+ * Easier theming of blacklight.
19
+
20
+ After having upgraded to BL 3.2 (and Rails 3.1), the first thing you should do is upgrade to use the asset pipeline. The Blacklight gem's standard behavior for including CSS and Javascript in your app **requires the asset pipeline**. (Of course, if you don't use the CSS or Javascript distributed with Blacklight, or want to roll your own custom way to include it, you could choose to continue without using the asset pipeline)
21
+
22
+ Run the Blacklight generator to upgrade from Blacklight 3.1 to 3.2:
23
+ ```
24
+ $ rails g blacklight
25
+ ```
26
+
27
+ This should update the `application.css` and `application.js` files with references to the new Blacklight assets. You will still need to move or update your local assets and customizations.
28
+
29
+ **Note**
30
+
31
+ * Now, if you have you will need to change your layout to use the new ids, look at: [app/views/layouts/blacklight.html.erb](https://github.com/projectblacklight/blacklight/blob/master/) for reference on the new tags (#page, #bd, #hd, #footer, #main, #main_container, #sidebar). The old yui tags have no meaning in the new css.
32
+
33
+ * This also means that any local CSS that overrides Blacklight's CSS, if your uses the old yui-grids id's in your CSS selectors, you probably want to change them to use the new id's. (#doc, #doc2, etc,, as well as any .yui-*)
34
+
35
+ * You will need to remove the line `require "yui"` from your `./app/assets/stylesheets/application.css`. In previous versions, Blacklight provided the YUI css library as part of the gem. In Blacklight 3.2, because the Blacklight is no longer using YUI, this has been removed. If you wish to continue using YUI, you will need to provide your own copy in your application. You can download the [Blacklight 3.1 YUI file](https://github.com/projectblacklight/blacklight/blob/release-3.1/app/assets/stylesheets/yui.css) or from the (Yahoo YUI site)[http://developer.yahoo.com/yui/2/].
36
+
37
+ ### Per-controller configuration (CODEBASE-365)
38
+
39
+ In previous versions of Blacklight, configuring Blacklight was done using a global configuration hash called `Blacklight.config` (created in `config/initializers/blacklight_config.rb`). Blacklight 3.2 deprecates this global configuration in favor of a per-controller, DSL-style configuration. Support for the old-style configuration is still available (meaning, if you do absolutely nothing, Blacklight will convert Blacklight.config into the new-style configuration, and your application will probably continue to work), but we strongly recommend applications switch to the new-style configuration.
40
+
41
+ The two major changes are moving from the global configuration (`Blacklight.config`) to a Controller-specific method (`blacklight_config`) and replacing the hash-based access with an OpenStruct-based domain-specific language. The new style maintains many of the old semantics, but should be better structured and more clear.
42
+
43
+ On your CatalogController, you can configure the Blacklight Catalog:
44
+
45
+ ```ruby
46
+ class CatalogController < ApplicationController
47
+
48
+ include Blacklight::Catalog
49
+
50
+ configure_blacklight do |config|
51
+ config.default_solr_params = {
52
+ :qt => 'search',
53
+ :rows => 10
54
+ }
55
+
56
+ # solr field configuration for search results/index views
57
+ config.index.show_link = 'title_display'
58
+ config.index.record_display_type = 'format'
59
+
60
+ # solr field configuration for document/show views
61
+ config.show.html_title = 'title_display'
62
+ config.show.heading = 'title_display'
63
+ config.show.display_type = 'format'
64
+
65
+ # ....
66
+ end
67
+
68
+ # ...
69
+ end
70
+
71
+ ```
72
+
73
+
74
+ #### Creating a new configuration
75
+
76
+ An example of the new style configuration is available at
77
+ [[https://github.com/projectblacklight/blacklight/blob/master/lib/generators/blacklight/templates/catalog_controller.rb]] and shows most of the ways one can use the new configuration.
78
+
79
+ There are helper methods for adding field configuration (facets, index, and show fields) as well as search and sort fields. All of these methods accept a variety of inputs and should be used in local applications in whatever form is most clear.
80
+
81
+ Field + configuration hash
82
+
83
+ ```ruby
84
+ config.add_facet_field 'format', :label => 'Format'
85
+ ```
86
+
87
+ Configuration hash
88
+
89
+ ```ruby
90
+ config.add_sort_field :sort => 'score desc, pub_date_sort desc, title_sort asc', :label => 'relevance'
91
+ ```
92
+
93
+ Field + block
94
+
95
+ ```ruby
96
+ config.add_search_field('title') do |field|
97
+ # solr_parameters hash are sent to Solr as ordinary url query params.
98
+ field.solr_parameters = { :'spellcheck.dictionary' => 'title' }
99
+
100
+ # :solr_local_parameters will be sent using Solr LocalParams
101
+ # syntax, as eg {! qf=$title_qf }. This is neccesary to use
102
+ # Solr parameter de-referencing like $title_qf.
103
+ # See: http://wiki.apache.org/solr/LocalParams
104
+ field.solr_local_parameters = {
105
+ :qf => '$title_qf',
106
+ :pf => '$title_pf'
107
+ }
108
+ end
109
+ ```
110
+
111
+ #### Using the new configuration
112
+
113
+ Within a controller, the configuration can be accessed using the method `blacklight_config`, which is also exposed to helpers or views as a helper method.
114
+
115
+ Outside of a controller context (which should be rare, and likely undesirable), the configuration is exposed at the class level as well, e.g.:
116
+
117
+ ```ruby
118
+ CatalogController.blacklight_config
119
+ ```
120
+
121
+ Some configuration-driven helper methods have also been moved to the configuration object:
122
+
123
+ ```ruby
124
+ blacklight_config.default_search_field
125
+ blacklight_config.default_sort_field
126
+ blacklight_config.max_per_page
127
+ ```
128
+
129
+ The Blacklight field configuration are stored as ordered hashes, with a key corresponding to the field name:
130
+
131
+ ```ruby
132
+ CatalogController.blacklight_config.facet_fields
133
+
134
+ # {
135
+ # "format" => #<Blacklight::Configuration::FacetField:0x1025a0c78
136
+ # :label => "Format",
137
+ # :field => "format"
138
+ # >,
139
+ # "pub_date" => #<Blacklight::Configuration::FacetField:0x1025a7aa0
140
+ # :label => "Publication Year",
141
+ # :field => "pub_date"
142
+ # >,
143
+ # ...
144
+ ```
145
+
146
+ Values can be accessed using OpenStruct methods or as a Hash:
147
+
148
+ ```ruby
149
+ CatalogController.blacklight_config.facet_fields["format"].label # == "Format"
150
+ CatalogController.blacklight_config.facet_fields["format"][:label] # == "Format"
151
+ ```
152
+
153
+ ### Using the new-style config in local overrides
154
+ If you have overriden views or helpers in your local application and access `Blacklight.config` directly, you will need to update your overrides. In general, you should be able to search for references to `Blacklight.config` in your local application, replace it with the controller-level method `blacklight_config` and possibly fix up some naming differences.
155
+
156
+ ### Facet refactor
157
+ Facet helpers and views have been refactored to take advantage of the new configuration style and new features in Rails.
158
+
159
+ The old `_facet_limit` view has been split in two,
160
+
161
+ * `_facet_limit` : the partial to display the facet values
162
+ * `_facet_layout` : a 'partial layout' that displays the facet structure and headers
163
+
164
+ In the facet configuration, you can specify the partial to use to render a facet:
165
+ ```ruby
166
+ config.add_facet_field 'format', :label => 'Format', :partial => 'my_custom_format_facet_display_partial'
167
+ ```
168
+
169
+ ### Solr 3.5 (CODEBASE-345)
170
+ Blacklight-jetty has been updated to Solr 3.5 (previously it was still Solr 1.4). Blacklight is still compatible with both Solr 1.x and 3.x, but the demo application is based on a Solr 3.x configuration.
171
+
172
+ #### SolrMarc 2.3.1
173
+ Older versions of SolrMarc were incompatible with Solr 3.x. Blacklight is now distributed with SolrMarc 2.3.1. But previous versions of Blacklight erroneously copied a SolrMarc.jar into your local app's lib/SolrMarc.jar when installing Blacklight.
174
+
175
+ If you have a previously installed Blacklight, unless you have intentionally installed a local compile of SolrMarc.jar, you should remove the file at local ./lib/SolrMarc.jar, so your app will use the latest version of SolrMarc shipped with Blacklight.
176
+
177
+
178
+
179
+ ### Other changes
180
+
181
+ * [CODEBASE-325](http://jira.projectblacklight.org/jira/browse/CODEBASE-325) - Allow Blacklight to function correctly when no user authentication system is provided
182
+ * [CODEBASE-362](http://jira.projectblacklight.org/jira/browse/CODEBASE-362) - Blacklight facets do not work with integer-type fields
183
+ * [CODEBASE-367](http://jira.projectblacklight.org/jira/browse/CODEBASE-367) - Pull in Hydra's jettywrapper to manage jetty
184
+ * [CODEBASE-369](http://jira.projectblacklight.org/jira/browse/CODEBASE-369) - Advanced Search has an incompatible character encoding issue under ruby 1.9
185
+ * [CODEBASE-371](http://jira.projectblacklight.org/jira/browse/CODEBASE-371) - SolrHelper#get_solr_response_for_field_values does not adequately escape value lists
186
+ * [CODEBASE-375](http://jira.projectblacklight.org/jira/browse/CODEBASE-375) - fix rake solr:marc:index task and generator to use distro SolrMarc.jar
187
+ * [CODEBASE-376](http://jira.projectblacklight.org/jira/browse/CODEBASE-376) - Look at the did_you_mean.feature scenarios, review for accuracy.
188
+ * [CODEBASE-377](http://jira.projectblacklight.org/jira/browse/CODEBASE-377) - Convert opensearch.xml.erb to true XML builder style
189
+ * [CODEBASE-379](http://jira.projectblacklight.org/jira/browse/CODEBASE-379) - Factor out use of RSolr's pagination feature and use Solr's start/rows parameters instead
190
+ * [CODEBASE-380](http://jira.projectblacklight.org/jira/browse/CODEBASE-380) - ActionMailer deprecations
191
+
@@ -0,0 +1,37 @@
1
+ Issues: https://github.com/projectblacklight/blacklight/issues?milestone=2&state=open
2
+
3
+ ## Upgrade notes:
4
+
5
+ Note: Please make sure to upgrade to at least Blacklight **3.3.1** to avoid problems with compiled assets in 3.3.0.
6
+
7
+ If you previously ran the blacklight 3.3.0 generator, after upgrading to 3.3.1: Edit your local `./app/assets/stylesheets/blacklight_themes/standard.css.scss` file, change the line (wrong) `@import 'blacklight/grids/susy';` to instead be (right) `@import 'blacklight/grids/susy_grid';`
8
+
9
+ If you previously ran the blacklight 3.2.x or 3.3.0 generator, look in your local `./config/application.rb`, *remove* the line `config.sass.line_comments = Rails.env.development?` if present.
10
+
11
+ ### Compass/susy upgrade
12
+
13
+ [Compass](https://github.com/chriseppstein/compass) (our CSS framework) and [Susy](http://susy.oddbird.net/) have been updated to a new major release. This will necessitate some changes in installations already running BL 3.2.
14
+
15
+ New installations should just use the generator as normal.
16
+
17
+ Existing installations should do the following:
18
+
19
+ **1.** In your gemfile, in `group :assets`, remove any reference to the compass gem, and add:
20
+
21
+ gem 'sass-rails', '~> 3.2.0'
22
+ gem 'compass-rails', '~> 1.0.0'
23
+ gem 'compass-susy-plugin', '~> 0.9.0'
24
+
25
+ **2.** You can remove 'config/initializers/sass.rb'
26
+
27
+ **3.** You must add, if you have not already: 'config/compass.rb'
28
+
29
+ require 'susy'
30
+ project_type = :rails
31
+
32
+ **4.** Replace any references in your css:
33
+
34
+ `@import "blacklight/grids/susy_framework"` with `@import "susy"`
35
+
36
+ `@import "blacklight/grids/susy"` with `@import "blacklight/grids/susy_grid"`
37
+
@@ -0,0 +1,27 @@
1
+ # Blacklight 3.4 Release notes
2
+ Blacklight 3.4.0 is now available. It fixes a number of bugs and
3
+ tests, but also adds a handful of new features.
4
+
5
+ - Fixed Rails 3.1 compatibility for rspec tests
6
+ - changes to make Blacklight work better with arbitrary solr indexes.
7
+ - Use ERb to parse the solr.yml configuration (allowing environment
8
+ variables to be referenced in the config)
9
+ - fixed #351, saving Selected Items (Folder) to Bookmarks
10
+ (SavedRecords), more than 10.
11
+ - fixed #398 document fetching/config refactor, which elevates
12
+ document-request solr parameters into the controller's
13
+ blacklight_config.
14
+ - fixed #333, Blacklight should throw more helpful errors if it
15
+ unable to connect to Solr
16
+ - fixed #96, supporting configurable request handler paths
17
+
18
+ The full list of Github issues are at:
19
+ https://github.com/projectblacklight/blacklight/issues?milestone=4&state=closed
20
+
21
+ Also, the GitHub compare view of this release vs. our last release is
22
+ located at:
23
+ https://github.com/projectblacklight/blacklight/compare/v3.3.0...v3.4.0
24
+
25
+ # Upgrade notes
26
+
27
+ No known issues updating from 3.3 to 3.4.
@@ -0,0 +1,44 @@
1
+ # Blacklight 3.5 Release Notes And Upgrade Guide
2
+
3
+ ## Release Notes
4
+ # Blacklight 3.5 Release notes
5
+ Blacklight 3.5.0 is now available. It introduces i18n support for Blacklight, allowing applications to change and modify Blacklight-provided text strings without the need to override partials (in addition to providing multi-lingual support).
6
+
7
+ - Fix #395, removing hard-coded no-reply@ email addresses from the ```RecordMailer``` (see below for upgrade notes)
8
+ - Consistent use of polymorphic routing to the show views for documents. ```solr_document_url``` and ```solr_document_path``` are now part of the engine-provided routes, rather than helper-provided.
9
+ - Refactor `blacklight.js` to take advantage of the Rails asset pipeline by moving separate blocks of code into individual files.
10
+ - Fix problem with mounting Blacklight applications at a suburi rather than a document.
11
+
12
+ The full list of Github issues are at:
13
+ https://github.com/projectblacklight/blacklight/issues?milestone=7&state=closed
14
+
15
+ Also, the GitHub compare view of this release vs. our last release is
16
+ located at:
17
+ https://github.com/projectblacklight/blacklight/compare/v3.4.2...release-3.5
18
+
19
+
20
+ ## Upgrade Guide
21
+
22
+ No known issues updating from 3.4 to 3.5.
23
+
24
+ ## i18n
25
+
26
+ Blacklight 3.5 introduces i18n (internationalization framework) support. See the Ruby on Rails [[i18n Rails guide|http://guides.rubyonrails.org/i18n.html]] for information on how to use i18n within your application. The list of blacklight-provided (English) translations are available in the engine's [[```config/locales/blacklight.en.yml```|https://github.com/projectblacklight/blacklight/blob/master/config/locales/blacklight.en.yml]]
27
+
28
+ ## RecordMailer default email
29
+
30
+ In config/environments/development.rb:
31
+ ```ruby
32
+ ActionMailer::Base.default :from => 'default@development-server.com'
33
+ ```
34
+
35
+ In config/environments/production.rb:
36
+ ```ruby
37
+ ActionMailer::Base.default :from => 'default@production-server.com'
38
+ ```
39
+
40
+ You can also target the RecordMailer directly:
41
+
42
+ ```ruby
43
+ RecordMailer.default :from => 'no-reply@projectblacklight.org'
44
+ ```
@@ -0,0 +1,25 @@
1
+ # Blacklight 3.6 Release Notes And Upgrade Guide
2
+
3
+ ## Release Notes
4
+ # Blacklight 3.6 Release notes
5
+ Blacklight 3.6.0 is now available. This is mostly a collection of small patches.
6
+
7
+
8
+ - Fix blacklight to be compatible with newly released version of Kaminari
9
+ - Split document_header into its own partial
10
+ - Utilizing rails own capability to determine partial paths for collections
11
+ - #423 using response.total instead of the underlying hash
12
+ - many more
13
+
14
+
15
+ The full list of Github issues are at:
16
+ https://github.com/projectblacklight/blacklight/issues?milestone=8&state=closed
17
+
18
+ Also, the GitHub compare view of this release vs. our last release is
19
+ located at:
20
+ https://github.com/projectblacklight/blacklight/compare/release-3.5...release-3.6
21
+
22
+
23
+ ## Upgrade Guide
24
+
25
+ No known issues updating from 3.5 to 3.6. If you are overriding `app/views/catalog/_document_list.html.erb` in your local application, you may want to look at how it is now written in the gem. See https://github.com/projectblacklight/blacklight/commit/b712d79fa88e80155972ce3e9bc7629d7e63c1eb
@@ -0,0 +1,80 @@
1
+ ## Bookmarks and Folders merged
2
+
3
+ When upgrading to Blacklight 3.7, if you want to keep the 'folders' feature (of session-based, anonymous item selection), you should add this gem to your Gemfile:
4
+
5
+ ```
6
+ gem 'devise-guests'
7
+ ```
8
+
9
+ The bookmarks (database persisted, user-based) and folders (session stored, session-based) features have been merged into a single bookmarks feature (database persisted, user-based). These bookmarks are database-persisted and assume an ActiveRecord-based user model.
10
+
11
+ The [devise-guests](http://rubygems.org/gems/devise-guests), generated into new applications by default, provides (session-based) guest user functionality to Devise (and, to Blacklight for applications that are using Devise). When a guest user logs in, the bookmarks associated with the guest user are transfered to the logged in user.
12
+
13
+ If you are using `devise-guests`, you will want to regularly run a rake task it provides to purge old 'guest' data from your database: `RAILS_ENV=production rake devise_guests:delete_old_guest_users[7]`
14
+
15
+ ### Implementation details for those not using devise.
16
+
17
+ We've added a new method ```#current_or_guest_user```. By default, this is just the value of ```#current_user``` (provided by Devise, or whatever authentication layer you are using). Applications that want to provide session-based bookmarks should implement ```#current_or_guest_user``` and ``#guest_user``` in the application and return the current user (when logged in) or a session-based guest user record.
18
+
19
+ When a user logs in, your application should call ```#transfer_guest_user_actions_to_current_user``` to move the bookmarks and saved searches to the logged in user.
20
+
21
+ ## Query Facets
22
+
23
+ Blacklight 3.7 adds support for Solr query facets. There's an example of this in the [Blacklight demo](http://demo.projectblacklight.org) with the Publish Date facet.
24
+
25
+ The Publish Date facet is using this configuration:
26
+
27
+ ```ruby
28
+ config.add_facet_field 'example_query_facet_field', :label => 'Publish Date', :query => {
29
+ :years_5 => { :label => 'within 5 Years', :fq => "pub_date:[#{Time.now.year - 5 } TO *]" },
30
+ :years_10 => { :label => 'within 10 Years', :fq => "pub_date:[#{Time.now.year - 10 } TO *]" },
31
+ :years_25 => { :label => 'within 25 Years', :fq => "pub_date:[#{Time.now.year - 25 } TO *]" }
32
+ }
33
+ ```
34
+
35
+ The first argument (which maps to the facet field for plain facets) is used in the Blacklight URL when the facet is selected.
36
+
37
+ The ```:query``` hash maps the URL key into a facet label (to show to the user) and a fq to send to `facet.query` and, after selection, the Solr `fq` parameter.
38
+
39
+
40
+ ### A small change to the Blacklight configuration to get Blacklight to generate facet.query for you.
41
+
42
+ In older versions of Blacklight, the facet field keys mapped directly to the Solr ```facet.field``` parameter. By default, Blacklight generated the following into your CatalogController configuration:
43
+
44
+ ```
45
+ config.default_solr_params[:'facet.field'] = config.facet_fields.keys
46
+ ```
47
+
48
+ In the new model, this logic is deferred as part of the Blacklight solr search params logic. The above line should be replaced with:
49
+
50
+ ```
51
+ # Have BL send all facet field names to Solr, which has been the default
52
+ # previously. Simply remove these lines if you'd rather use Solr request
53
+ # handler defaults, or have no facets.
54
+ config.add_facet_fields_to_solr_request!
55
+ ```
56
+
57
+ This will add the plain facets to the ```facet.field``` and the query facets to the ```facet.query```.
58
+
59
+ ### Adding facet queries to the solr request handler yourself
60
+
61
+ If you want to add the facet queries directly to your solr request handler, you should ensure the configuration for the Blacklight facet queries ```fq``` field matches a Solr ```facet.query``` field.
62
+
63
+ So, given this Solr response:
64
+
65
+ ```xml
66
+ <lst name="facet_counts">
67
+ <lst name="facet_queries">
68
+ <int name="lc_alpha_facet:A">0</int>
69
+ </lst>
70
+ ...
71
+ </lst>
72
+ ```
73
+
74
+ The Blacklight-side config would look something like:
75
+
76
+ ```ruby
77
+ config.add_facet_field 'contrived_blacklight_configuration_example', :query => {
78
+ :a => { :label => 'starting with A', :fq => "lc_alpha_facet:A" },
79
+ }
80
+ ```
@@ -0,0 +1,11 @@
1
+ This is primarily a release to bring the Blacklight 3.x line up to feature-parity with the upcoming bootstrap release, and contains backports of features and bugfixes from the bootstrap work.
2
+
3
+ Highlights include:
4
+
5
+ - pulling bookmark data from solr (rather than a database-backed title cache)
6
+ - clean-up of some pagination code
7
+ - pruning dead code around folders (removed in the 3.7 release)
8
+
9
+ And more:
10
+
11
+ [[https://github.com/projectblacklight/blacklight/compare/v3.7.2...v3.8.0]]
@@ -0,0 +1,135 @@
1
+ # Blacklight 3.6 Release Notes And Upgrade Guide
2
+
3
+ ## Release Notes
4
+
5
+ - Remove dependency on RSolr::Ext. In this first stage, some RSolr::Ext code is now maintained in Blacklight, e.g.:
6
+ - RSolr::Ext::Response::Facets => Blacklight::SolrResponse::Facets
7
+ - RSolr::Ext::Doc => Blacklight::Solr::Document
8
+ - etc
9
+
10
+ - Bootstrap-based view templates and default stylesheet; removed compass/susy
11
+ - Drop support for Ruby 1.8; add support for Ruby 2.0
12
+
13
+ And the usual bug-fixes (some of which are backported into 3.8.x):
14
+
15
+ - fix #64, show MoreLikeThis titles on record show page if available
16
+ - fix #422; show prev/next options even when not linked
17
+ - fix #450; support Solr 4.x and use it by default.
18
+ - fix #484, use top-level constant BLACKLIGHT_VERBOSE_LOGGING (uninitialized by default) to log the full solr response with each solr query
19
+ - fix #495 Remove blacklight_config.rb template
20
+ - fix #496, removing hard-coded 'id' field reference in BookmarksController
21
+ - remove unicode as an explicit Blacklight dependency, but use it if it is available
22
+ - fix #499 When document_heading is an array, don't draw the array bracket…
23
+ - fix #502, Endnote action tries to render partials and gives error
24
+ - update per_page widget to use i18n strings; don't require echoParams
25
+ - use 1.9-style string interpolation for template path lookups
26
+ - consolidate solr pagination information lookup.
27
+
28
+ ## Plugins Compatibility
29
+
30
+ As of 11/26:
31
+
32
+ ### Tested/Compatible
33
+
34
+ * blacklight_advanced_search
35
+ * blacklight_cql
36
+ * blacklight_range_limit
37
+ * blacklight_browse_nearby
38
+
39
+
40
+
41
+
42
+ ## Upgrade Guide
43
+
44
+ When approaching the Blacklight 3.x => 4.0 upgrade, we'd strongly recommend adopting the bootstrap templates, update local overrides to use bootstrap, and do your own bootstrap stylesheet customization.
45
+
46
+ That said, it should be possible to do a fairly straightforward in-place upgrade if you so choose. Most of the Blacklight 4.x work was limited to views, javascript and stylesheets. If you want to keep the old Blacklight theme, you should be able to grab them from Blacklight and drop them into your application directly. We wouldn't recommend it though.
47
+
48
+ To upgrade your application to Blacklight 4.x:
49
+
50
+ - Update your application's gem dependency to use Blacklight 4.0:
51
+
52
+ ```ruby
53
+ gem 'blacklight', "~>4.0"
54
+ ```
55
+
56
+ - Add the unicode gem to your application's Gemfile (if you want to use it to normalize character encoding for refworks integration):
57
+
58
+ ```ruby
59
+ gem 'unicode'
60
+ ```
61
+
62
+ - Remove compass/susy references; replace with bootstrap-sass:
63
+
64
+ ```ruby
65
+ # REMOVE:
66
+ gem 'compass-rails', '~> 1.0.0', :group => :assets
67
+ gem 'compass-susy-plugin', '~> 0.9.0', :group => :assets
68
+
69
+ # ADD:
70
+ gem 'bootstrap-sass'
71
+ ```
72
+
73
+ - (Remember to ```bundle install```)
74
+
75
+ - Add the following into your stylesheets directory (possibly as ```app/assets/stylesheets/blacklight.css.scss```):
76
+
77
+ ```scss
78
+ @import 'bootstrap';
79
+ @import 'bootstrap-responsive';
80
+
81
+ @import 'blacklight/blacklight';
82
+ ```
83
+
84
+ You no longer need the ```blacklight_themes directory``` and can remove ```require 'blacklight_themes/standard'``` (and the jquery UI css) from your application.css
85
+
86
+ In ```app/assets/javascripts/application.js```, you can also remove
87
+
88
+ ```javascript
89
+ //= require jquery-ui
90
+ ```
91
+
92
+ - If you have local overrides of stylesheets, javascript or view templates, you should update them appropriately. Be warned that some of the bootstrapped Blacklight HTML element classes and IDs may have shifted slightly, and the previous susy-grid and YUI class names have been removed.
93
+
94
+ In your `ApplicationController`, you need to tell your application which layout to use:
95
+
96
+ ```ruby
97
+ # completely Blacklight 3.x-backwards compatible
98
+ layout :choose_layout
99
+
100
+ # if you don't need dynamic layout switching, just do the Rails-standard:
101
+ layout 'blacklight'
102
+ ```
103
+
104
+ - If you are using devise-guests, you probably want to update to devise-guests ~> 0.3. After doing so,
105
+
106
+ ```bash
107
+ $ rails g devise_guests
108
+ $ rake db:migrate
109
+ ```
110
+
111
+ If you've already chosen a different layout for your application, you don't need to do anything at all.
112
+
113
+ Here are some minor differences elsewhere:
114
+
115
+ - Some i18n strings have been updated to read better in the new UI
116
+ - the helper `#render_document_heading` returns an h4 instead of an h1.
117
+ - the helper `#document_show_fields` returns a hash instead of a list of keys
118
+
119
+ ## Document partial paths
120
+
121
+ The default naming convention for format-specific partials was changed. In Blacklight 3.1, the default format-specific path was changed to `catalog/_index_[format_name].html.erb`, but support for the Blacklight 2.x style was left in place. In Blacklight 4, the Blacklight 2.x style was removed from the list of defaults.
122
+
123
+ So, if you have partials in a directory like:
124
+
125
+ ```ruby
126
+ catalog/_index_partials/[format_name].html.erb
127
+ ```
128
+
129
+ they should be moved to
130
+
131
+ ```ruby
132
+ catalog/_index_[format_name].html.erb
133
+ ```
134
+
135
+ Or, alternatively, you may override the helpers [document_index_path_templates](https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight/blacklight_helper_behavior.rb#L382) and [document_partial_path_templates](https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight/blacklight_helper_behavior.rb#L423) with a custom naming convention.