blacklight 4.4.1 → 4.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/stylesheets/blacklight/_bookmark.css.scss +0 -5
- data/app/assets/stylesheets/blacklight/_facets.css.scss +5 -5
- data/app/controllers/saved_searches_controller.rb +1 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +2 -2
- data/app/views/catalog/_bookmark_form.html.erb +1 -2
- data/app/views/catalog/_refworks_form.html.erb +1 -2
- data/lib/blacklight/catalog.rb +14 -14
- data/lib/blacklight/controller.rb +4 -4
- data/lib/blacklight/solr_response/pagination_methods.rb +1 -0
- data/spec/controllers/catalog_controller_spec.rb +39 -10
- data/spec/features/search_results_spec.rb +6 -0
- data/spec/lib/blacklight_solr_response_spec.rb +3 -0
- data/spec/views/catalog/_thumbnail_default.erb_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20820db95c02b75fc8e604045248607f45d085bc
|
4
|
+
data.tar.gz: 6992b7d81e5792a425cd8018d63a50b03c38dae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78fc07fc10e18251ac027e93034e78c85449cda541953fd9a041bc0e7977139f8da349efe311da67b5032931a875e8dba74a972f1603f5bc11a1e04cd4e4423d
|
7
|
+
data.tar.gz: edb93872a34964b0381753e4c2ba25d0feb7ec5cd1bccdb24515a1fb71729b15edab4d673a3af1ee693ba7081efee1602535b1173f711dcfd7c4046cf78bf230
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.4.
|
1
|
+
4.4.2
|
@@ -7,6 +7,11 @@
|
|
7
7
|
h5 a {
|
8
8
|
color: inherit;
|
9
9
|
text-decoration: none;
|
10
|
+
|
11
|
+
&:hover
|
12
|
+
{
|
13
|
+
background-color:#eee;
|
14
|
+
}
|
10
15
|
}
|
11
16
|
|
12
17
|
ul {
|
@@ -29,11 +34,6 @@
|
|
29
34
|
padding: 3px 5px;
|
30
35
|
}
|
31
36
|
|
32
|
-
a:hover
|
33
|
-
{
|
34
|
-
background-color:#eee;
|
35
|
-
}
|
36
|
-
|
37
37
|
.count {
|
38
38
|
text-align:right;
|
39
39
|
float:right;
|
@@ -38,7 +38,7 @@ class SavedSearchesController < ApplicationController
|
|
38
38
|
# Only dereferences the user rather than removing the items in case they
|
39
39
|
# are in the session[:history]
|
40
40
|
def clear
|
41
|
-
if
|
41
|
+
if current_user.searches.update_all("user_id = NULL")
|
42
42
|
flash[:notice] = I18n.t('blacklight.saved_searches.clear.success')
|
43
43
|
else
|
44
44
|
flash[:error] = I18n.t('blacklight.saved_searches.clear.failure')
|
@@ -477,10 +477,10 @@ module Blacklight::BlacklightHelperBehavior
|
|
477
477
|
# Use the catalog_path RESTful route to create a link to the show page for a specific item.
|
478
478
|
# catalog_path accepts a HashWithIndifferentAccess object. The solr query params are stored in the session,
|
479
479
|
# so we only need the +counter+ param here. We also need to know if we are viewing to document as part of search results.
|
480
|
-
def link_to_document(doc, opts={:label=>nil, :counter => nil
|
480
|
+
def link_to_document(doc, opts={:label=>nil, :counter => nil})
|
481
481
|
opts[:label] ||= blacklight_config.index.show_link.to_sym
|
482
482
|
label = render_document_index_label doc, opts
|
483
|
-
link_to label, doc, { :'data-counter' => opts[:counter] }.merge(opts.reject { |k,v| [:label, :counter
|
483
|
+
link_to label, doc, { :'data-counter' => opts[:counter] }.merge(opts.reject { |k,v| [:label, :counter].include? k })
|
484
484
|
end
|
485
485
|
|
486
486
|
# link_back_to_catalog(:label=>'Back to Search')
|
@@ -3,6 +3,5 @@
|
|
3
3
|
<%= hidden_field_tag "bookmarks[#{index}][document_id]", document.id %>
|
4
4
|
<%= hidden_field_tag "bookmarks[#{index}][title]", h(document[document_show_link_field])%>
|
5
5
|
<% end %>
|
6
|
-
<%=
|
7
|
-
<%= submit_tag t('blacklight.bookmarks.collection.add.button'), :class => 'hide' %>
|
6
|
+
<%= submit_tag t('blacklight.bookmarks.collection.add.button'), :class => 'btn' %>
|
8
7
|
<% end %>
|
@@ -1,7 +1,6 @@
|
|
1
1
|
<%= form_tag "http://www.refworks.com/express/expressimport.asp?vendor=#{application_name}&filter=MARC%20Format&encoding=65001", :name => "refworks", :target => "_blank", :id => "refworks-form" do %>
|
2
2
|
|
3
3
|
<%= hidden_field_tag "ImportData", render_refworks_texts(documents) %>
|
4
|
-
<%= submit_tag t('blacklight.tools.refworks'), :class => 'submit'%>
|
5
|
-
<%= link_to_function t('blacklight.tools.refworks'), "document.refworks.submit();", :class => "btn" %>
|
4
|
+
<%= submit_tag t('blacklight.tools.refworks'), :class => 'submit btn'%>
|
6
5
|
<% end %>
|
7
6
|
|
data/lib/blacklight/catalog.rb
CHANGED
@@ -42,7 +42,16 @@ module Blacklight::Catalog
|
|
42
42
|
format.atom { render :layout => false }
|
43
43
|
|
44
44
|
|
45
|
-
format.json
|
45
|
+
format.json do
|
46
|
+
facet = facets_from_request.as_json.each do |f|
|
47
|
+
f["label"] = facet_configuration_for_field(f["name"]).label
|
48
|
+
f["items"] = f["items"].as_json.each do |i|
|
49
|
+
i['label'] ||= i['value']
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
render json: {response: {docs: @document_list, facets: facet, pages: pagination_info(@response)}}
|
54
|
+
end
|
46
55
|
end
|
47
56
|
end
|
48
57
|
|
@@ -68,7 +77,6 @@ module Blacklight::Catalog
|
|
68
77
|
|
69
78
|
# updates the search counter (allows the show view to paginate)
|
70
79
|
def update
|
71
|
-
adjust_for_results_view
|
72
80
|
session[:search][:counter] = params[:counter]
|
73
81
|
redirect_to :action => "show"
|
74
82
|
end
|
@@ -120,9 +128,7 @@ module Blacklight::Catalog
|
|
120
128
|
@response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
|
121
129
|
|
122
130
|
if request.post? and validate_email_params
|
123
|
-
|
124
|
-
|
125
|
-
email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]}, url_gen_params)
|
131
|
+
email = RecordMailer.email_record(@documents, {:to => params[:to], :message => params[:message]}, url_options)
|
126
132
|
email.deliver
|
127
133
|
|
128
134
|
flash[:success] = I18n.t("blacklight.email.success")
|
@@ -145,11 +151,9 @@ module Blacklight::Catalog
|
|
145
151
|
@response, @documents = get_solr_response_for_field_values(SolrDocument.unique_key,params[:id])
|
146
152
|
|
147
153
|
if request.post? and validate_sms_params
|
148
|
-
url_gen_params = {:host => request.host_with_port, :protocol => request.protocol}
|
149
|
-
|
150
154
|
to = "#{params[:to].gsub(/[^\d]/, '')}@#{sms_mappings[params[:carrier]]}"
|
151
155
|
|
152
|
-
sms = RecordMailer.sms_record(@documents, { :to => to },
|
156
|
+
sms = RecordMailer.sms_record(@documents, { :to => to }, url_options)
|
153
157
|
sms.deliver
|
154
158
|
|
155
159
|
flash[:success] = I18n.t("blacklight.sms.success")
|
@@ -261,13 +265,9 @@ module Blacklight::Catalog
|
|
261
265
|
# we need to know if we are viewing the item as part of search results so we know whether to
|
262
266
|
# include certain partials or not
|
263
267
|
def adjust_for_results_view
|
264
|
-
|
265
|
-
|
266
|
-
else
|
267
|
-
session[:search][:results_view] = true
|
268
|
-
end
|
268
|
+
# deprecated in blacklight 4.x
|
269
|
+
ActiveSupport::Deprecation.warn("#adjust_for_results_view helper was deprecated in Blacklight 4.x")
|
269
270
|
end
|
270
|
-
|
271
271
|
|
272
272
|
# when solr (RSolr) throws an error (RSolr::RequestError), this method is executed.
|
273
273
|
def rsolr_request_error(exception)
|
@@ -95,15 +95,15 @@ module Blacklight::Controller
|
|
95
95
|
# When a user logs in, transfer any saved searches or bookmarks to the current_user
|
96
96
|
def transfer_guest_user_actions_to_current_user
|
97
97
|
return unless respond_to? :current_user and respond_to? :guest_user and current_user and guest_user
|
98
|
-
current_user_searches = current_user.searches.
|
99
|
-
current_user_bookmarks = current_user.bookmarks.
|
98
|
+
current_user_searches = current_user.searches.pluck(:query_params)
|
99
|
+
current_user_bookmarks = current_user.bookmarks.pluck(:document_id)
|
100
100
|
|
101
|
-
guest_user.searches.
|
101
|
+
guest_user.searches.reject { |s| current_user_searches.include?(s.query_params)}.each do |s|
|
102
102
|
current_user.searches << s
|
103
103
|
s.save!
|
104
104
|
end
|
105
105
|
|
106
|
-
guest_user.bookmarks.
|
106
|
+
guest_user.bookmarks.reject { |b| current_user_bookmarks.include?(b.document_id)}.each do |b|
|
107
107
|
current_user.bookmarks << b
|
108
108
|
b.save!
|
109
109
|
end
|
@@ -144,17 +144,40 @@ describe CatalogController do
|
|
144
144
|
end
|
145
145
|
|
146
146
|
describe "with format :json" do
|
147
|
-
|
147
|
+
before do
|
148
148
|
get :index, :format => 'json'
|
149
149
|
response.should be_success
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
150
|
+
end
|
151
|
+
let(:json) { JSON.parse(response.body)['response'] }
|
152
|
+
let(:pages) { json["pages"] }
|
153
|
+
let(:docs) { json["docs"] }
|
154
|
+
let(:facets) { json["facets"] }
|
155
|
+
|
156
|
+
it "should get the pages" do
|
157
|
+
pages["total_count"].should == 30
|
158
|
+
pages["current_page"].should == 1
|
159
|
+
pages["total_pages"].should == 3
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should get the documents" do
|
163
|
+
docs.size.should == 10
|
164
|
+
docs.first.keys.should == ["published_display", "author_display", "lc_callnum_display", "pub_date", "subtitle_display", "format", "material_type_display", "title_display", "id", "subject_topic_facet", "language_facet", "score"]
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should get the facets" do
|
168
|
+
facets.length.should == 9
|
169
|
+
facets.first.should == {"name"=>"format", "label" => "Format", "items"=>[{"value"=>"Book", "hits"=>30, "label"=>"Book"}]}
|
170
|
+
end
|
171
|
+
|
172
|
+
describe "facets" do
|
173
|
+
let(:query_facet_items) { facets.last['items'] }
|
174
|
+
let(:regular_facet_items) { facets.first['items'] }
|
175
|
+
it "should have items with labels and values" do
|
176
|
+
query_facet_items.first['label'].should == 'within 5 Years'
|
177
|
+
query_facet_items.first['value'].should == 'years_5'
|
178
|
+
regular_facet_items.first['label'].should == "Book"
|
179
|
+
regular_facet_items.first['value'].should == "Book"
|
180
|
+
end
|
158
181
|
end
|
159
182
|
end
|
160
183
|
|
@@ -254,6 +277,7 @@ describe CatalogController do
|
|
254
277
|
|
255
278
|
describe "@document" do
|
256
279
|
before do
|
280
|
+
@mock_response = double()
|
257
281
|
@mock_response.stub(:docs => [{ :id => 'my_fake_doc' }])
|
258
282
|
@mock_document = double()
|
259
283
|
controller.stub(:find => @mock_response,
|
@@ -280,6 +304,7 @@ describe CatalogController do
|
|
280
304
|
end
|
281
305
|
end
|
282
306
|
before do
|
307
|
+
@mock_response = double()
|
283
308
|
@mock_response.stub(:docs => [{ :id => 'my_fake_doc' }])
|
284
309
|
@mock_document = double()
|
285
310
|
controller.stub(:find => @mock_response,
|
@@ -364,7 +389,11 @@ describe CatalogController do
|
|
364
389
|
request.flash[:error].should be_nil
|
365
390
|
end
|
366
391
|
it "should redirect back to the record upon success" do
|
367
|
-
|
392
|
+
mock_mailer = double
|
393
|
+
mock_mailer.should_receive(:deliver)
|
394
|
+
RecordMailer.should_receive(:email_record).with(anything, { :to => 'test_email@projectblacklight.org', :message => 'xyz' }, hash_including(:host => 'test.host')).and_return mock_mailer
|
395
|
+
|
396
|
+
post :email, :id => doc_id, :to => 'test_email@projectblacklight.org', :message => 'xyz'
|
368
397
|
request.flash[:error].should be_nil
|
369
398
|
request.should redirect_to(catalog_path(doc_id))
|
370
399
|
end
|
@@ -44,6 +44,12 @@ describe "Search Results" do
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
+
it "should have an opensearch description document" do
|
48
|
+
visit root_path
|
49
|
+
page.should have_xpath("//link[contains(@rel, 'search')]")
|
50
|
+
expect(page.find(:xpath, "//link[contains(@rel, 'search')]")[:href]).to eq "http://www.example.com/catalog/opensearch.xml"
|
51
|
+
end
|
52
|
+
|
47
53
|
end
|
48
54
|
|
49
55
|
|
@@ -63,6 +63,9 @@ describe Blacklight::SolrResponse do
|
|
63
63
|
expect(r.total_count).to eq(r.total)
|
64
64
|
expect(r.next_page).to eq(r.current_page + 1)
|
65
65
|
expect(r.prev_page).to eq(nil)
|
66
|
+
if Kaminari.config.respond_to? :max_pages
|
67
|
+
expect(r.max_pages).to be_nil
|
68
|
+
end
|
66
69
|
expect(r).to be_a_kind_of Kaminari::PageScopeMethods
|
67
70
|
end
|
68
71
|
|
@@ -17,7 +17,7 @@ describe "catalog/_thumbnail_default" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
before do
|
20
|
-
assign :response,
|
20
|
+
assign :response, double(:params => {})
|
21
21
|
view.stub(:render_grouped_response?).and_return false
|
22
22
|
view.stub(:blacklight_config).and_return(blacklight_config)
|
23
23
|
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: 4.4.
|
4
|
+
version: 4.4.2
|
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: 2013-09-
|
20
|
+
date: 2013-09-27 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|