blacklight 5.5.2 → 5.5.3
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/assets/stylesheets/blacklight/_facets.css.scss +19 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +2 -2
- data/app/views/layouts/blacklight.html.erb +2 -2
- data/lib/blacklight/catalog.rb +1 -1
- data/lib/blacklight/routes.rb +1 -0
- data/lib/blacklight/solr/facet_paginator.rb +4 -4
- data/lib/blacklight/solr_helper.rb +4 -4
- data/spec/controllers/catalog_controller_spec.rb +8 -3
- data/spec/lib/blacklight/facet_paginator_spec.rb +2 -1
- data/spec/lib/blacklight/solr_helper_spec.rb +4 -2
- data/spec/routing/catalog_routing_spec.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bf604eb0b46a56985d84d8cb961500977284bad
|
4
|
+
data.tar.gz: 4e12870a95adf4febbc6b1169a5f82554db0ea06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f4c3e67986cd420977845279c4f20014595a1d8e26c13b83e57108b54d744022bae8699352ef2cecd159c49a483a8b52397f382213c3066ce746645f0c2683
|
7
|
+
data.tar.gz: db60e6e0fcedc28a3053039076652eb78e3b076881a8fc818f68e48b4d86482829f54bf934d7dda7a62829529abef89c77d856a9effef12b4d3c7ff365e5ba42
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.5.
|
1
|
+
5.5.3
|
@@ -52,6 +52,22 @@
|
|
52
52
|
}
|
53
53
|
}
|
54
54
|
|
55
|
+
@mixin hyphens-auto {
|
56
|
+
// breaks long words apart so they don't cause the containing div to
|
57
|
+
// be too big
|
58
|
+
// from http://kenneth.io/blog/2012/03/04/word-wrapping-hypernation-using-css/
|
59
|
+
-ms-word-break: break-all;
|
60
|
+
word-break: break-all;
|
61
|
+
|
62
|
+
// Non standard for webkit
|
63
|
+
word-break: break-word;
|
64
|
+
|
65
|
+
-webkit-hyphens: auto;
|
66
|
+
-moz-hyphens: auto;
|
67
|
+
-ms-hyphens: auto;
|
68
|
+
hyphens: auto;
|
69
|
+
}
|
70
|
+
|
55
71
|
.facet-label {
|
56
72
|
display: table-cell;
|
57
73
|
padding-right: 1em;
|
@@ -59,6 +75,8 @@
|
|
59
75
|
text-indent: -15px;
|
60
76
|
padding-left: 15px;
|
61
77
|
padding-bottom: $padding-base-vertical;
|
78
|
+
|
79
|
+
@include hyphens-auto;
|
62
80
|
}
|
63
81
|
|
64
82
|
.facet-count {
|
@@ -139,4 +157,4 @@ ul.facet_extended_list, .facet_extended_list ul
|
|
139
157
|
padding-bottom: $padding-base-vertical;
|
140
158
|
padding-left: $padding-large-horizontal;
|
141
159
|
}
|
142
|
-
}
|
160
|
+
}
|
@@ -412,7 +412,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
412
412
|
document_index_path_templates.each do |str|
|
413
413
|
partial = str % { index_view_type: view }
|
414
414
|
logger.debug "Looking for document index partial #{partial}"
|
415
|
-
template = lookup_context.find_all(partial, lookup_context.prefixes, true, locals.keys + [:documents], {}).first
|
415
|
+
template = lookup_context.find_all(partial, lookup_context.prefixes + [""], true, locals.keys + [:documents], {}).first
|
416
416
|
return template.render(self, locals.merge(documents: documents)) if template
|
417
417
|
end
|
418
418
|
|
@@ -501,7 +501,7 @@ module Blacklight::BlacklightHelperBehavior
|
|
501
501
|
document_partial_path_templates.each do |str|
|
502
502
|
partial = str % { action_name: base_name, format: format, index_view_type: document_index_view_type }
|
503
503
|
logger.debug "Looking for document partial #{partial}"
|
504
|
-
template = lookup_context.find_all(partial, lookup_context.prefixes, true, locals.keys + [:document], {}).first
|
504
|
+
template = lookup_context.find_all(partial, lookup_context.prefixes + [""], true, locals.keys + [:document], {}).first
|
505
505
|
return template.render(self, locals.merge(document: doc)) if template
|
506
506
|
end
|
507
507
|
|
@@ -16,10 +16,10 @@
|
|
16
16
|
<title><%= render_page_title %></title>
|
17
17
|
<%= opensearch_description_tag application_name, opensearch_catalog_path(:format => 'xml', :only_path => false) %>
|
18
18
|
<%= favicon_link_tag asset_path('favicon.ico') %>
|
19
|
-
<%= stylesheet_link_tag
|
19
|
+
<%= stylesheet_link_tag "application", media: "all" %>
|
20
20
|
<%= javascript_include_tag "application" %>
|
21
21
|
<%= csrf_meta_tags %>
|
22
|
-
<%= content_for(:head) %>
|
22
|
+
<%= content_for(:head) %>
|
23
23
|
|
24
24
|
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
25
25
|
<!--[if lt IE 9]>
|
data/lib/blacklight/catalog.rb
CHANGED
@@ -138,7 +138,7 @@ module Blacklight::Catalog
|
|
138
138
|
@response, @documents = get_solr_response_for_document_ids(params[:id])
|
139
139
|
|
140
140
|
if request.post? and validate_sms_params
|
141
|
-
to = "#{params[:to].gsub(/[^\d]/, '')}@#{
|
141
|
+
to = "#{params[:to].gsub(/[^\d]/, '')}@#{params[:carrier]}"
|
142
142
|
|
143
143
|
sms = RecordMailer.sms_record(@documents, { :to => to }, url_options)
|
144
144
|
sms.deliver
|
data/lib/blacklight/routes.rb
CHANGED
@@ -37,7 +37,7 @@ module Blacklight::Solr
|
|
37
37
|
def initialize(all_facet_values, arguments)
|
38
38
|
# to_s.to_i will conveniently default to 0 if nil
|
39
39
|
@offset = arguments[:offset].to_s.to_i
|
40
|
-
@limit =
|
40
|
+
@limit = arguments[:limit]
|
41
41
|
# count is solr's default
|
42
42
|
@sort = arguments[:sort] || "count"
|
43
43
|
|
@@ -82,7 +82,7 @@ module Blacklight::Solr
|
|
82
82
|
deprecation_deprecate :has_next?
|
83
83
|
|
84
84
|
def last_page?
|
85
|
-
total_count <= limit
|
85
|
+
limit.nil? || total_count <= limit
|
86
86
|
end
|
87
87
|
|
88
88
|
def first_page?
|
@@ -112,10 +112,10 @@ module Blacklight::Solr
|
|
112
112
|
end
|
113
113
|
|
114
114
|
private
|
115
|
-
# setting limit to
|
115
|
+
# setting limit to nil implies no limit
|
116
116
|
# @return an array of facets on the page
|
117
117
|
def items_for_limit(values)
|
118
|
-
limit
|
118
|
+
limit.nil? ? values : values.take(limit)
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
@@ -327,8 +327,8 @@ module Blacklight::SolrHelper
|
|
327
327
|
a << response.documents.map {|doc| doc[solr_params[:fl]].to_s }
|
328
328
|
end
|
329
329
|
|
330
|
-
|
331
|
-
|
330
|
+
DEFAULT_FACET_LIMIT = 10
|
331
|
+
|
332
332
|
# Look up facet limit for given facet_field. Will look at config, and
|
333
333
|
# if config is 'true' will look up from Solr @response if available. If
|
334
334
|
# no limit is avaialble, returns nil. Used from #solr_search_params
|
@@ -349,8 +349,8 @@ module Blacklight::SolrHelper
|
|
349
349
|
else
|
350
350
|
limit.to_i - 1 # we added 1 to find out if we needed to paginate
|
351
351
|
end
|
352
|
-
elsif
|
353
|
-
facet.limit
|
352
|
+
elsif facet.limit
|
353
|
+
facet.limit == true ? DEFAULT_FACET_LIMIT : facet.limit
|
354
354
|
end
|
355
355
|
end
|
356
356
|
|
@@ -404,7 +404,7 @@ describe CatalogController do
|
|
404
404
|
SolrDocument.use_extension( Blacklight::Solr::Document::Sms )
|
405
405
|
end
|
406
406
|
describe "email" do
|
407
|
-
it "should give error if no TO
|
407
|
+
it "should give error if no TO parameter" do
|
408
408
|
post :email, :id => doc_id
|
409
409
|
expect(request.flash[:error]).to eq "You must enter a recipient in order to send this message"
|
410
410
|
end
|
@@ -412,7 +412,7 @@ describe CatalogController do
|
|
412
412
|
post :email, :id => doc_id, :to => 'test_bad_email'
|
413
413
|
expect(request.flash[:error]).to eq "You must enter a valid email address"
|
414
414
|
end
|
415
|
-
it "should not give error if no Message
|
415
|
+
it "should not give error if no Message parameter is set" do
|
416
416
|
post :email, :id => doc_id, :to => 'test_email@projectblacklight.org'
|
417
417
|
expect(request.flash[:error]).to be_nil
|
418
418
|
end
|
@@ -425,7 +425,6 @@ describe CatalogController do
|
|
425
425
|
expect(request.flash[:error]).to be_nil
|
426
426
|
expect(request).to redirect_to(catalog_path(doc_id))
|
427
427
|
end
|
428
|
-
|
429
428
|
it "should render email_sent for XHR requests" do
|
430
429
|
xhr :post, :email, :id => doc_id, :to => 'test_email@projectblacklight.org'
|
431
430
|
expect(request).to render_template 'email_sent'
|
@@ -454,6 +453,12 @@ describe CatalogController do
|
|
454
453
|
expect(request.flash[:error]).to be_nil
|
455
454
|
expect(request).to redirect_to(catalog_path(doc_id))
|
456
455
|
end
|
456
|
+
it "should send to the appropriate carrier email address" do
|
457
|
+
mock_mailer = double
|
458
|
+
allow(mock_mailer).to receive(:deliver)
|
459
|
+
expect(RecordMailer).to receive(:sms_record).with(anything, { to: '5555555555@txt.att.net' }, hash_including(:host => 'test.host')).and_return mock_mailer
|
460
|
+
post :sms, :id => doc_id, :to => '5555555555', :carrier => 'txt.att.net'
|
461
|
+
end
|
457
462
|
it "should redirect back to the record upon success" do
|
458
463
|
post :sms, :id => doc_id, :to => '5555555555', :carrier => 'txt.att.net'
|
459
464
|
expect(request.flash[:error]).to eq nil
|
@@ -75,12 +75,13 @@ describe 'Blacklight::Solr::FacetPaginator' do
|
|
75
75
|
it "should return all the items" do
|
76
76
|
expect(subject.items).to eq seven_facet_values
|
77
77
|
end
|
78
|
+
it { should be_last_page }
|
78
79
|
end
|
79
80
|
|
80
81
|
describe "#as_json" do
|
81
82
|
subject { Blacklight::Solr::FacetPaginator.new([f1], offset: 0, limit: nil).as_json }
|
82
83
|
it "should be well structured" do
|
83
|
-
expect(subject).to eq("items" => [{"hits"=>"792", "value"=>"Book"}], "limit" =>
|
84
|
+
expect(subject).to eq("items" => [{"hits"=>"792", "value"=>"Book"}], "limit" => nil,
|
84
85
|
"offset" => 0, "sort" => "count")
|
85
86
|
end
|
86
87
|
end
|
@@ -1224,9 +1224,8 @@ describe Blacklight::SolrHelper do
|
|
1224
1224
|
expect(subject.facet_limit_for("subject_topic_facet")).to be_nil
|
1225
1225
|
|
1226
1226
|
expect(subject.solr_search_params).not_to have_key(:"f.subject_topic_facet.facet.limit")
|
1227
|
-
|
1228
1227
|
end
|
1229
|
-
|
1228
|
+
|
1230
1229
|
describe "for 'true' configured values" do
|
1231
1230
|
let(:blacklight_config) do
|
1232
1231
|
config = Blacklight::Configuration.new
|
@@ -1249,6 +1248,9 @@ describe Blacklight::SolrHelper do
|
|
1249
1248
|
subject.instance_variable_set(:@response, @response)
|
1250
1249
|
expect(subject.facet_limit_for("language_facet")).to eq 15
|
1251
1250
|
end
|
1251
|
+
it "should default to 10" do
|
1252
|
+
expect(subject.facet_limit_for("language_facet")).to eq 10
|
1253
|
+
end
|
1252
1254
|
end
|
1253
1255
|
end
|
1254
1256
|
|
@@ -9,9 +9,12 @@ describe "Routing" do
|
|
9
9
|
it "should have a path for sending the email" do
|
10
10
|
expect(:post => "/catalog/email").to route_to(:controller => 'catalog', :action => 'email')
|
11
11
|
end
|
12
|
-
it "should map {:controller => 'catalog', :action => 'sms'} to /catalog/sms" do
|
12
|
+
it "should map GET {:controller => 'catalog', :action => 'sms'} to /catalog/sms" do
|
13
13
|
expect(:get => "/catalog/sms").to route_to(:controller => 'catalog', :action => 'sms')
|
14
14
|
end
|
15
|
+
it "should map POST {:controller => 'catalog', :action => 'sms'} to /catalog/sms" do
|
16
|
+
expect(:post => "/catalog/sms").to route_to(:controller => 'catalog', :action => 'sms')
|
17
|
+
end
|
15
18
|
it "should map { :controller => 'catalog', :action => 'show', :id => 666 } to /catalog/666" do
|
16
19
|
expect(:get => "/catalog/666").to route_to(:controller => 'catalog', :action => 'show', :id => "666")
|
17
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.5.
|
4
|
+
version: 5.5.3
|
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: 2014-07
|
20
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -555,7 +555,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
555
555
|
version: '0'
|
556
556
|
requirements: []
|
557
557
|
rubyforge_project:
|
558
|
-
rubygems_version: 2.
|
558
|
+
rubygems_version: 2.4.1
|
559
559
|
signing_key:
|
560
560
|
specification_version: 4
|
561
561
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|