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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/bookmarks_controller.rb +4 -0
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +76 -21
- data/app/helpers/blacklight/hash_as_hidden_fields_helper_behavior.rb +8 -1
- data/app/views/catalog/_citation.html.erb +1 -1
- data/app/views/catalog/_did_you_mean.html.erb +1 -1
- data/app/views/catalog/_search_form.html.erb +1 -1
- data/blacklight.gemspec +1 -1
- data/config/locales/blacklight.en.yml +3 -0
- data/config/locales/blacklight.fr.yml +3 -0
- data/doc/Atom-Responses.md +90 -0
- data/doc/Blacklight-3.0-Release-Notes-And-Upgrade-Guide.md +107 -0
- data/doc/Blacklight-3.2-Release-Notes-and-Upgrade-Guide.md +191 -0
- data/doc/Blacklight-3.3-release-notes-and-upgrade-guide.md +37 -0
- data/doc/Blacklight-3.4-release-notes-and-upgrade-guide.md +27 -0
- data/doc/Blacklight-3.5-release-notes-and-upgrade-guide.md +44 -0
- data/doc/Blacklight-3.6-release-notes-and-upgrade-guide.md +25 -0
- data/doc/Blacklight-3.7-release-notes-and-upgrade-guide.md +80 -0
- data/doc/Blacklight-3.8-release-notes-and-upgrade-guide.md +11 -0
- data/doc/Blacklight-4.0-release-notes-and-upgrade-guide.md +135 -0
- data/doc/Blacklight-4.1-release-notes-and-upgrade-guide.md +17 -0
- data/doc/Blacklight-4.2-release-notes-and-upgrade-guide.md +25 -0
- data/doc/Blacklight-4.3-release-notes-and-upgrade-guide.md +21 -0
- data/doc/Blacklight-4.4-release-notes-and-upgrade-guide.md +41 -0
- data/doc/Blacklight-Add-ons.md +28 -0
- data/doc/Blacklight-configuration.md +411 -0
- data/doc/Blacklight-on-Heroku.md +135 -0
- data/doc/Code4Lib-2014.md +48 -0
- data/doc/Community-principles.md +44 -0
- data/doc/Configuring-and-Customizing-Blacklight.md +271 -0
- data/doc/Configuring-rails-routes.md +13 -0
- data/doc/Contributing-to-Blacklight.md +25 -0
- data/doc/Examples.md +94 -0
- data/doc/Extending-or-Modifying-Blacklight-Search-Behavior.md +141 -0
- data/doc/FAQs.md +1 -0
- data/doc/Home.md +80 -0
- data/doc/How-to-release-a-version.md +29 -0
- data/doc/Indexing-your-data-into-solr.md +32 -0
- data/doc/Integration-with-Rails-Footnotes.md +20 -0
- data/doc/Internationalization.md +32 -0
- data/doc/JSON-API.md +17 -0
- data/doc/Pagination.md +51 -0
- data/doc/Providing-your-own-view-templates.md +109 -0
- data/doc/Quickstart.md +115 -0
- data/doc/README_SOLR.md +245 -0
- data/doc/Release-Notes-And-Upgrade-Guides.md +20 -0
- data/doc/Roadmap.md +43 -0
- data/doc/Sunspot-for-indexing.md +46 -0
- data/doc/Theming.md +64 -0
- data/doc/User-Authentication.md +60 -0
- data/doc/testing.md +57 -0
- data/lib/blacklight.rb +6 -0
- data/lib/blacklight/base.rb +2 -0
- data/lib/blacklight/catalog.rb +4 -3
- data/lib/blacklight/catalog/search_context.rb +8 -1
- data/lib/blacklight/configurable.rb +1 -2
- data/lib/blacklight/solr/document.rb +2 -1
- data/lib/blacklight/solr_helper.rb +8 -0
- data/lib/blacklight/user.rb +7 -2
- data/lib/blacklight/utils.rb +9 -1
- data/lib/generators/blacklight/templates/catalog_controller.rb +1 -4
- data/spec/helpers/blacklight_helper_spec.rb +84 -9
- data/spec/helpers/hash_as_hidden_fields_spec.rb +1 -1
- data/spec/lib/blacklight_spec.rb +6 -0
- data/spec/lib/blacklight_user_spec.rb +4 -0
- data/spec/lib/solr_helper_spec.rb +8 -6
- data/spec/lib/utils_spec.rb +35 -5
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +1 -1
- metadata +49 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4813599bbaa8851d1b75d07b6633d4abf29ea757
|
4
|
+
data.tar.gz: 03def0b743980084a3ccab15df138b171723fe75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 492ed7e40e8b99aa34bff4a09caec3569b7d2daaf050c6f4f87159a2489cf7f045830feb4fc2518bd598e00c14dda14be1c838b36c0b7ed2fb10386a21bf894e
|
7
|
+
data.tar.gz: d1104e397c0a860d8cea7301afaf9658dc98825ba3518576058867179253344fd54455070fd234b7c38824bf03c6911bb05ab7768737a5d2e817e75bfabb860d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.7.0.pre1
|
@@ -97,4 +97,8 @@ class BookmarksController < CatalogController
|
|
97
97
|
def verify_user
|
98
98
|
flash[:notice] = I18n.t('blacklight.bookmarks.need_login') and raise Blacklight::Exceptions::AccessDenied unless current_or_guest_user
|
99
99
|
end
|
100
|
+
|
101
|
+
def start_new_search_session?
|
102
|
+
action_name == "index"
|
103
|
+
end
|
100
104
|
end
|
@@ -140,8 +140,8 @@ module Blacklight::BlacklightHelperBehavior
|
|
140
140
|
Hash[*index_fields(document).map { |key, field| [key, field.label] }.flatten]
|
141
141
|
end
|
142
142
|
|
143
|
-
def
|
144
|
-
|
143
|
+
def should_show_spellcheck_suggestions? response
|
144
|
+
response.total <= spell_check_max and response.spelling.words.size > 0
|
145
145
|
end
|
146
146
|
|
147
147
|
##
|
@@ -162,7 +162,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
162
162
|
document = args.first
|
163
163
|
|
164
164
|
field = options[:field]
|
165
|
-
html_escape index_fields(document)[field].label
|
165
|
+
html_escape t(:'blacklight.search.index.label', label: index_fields(document)[field].label)
|
166
166
|
end
|
167
167
|
|
168
168
|
##
|
@@ -236,6 +236,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
236
236
|
|
237
237
|
# Used in citation view for displaying the title
|
238
238
|
def citation_title(document)
|
239
|
+
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "#citation_title is deprecated; use #document_heading instead")
|
239
240
|
document[blacklight_config.show.html_title]
|
240
241
|
end
|
241
242
|
|
@@ -287,7 +288,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
287
288
|
|
288
289
|
field = options[:field]
|
289
290
|
|
290
|
-
html_escape document_show_fields(document)[field].label
|
291
|
+
html_escape t(:'blacklight.search.show.label', label: document_show_fields(document)[field].label)
|
291
292
|
end
|
292
293
|
|
293
294
|
##
|
@@ -451,7 +452,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
451
452
|
|
452
453
|
# Search History and Saved Searches display
|
453
454
|
def link_to_previous_search(params)
|
454
|
-
link_to(
|
455
|
+
link_to(render_search_to_s(params), catalog_index_path(params))
|
455
456
|
end
|
456
457
|
|
457
458
|
#
|
@@ -516,15 +517,60 @@ module Blacklight::BlacklightHelperBehavior
|
|
516
517
|
link_to opts[:label], link_url
|
517
518
|
end
|
518
519
|
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
520
|
+
# @overload params_for_search(source_params, params_to_merge)
|
521
|
+
# Merge the source params with the params_to_merge hash
|
522
|
+
# @param [Hash] Hash
|
523
|
+
# @param [Hash] Hash to merge into above
|
524
|
+
# @overload params_for_search(params_to_merge)
|
525
|
+
# Merge the current search parameters with the
|
526
|
+
# parameters provided.
|
527
|
+
# @param [Hash] Hash to merge into the parameters
|
528
|
+
# @overload params_for_search
|
529
|
+
# Returns the current search parameters after being sanitized by #sanitize_search_params
|
530
|
+
# @overload legacy_method
|
531
|
+
# @params [Hash] Hash of params to merge, may include:
|
532
|
+
# - :omit_keys
|
533
|
+
# - :params
|
534
|
+
# @yield [params] The merged parameters hash before being sanitized
|
535
|
+
def params_for_search(*args, &block)
|
536
|
+
|
537
|
+
omit_keys = []
|
538
|
+
|
539
|
+
source_params, params_to_merge = case args.length
|
540
|
+
when 0
|
541
|
+
[params, {}]
|
542
|
+
when 1
|
543
|
+
options = args.first
|
544
|
+
|
545
|
+
if options.has_key? :omit_keys
|
546
|
+
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "#params_for_search with :omit_keys is deprecated; use params_for_search to generate the hash, and either provide a block or clean up the params after the fact")
|
547
|
+
omit_keys = options.delete(:omit_keys)
|
548
|
+
end
|
549
|
+
|
550
|
+
if options.has_key? :params
|
551
|
+
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "#params_for_search with :params option is deprecated; use the 2-arg form of #params_for_search(params, params_to_merge)")
|
552
|
+
end
|
553
|
+
|
554
|
+
[options.delete(:params) || params, options]
|
555
|
+
when 2
|
556
|
+
options = args.last
|
557
|
+
|
558
|
+
if options.has_key? :omit_keys
|
559
|
+
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "#params_for_search with :omit_keys is deprecated; use params_for_search to generate the hash, and either provide a block or clean up the params after the fact")
|
560
|
+
omit_keys = options.delete(:omit_keys)
|
561
|
+
end
|
562
|
+
|
563
|
+
[args.first, options]
|
564
|
+
else
|
565
|
+
raise ArgumentError.new "wrong number of arguments (#{args.length} for 0..2)"
|
566
|
+
end
|
524
567
|
|
525
568
|
# params hash we'll return
|
526
|
-
my_params = source_params.dup.merge(
|
569
|
+
my_params = source_params.dup.merge(params_to_merge.dup)
|
527
570
|
|
571
|
+
if block_given?
|
572
|
+
yield my_params
|
573
|
+
end
|
528
574
|
|
529
575
|
# remove items from our params hash that match:
|
530
576
|
# - a key
|
@@ -555,29 +601,34 @@ module Blacklight::BlacklightHelperBehavior
|
|
555
601
|
my_params[:page] = 1
|
556
602
|
end
|
557
603
|
|
558
|
-
my_params
|
604
|
+
sanitize_search_params(my_params)
|
605
|
+
end
|
606
|
+
|
607
|
+
##
|
608
|
+
# Sanitize the search parameters by removing unnecessary parameters
|
609
|
+
# from the provided parameters
|
610
|
+
# @param [Hash] Hash of parameters
|
611
|
+
def sanitize_search_params source_params
|
612
|
+
|
613
|
+
my_params = source_params.reject { |k,v| v.nil? }
|
559
614
|
|
560
|
-
|
561
|
-
my_params.delete(:action)
|
562
|
-
my_params.delete(:controller)
|
563
|
-
my_params.delete(:id)
|
564
|
-
# commit is just an artifact of submit button, we don't need it, and
|
565
|
-
# don't want it to pile up with another every time we press submit again!
|
566
|
-
my_params.delete(:commit)
|
615
|
+
my_params.except(:action, :controller, :id, :commit, :utf8)
|
567
616
|
|
568
|
-
my_params
|
569
617
|
end
|
570
618
|
|
619
|
+
|
571
620
|
# Create form input type=hidden fields representing the entire search context,
|
572
621
|
# for inclusion in a form meant to change some aspect of it, like
|
573
622
|
# re-sort or change records per page. Can pass in params hash
|
574
623
|
# as :params => hash, otherwise defaults to #params. Can pass
|
575
624
|
# in certain top-level params keys to _omit_, defaults to :page
|
576
625
|
def search_as_hidden_fields(options={})
|
626
|
+
Deprecation.warn(Blacklight::BlacklightHelperBehavior, "#search_as_hidden_fields is deprecated; use render_hash_as_hidden_fields(params_for_search(..)..) instead")
|
627
|
+
|
577
628
|
my_params = params_for_search({:omit_keys => [:page]}.merge(options))
|
578
629
|
|
579
630
|
# hash_as_hidden_fields in hash_as_hidden_fields.rb
|
580
|
-
return
|
631
|
+
return render_hash_as_hidden_fields(my_params)
|
581
632
|
end
|
582
633
|
|
583
634
|
def link_to_previous_document(previous_document)
|
@@ -643,4 +694,8 @@ module Blacklight::BlacklightHelperBehavior
|
|
643
694
|
has_user_authentication_provider? and current_or_guest_user.present?
|
644
695
|
end
|
645
696
|
|
697
|
+
def spell_check_max
|
698
|
+
blacklight_config.spell_max
|
699
|
+
end
|
700
|
+
|
646
701
|
end
|
@@ -10,11 +10,13 @@
|
|
10
10
|
# This is used to serialize a complete current query from current params
|
11
11
|
# to form fields used for sort and change per-page
|
12
12
|
module Blacklight::HashAsHiddenFieldsHelperBehavior
|
13
|
+
extend Deprecation
|
14
|
+
self.deprecation_horizon = 'blacklight 5.0'
|
13
15
|
|
14
16
|
# Writes out zero or more <input type="hidden"> elements, completely
|
15
17
|
# representing a hash passed in using Rails-style request parameters
|
16
18
|
# for hashes nested with arrays and other hashes.
|
17
|
-
def
|
19
|
+
def render_hash_as_hidden_fields(hash)
|
18
20
|
|
19
21
|
hidden_fields = []
|
20
22
|
flatten_hash(hash).each do |name, value|
|
@@ -27,6 +29,11 @@ module Blacklight::HashAsHiddenFieldsHelperBehavior
|
|
27
29
|
hidden_fields.join("\n").html_safe
|
28
30
|
end
|
29
31
|
|
32
|
+
def hash_as_hidden_fields *args
|
33
|
+
Deprecation.warn(Blacklight::HashAsHiddenFieldsHelperBehavior, "#hash_as_hidden_fields is deprecated; use #render_hash_as_hidden_fields instead")
|
34
|
+
render_hash_as_hidden_fields *args
|
35
|
+
end
|
36
|
+
|
30
37
|
protected
|
31
38
|
|
32
39
|
def flatten_hash(hash = params, ancestor_names = [])
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
<% @documents.each do |document| %>
|
3
3
|
|
4
|
-
<h3><%= citation_title(document) %></h3>
|
4
|
+
<h3><%= Deprecation.silence(Blacklight::BlacklightHelperBehavior) { citation_title(document) } %></h3>
|
5
5
|
|
6
6
|
<% if document.respond_to?(:export_as_mla_citation_txt) %>
|
7
7
|
<h4><%= t('blacklight.citation.mla') %></h4>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% if
|
1
|
+
<% if should_show_spellcheck_suggestions? @response %>
|
2
2
|
<div id="spell">
|
3
3
|
<h4 class="suggest"><em><%= t('blacklight.did_you_mean', :options => @response.spelling.words.map { |word| link_to_query(word) }.join(" #{t('blacklight.or')} ")).html_safe %></em></h4>
|
4
4
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= form_tag search_action_url, :method => :get, :class => 'search-query-form form-inline clearfix' do %>
|
2
|
-
<%=
|
2
|
+
<%= render_hash_as_hidden_fields(params_for_search().except(:q, :search_field, :qt, :page, :utf8)) %>
|
3
3
|
|
4
4
|
<% unless search_fields.empty? %>
|
5
5
|
<div class="pull-left">
|
data/blacklight.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_dependency "kaminari", "~> 0.13" # the pagination (page 1,2,3, etc..) of our search results
|
30
30
|
s.add_dependency "sass-rails"
|
31
31
|
s.add_dependency "bootstrap-sass", ">= 2.2.0", "< 2.4"
|
32
|
-
s.add_dependency "deprecation"
|
32
|
+
s.add_dependency "deprecation", "~> 0.1"
|
33
33
|
s.add_development_dependency "jettywrapper", ">= 1.4.1"
|
34
34
|
s.add_development_dependency "rspec-rails"
|
35
35
|
s.add_development_dependency 'engine_cart', ">= 0.1.0"
|
@@ -217,8 +217,11 @@ en:
|
|
217
217
|
leader: 'LEADER %{leader}'
|
218
218
|
empty: 'No MARC data found.'
|
219
219
|
start_over: 'Start Over'
|
220
|
+
index:
|
221
|
+
label: '%{label}'
|
220
222
|
show:
|
221
223
|
title: '%{document_title} - %{application_name}'
|
224
|
+
label: '%{label}'
|
222
225
|
rss_feed: 'RSS for results'
|
223
226
|
atom_feed: 'Atom for results'
|
224
227
|
fields:
|
@@ -233,8 +233,11 @@ fr:
|
|
233
233
|
leader: 'LABEL %{leader}'
|
234
234
|
empty: 'Pas MARC trouvé.'
|
235
235
|
start_over: 'Accueil'
|
236
|
+
index:
|
237
|
+
label: '%{label}'
|
236
238
|
show:
|
237
239
|
title: '%{document_title} - %{application_name}'
|
240
|
+
label: '%{label}'
|
238
241
|
rss_feed: 'RSS pour les résultats'
|
239
242
|
atom_feed: 'Atom pour les résultats'
|
240
243
|
fields:
|
@@ -0,0 +1,90 @@
|
|
1
|
+
Blacklight will provide atom responses for all catalog/index results. Just add ".atom" on to the end of your path component, `/catalog.atom`, or `/catalog/index.atom`.
|
2
|
+
```xml
|
3
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
4
|
+
<feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">
|
5
|
+
<title>Blacklight Search Results</title>
|
6
|
+
<author>
|
7
|
+
<name>Blacklight</name>
|
8
|
+
</author>
|
9
|
+
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;q=urdu&amp;search_field=all_fields" rel="self"/>
|
10
|
+
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=html&amp;q=urdu&amp;search_field=all_fields" rel="alternate" type="text/html"/>
|
11
|
+
<id>http://demo.projectblacklight.org/?commit=search&amp;format=html&amp;q=urdu&amp;search_field=all_fields&amp;type=text%2Fhtml</id>
|
12
|
+
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;page=2&amp;q=urdu&amp;search_field=all_fields" rel="next"/>
|
13
|
+
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;page=1&amp;q=urdu&amp;search_field=all_fields" rel="first"/>
|
14
|
+
<link href="http://demo.projectblacklight.org/?commit=search&amp;format=atom&amp;page=15&amp;q=urdu&amp;search_field=all_fields" rel="last"/>
|
15
|
+
<link href="http://demo.projectblacklight.org/catalog/opensearch.xml" rel="search" type="application/opensearchdescription+xml"/>
|
16
|
+
<opensearch:totalResults>147</opensearch:totalResults>
|
17
|
+
<opensearch:startIndex>0</opensearch:startIndex>
|
18
|
+
<opensearch:itemsPerPage>10</opensearch:itemsPerPage>
|
19
|
+
<opensearch:Query searchTerms="urdu" startPage="1" role="request"/>
|
20
|
+
<updated>2011-05-11T17:46:58Z</updated>
|
21
|
+
<entry>
|
22
|
+
<title>Urdū ḍrāmā</title>
|
23
|
+
<updated>2011-05-11T17:46:58Z</updated>
|
24
|
+
<link href="http://demo.projectblacklight.org/catalog/2008306442" rel="alternate" type="text/html"/>
|
25
|
+
<link href="http://demo.projectblacklight.org/catalog/2008306442.dc_xml" rel="alternate" title="dc_xml" type="text/xml" />
|
26
|
+
<link href="http://demo.projectblacklight.org/catalog/2008306442.xml" rel="alternate" title="xml" type="application/xml" />
|
27
|
+
<id>http://demo.projectblacklight.org/catalog/2008306442</id>
|
28
|
+
<author>
|
29
|
+
<name>Farg̲h̲ānah, 1979-</name>
|
30
|
+
</author>
|
31
|
+
<summary type="html">
|
32
|
+
<dl class="defList">
|
33
|
+
|
34
|
+
|
35
|
+
<dt class="blacklight-title_display">Title:</dt>
|
36
|
+
<dd class="blacklight-title_display">Urdū ḍrāmā</dd>
|
37
|
+
|
38
|
+
<dt class="blacklight-author_display">Author:</dt>
|
39
|
+
<dd class="blacklight-author_display">Farg̲h̲ānah, 1979-</dd>
|
40
|
+
|
41
|
+
|
42
|
+
<!-- [...] -->
|
43
|
+
</dl>
|
44
|
+
</summary>
|
45
|
+
</entry>
|
46
|
+
<!-- [...] -->
|
47
|
+
</feed>
|
48
|
+
```
|
49
|
+
|
50
|
+
|
51
|
+
The same HTML summary included in your HTML results pages are included as an `atom:summary` element -- the atom template uses the `[[#render_document_partial|https://github.com/projectblacklight/blacklight/blob/master/app/helpers/blacklight/blacklight_helper_behavior.rb#L203]]` helper method to generate this HTML summary, so if you've over-ridden that for your app, it will be used as the `atom:summary` content instead.
|
52
|
+
|
53
|
+
## API Usage
|
54
|
+
The Atom response is intended to be pretty full of data, so it can fill many traditional API requests. It makes use of every relevant atom or [[OpenSearch|http://www.opensearch.org/Home]] element that could be conveniently included.
|
55
|
+
|
56
|
+
The Atom response also supports arbitrary format representations in the `atom:content` element. You can include `&content_format=some_format` in your request URL (e.g. `[[/catalog.atom?content_format=oai_dc_xml|http://demo.projectblacklight.org/catalog.atom?q=urdu&content_format=oai_dc_xml]]`). Any format a given document can be exported as using the [[Blacklight document framework|Extending-blacklight-with-the-document-extension-framework]] is available. Not every document can export in every format -- if a format is requested one or more of the items in your atom result can not export as, it will not have an `atom:content` element. Non-XML-based formats are supported, as the content is Base64-encoded (as per Atom spec, unless the format is `text/plain`).
|
57
|
+
```xml
|
58
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
59
|
+
<feed xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">
|
60
|
+
<title>Blacklight Search Results</title>
|
61
|
+
<author>
|
62
|
+
<name>Blacklight</name>
|
63
|
+
</author>
|
64
|
+
<link href="http://demo.projectblacklight.org/?content_format=oai_dc_xml&amp;format=atom&amp;per_page=1" rel="self"/>
|
65
|
+
<!-- [...] -->
|
66
|
+
<entry>
|
67
|
+
<title>The book of the dance in the 20th century selections from the Jane Bourne Parton collection of books on the dance</title>
|
68
|
+
<updated>2011-05-11T17:59:32Z</updated>
|
69
|
+
<link href="http://demo.projectblacklight.org/catalog/u1" rel="alternate" type="text/html"/>
|
70
|
+
<link href="http://demo.projectblacklight.org/catalog/u1.dc_xml" rel="alternate" title="dc_xml" type="text/xml" />
|
71
|
+
<link href="http://demo.projectblacklight.org/catalog/u1.xml" rel="alternate" title="xml" type="application/xml" />
|
72
|
+
<id>http://demo.projectblacklight.org/catalog/u1</id>
|
73
|
+
<author>
|
74
|
+
<name>Roatcap, Adela Spindler</name>
|
75
|
+
</author>
|
76
|
+
<summary type="html">
|
77
|
+
<!-- [...] -->
|
78
|
+
</summary>
|
79
|
+
<!-- [ Here is the export format as OAI Dublin Core XML ] -->
|
80
|
+
<content type="text/xml">
|
81
|
+
<oai_dc:dc xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:language>English</dc:language><dc:title>The book of the dance in the 20th century selections from the Jane Bourne Parton collection of books on the dance</dc:title><dc:format>Book</dc:format></oai_dc:dc> </content>
|
82
|
+
</entry>
|
83
|
+
</feed>
|
84
|
+
```
|
85
|
+
|
86
|
+
This means that if you add on a document extension that provides more export formats for some or all of your documents, that will automatically be available in the atom response.
|
87
|
+
|
88
|
+
If you choose to use the [[Blacklight CQL add-on|https://github.com/projectblacklight/blacklight_cql]], the combination of [[CQL|http://www.loc.gov/standards/sru/specs/cql.html]] requests and Atom responses provides a pretty good more-or-less standards-based API to search results through Blacklight.
|
89
|
+
|
90
|
+
The Atom response generating template is at `app/views/catalog/index.builder.atom`.
|
@@ -0,0 +1,107 @@
|
|
1
|
+
This page outlines the basic steps needed to upgrade your customized installation of Blacklight 2.x to work with Blacklight 3.x.
|
2
|
+
|
3
|
+
## Rails 3 Specific Changes:
|
4
|
+
Please see [[http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade]] - for a good introduction.
|
5
|
+
|
6
|
+
1. Start by installing Rails3, generate a new app, make sure it works. Doing this not only proves your rails3 installation is working, but it will also get you familiar with the command line tools - which are very different now.
|
7
|
+
1. Now, create a new rails app on top of your existing application. This will make all sorts of modifications, creating and updating your Gemfile, Rakefile, application.rb, locals, new javascript, etc... You should also remove all the files in /script/ except for rails - since these scripts are no longer used.
|
8
|
+
|
9
|
+
```bash
|
10
|
+
$ rails new my_existing_app
|
11
|
+
```
|
12
|
+
|
13
|
+
1. Routes are WAY different in rails 3. Please see [[http://www.engineyard.com/blog/2010/the-lowdown-on-routes-in-rails-3/]]
|
14
|
+
1. Most of your application specific configuration now takes place in a file called `config/application.rb` - you will need to move most of what is currently in your `config/environment.rb` and `config/boot.rb` into this new file.
|
15
|
+
1. The `lib` directory is no longer auto-loaded - and the general recommendation is not to make it so (though it is possible inside of `config/application.rb`) - I went through and added requires methods where and when they are needed in the individual files, which is nice - because now it is far more clear what needs what.
|
16
|
+
1. Rails 3 escapes strings by default. You will have to add `#html_safe` to any ruby string variables that were created 'from scratch' rather than using a "safe" helper (e.g. `content_tag`, `link_to`) which escape the string internally.
|
17
|
+
|
18
|
+
## Other Gems that will need upgrading
|
19
|
+
1. If you were using the ExceptionNotification gem, things have changed in rails, There is a good explanation here:
|
20
|
+
[[http://stackoverflow.com/questions/3524127/exception-notification-gem-and-rails-3]]
|
21
|
+
1. If your are using RSpec, you will need to upgrade it in your gem file to version 2. And you will need to re-run the generator
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'rspec', '>2.0.0'
|
25
|
+
$ rails generate rspec:install
|
26
|
+
```
|
27
|
+
|
28
|
+
1. Recapcha, and Prawnto - I was previously using these as plugins, but they have good gems now, so I removed these from the plugin directory, and added them to the `Gemfile`.
|
29
|
+
|
30
|
+
1. If you are using the Marc gem, make sure you are running 0.4.1 - ran into some problems related to changes in the way Rails3 handles json prior to this upgrade.
|
31
|
+
|
32
|
+
## Blacklight Specific Changes
|
33
|
+
1. There is no `application_helper.rb` file in Blacklight now. It was moved to `blacklight_helper`, and its methods are made available automatically. (see `blacklight/engine.rb` for more information) So if you were attempting to include this file and override it, don't. Just redefine the methods in your own `ApplicationHelper`, and you should be fine.
|
34
|
+
1. Remove the Blacklight plugin directory from /vendor - since you will be installing in as a gem. Include the Blacklight gem in your `Gemfile` list and run `bundle install`:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
gem 'blacklight'
|
38
|
+
```
|
39
|
+
|
40
|
+
If you have Blacklight checked out somewhere, you can point to it in your gem file as follows:
|
41
|
+
```ruby
|
42
|
+
gem 'blacklight', :path => '../some/file/path/to/blacklight'
|
43
|
+
```
|
44
|
+
|
45
|
+
1. Most of the customization of Blacklight is done through overriding Blacklight-provided methods and templates. In Virgo you would often see lines like:
|
46
|
+
```ruby
|
47
|
+
require_dependency 'vendor/plugins/blacklight/....
|
48
|
+
```
|
49
|
+
at the top of a file that re-opened the class and made modifications to it.
|
50
|
+
You would now need to change this to:
|
51
|
+
```ruby
|
52
|
+
require "#{Blacklight.controllers_dir}/bookmarks_controller" For controllers, and ...
|
53
|
+
require "#{Blacklight.models_dir}/bookmark" For models.
|
54
|
+
```
|
55
|
+
1. Blacklight no longer includes a `User` model or `SessionController` out of the box. If you want Blacklight to provide user authentication services, you will need to install a separate library. Blacklight recommends Devise, and the Blacklight generator (in the next step) can be used to setup Devise for you.
|
56
|
+
|
57
|
+
If you choose to roll-your-own, you will need to add in whatever you need - in my case, that was just creating a `User` model and include the `Blacklight::User` mixin.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
class User < ActiveRecord::Base
|
61
|
+
include Blacklight::User
|
62
|
+
acts_as_authentic
|
63
|
+
end
|
64
|
+
```
|
65
|
+
Please also see the notes on the `ApplicationController` below ...
|
66
|
+
|
67
|
+
1. Run the Blacklight Generator - This will add all kinds of files to your local application - including stylesheets, images, jar files, database migrations, etc.. It will try it's best to be "idempotent" - that it is shouldn't mess anything up to run this over and over again. It will verify that the changes it's making are not already in place.
|
68
|
+
```bash
|
69
|
+
$ rails generate blacklight (--devise, if you want Blacklight to install devise or MODEL_NAME, to point at a custom User model)
|
70
|
+
```
|
71
|
+
1. For the most part, you override a controller provided by Blacklight by including the class and then reopening it. That said, the `CatalogController` is generated for you into your application (unless you already have one). Your `CatalogController` should look something like this:
|
72
|
+
```ruby
|
73
|
+
class CatalogController < ApplicationController
|
74
|
+
inlcude Blacklight::Catalog
|
75
|
+
.....
|
76
|
+
end
|
77
|
+
```
|
78
|
+
If you end up overriding a large number of `SolrHelper` methods, you can also override the solr helpers in your own file, and then include that file.
|
79
|
+
```ruby
|
80
|
+
module UVA::SolrHelper
|
81
|
+
include Blacklight::SolrHelper
|
82
|
+
.....
|
83
|
+
end
|
84
|
+
|
85
|
+
class CatalogController < ApplicationController
|
86
|
+
include UVA::SolrHelper
|
87
|
+
include Blacklight::Catalog
|
88
|
+
....
|
89
|
+
end
|
90
|
+
```
|
91
|
+
1. Application Controller
|
92
|
+
The Blacklight generator, will add a line to your `ApplicationController` if isn't there already which will cause the `ApplicationController` to include the base controller logic for Blacklight:
|
93
|
+
```ruby
|
94
|
+
class ApplicationController < ActionController::Base
|
95
|
+
include Blacklight::Controller
|
96
|
+
end
|
97
|
+
```
|
98
|
+
The `Blacklight::Controller` module adds a number of helper methods, forces the the Blacklight layout, adds the `before_filter :default_html_head`. Blacklight by no means requires the inclusion of this file. In the case of Virgo, we do not.
|
99
|
+
|
100
|
+
You will most likely need to define the following methods in your application controller, particularly if you have any sort of custom user authentication.
|
101
|
+
|
102
|
+
* `user_session` - which should return the current rails session object.
|
103
|
+
* `current_user` - which should return a user object that includes `Blacklight::User`
|
104
|
+
* `new_user_session_path` - which should return the path for logging into your application
|
105
|
+
* `destroy_user_session_path` - which should return the path for logging out of your application.
|
106
|
+
|
107
|
+
`SolrDocument` is no longer a file in Blacklight, but rather a generated model in your application, in this way you can easily override and modify the behavior of individual documents. This is automatically created for you, I just wanted to draw you attention to it.
|