blacklight_range_limit 5.0.2 → 5.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight_range_limit/range_limit_slider.js +8 -2
- data/app/views/blacklight_range_limit/_range_limit_panel.html.erb +3 -3
- data/config/locales/blacklight_range_limit.en.yml +2 -0
- data/lib/generators/blacklight_range_limit/blacklight_range_limit_generator.rb +0 -1
- data/lib/tasks/blacklight_range_limit.rake +10 -0
- data/spec/features/blacklight_range_limit_spec.rb +8 -14
- data/spec/fixtures/solr_documents/zero_year.yml +3 -0
- data/spec/helpers/blacklight_range_limit_helper_spec.rb +5 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +11 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfbd60cfa11906f880033d02aa35b34cda312d3a
|
4
|
+
data.tar.gz: 658444bdfca712dec061edb48cd0ddf9066b12a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fe6f9b7a91a2f2e6395f47d10e032f09f9026bfdfee2d4135a17523c317ec69b7e172ed338ed5d6a4cceeb36d3339ae02e9783f6ccf96756748e5f622aa7581
|
7
|
+
data.tar.gz: 930d57f88f318fa4273580b80f1771deec6a44540a628ef1e7d2e1e3757f5c628052aec86f48c5b540d3c8a251babadf4822caa58f8b9e7da0b1cb825f31ebf0
|
data/.travis.yml
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.0.
|
1
|
+
5.0.3
|
@@ -10,7 +10,7 @@ $(".range_limit .profile .range.slider_js").each(function() {
|
|
10
10
|
var min = boundaries[0];
|
11
11
|
var max = boundaries[1];
|
12
12
|
|
13
|
-
if (min && max) {
|
13
|
+
if (isInt(min) && isInt(max)) {
|
14
14
|
$(this).contents().wrapAll('<div style="display:none" />');
|
15
15
|
|
16
16
|
var range_element = $(this);
|
@@ -46,7 +46,6 @@ $(".range_limit .profile .range.slider_js").each(function() {
|
|
46
46
|
}
|
47
47
|
}
|
48
48
|
|
49
|
-
|
50
49
|
begin_el.val(min);
|
51
50
|
end_el.val(max);
|
52
51
|
|
@@ -112,4 +111,11 @@ function min_max(range_element) {
|
|
112
111
|
return [min, max]
|
113
112
|
}
|
114
113
|
|
114
|
+
|
115
|
+
// Check to see if a value is an Integer
|
116
|
+
// see: http://stackoverflow.com/questions/3885817/how-to-check-if-a-number-is-float-or-integer
|
117
|
+
function isInt(n) {
|
118
|
+
return n % 1 === 0;
|
119
|
+
}
|
120
|
+
|
115
121
|
});
|
@@ -17,9 +17,9 @@
|
|
17
17
|
<li class="selected">
|
18
18
|
<span class="facet-label">
|
19
19
|
<span class="selected"><%= range_display(solr_field) %></span>
|
20
|
-
<%= link_to remove_range_param(solr_field), :class=>"remove", :title =>
|
20
|
+
<%= link_to remove_range_param(solr_field), :class=>"remove", :title => t('blacklight.range_limit.remove_limit') do %>
|
21
21
|
<span class="glyphicon glyphicon-remove"></span>
|
22
|
-
<span class="sr-only">[
|
22
|
+
<span class="sr-only">[<%= t('blacklight.range_limit.remove_limit') %>]</span>
|
23
23
|
<% end %>
|
24
24
|
</span>
|
25
25
|
<span class="selected facet-count"><%= number_with_delimiter(@response.total) %></span>
|
@@ -40,7 +40,7 @@
|
|
40
40
|
<% end %>
|
41
41
|
|
42
42
|
<%= render_range_input(solr_field, :begin, input_label_range_begin) %> – <%= render_range_input(solr_field, :end, input_label_range_end) %>
|
43
|
-
<%= submit_tag '
|
43
|
+
<%= submit_tag t('blacklight.range_limit.submit_limit'), :class=>'submit btn btn-default' %>
|
44
44
|
|
45
45
|
<% end %>
|
46
46
|
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
namespace :blacklight_range_limit do
|
4
|
+
desc 'Add in additional Solr docs'
|
5
|
+
task seed: :environment do
|
6
|
+
docs = Dir['spec/fixtures/solr_documents/*.yml'].map { |f| YAML.load File.read(f) }.flatten
|
7
|
+
Blacklight.solr.add docs
|
8
|
+
Blacklight.solr.commit
|
9
|
+
end
|
10
|
+
end
|
@@ -1,36 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "Blacklight Range Limit" do
|
4
|
-
before do
|
5
|
-
CatalogController.blacklight_config = Blacklight::Configuration.new
|
6
|
-
CatalogController.configure_blacklight do |config|
|
7
|
-
config.add_facet_field 'pub_date_sort', :label => 'Publication Date Sort', :range => true
|
8
|
-
config.default_solr_params[:'facet.field'] = config.facet_fields.keys
|
9
|
-
end
|
10
|
-
end
|
11
4
|
|
12
5
|
it "should show the range limit facet" do
|
13
|
-
visit
|
6
|
+
visit catalog_index_path
|
14
7
|
page.should have_selector 'input.range_begin'
|
15
8
|
page.should have_selector 'input.range_end'
|
16
9
|
page.should have_selector 'label.sr-only[for="range_pub_date_sort_begin"]', :text => 'Publication Date Sort range begin'
|
17
10
|
page.should have_selector 'label.sr-only[for="range_pub_date_sort_end"]', :text => 'Publication Date Sort range end'
|
11
|
+
expect(page).to have_css 'input.submit', value: 'Limit'
|
18
12
|
end
|
19
13
|
|
20
14
|
it "should provide distribution information" do
|
21
|
-
visit
|
15
|
+
visit catalog_index_path
|
22
16
|
click_link 'View distribution'
|
23
17
|
|
24
|
-
page.should have_content("
|
25
|
-
page.should have_content("
|
18
|
+
page.should have_content("1500 to 1599 0")
|
19
|
+
page.should have_content("2000 to 2008 12")
|
26
20
|
end
|
27
21
|
|
28
22
|
it "should limit appropriately" do
|
29
|
-
visit
|
23
|
+
visit catalog_index_path
|
30
24
|
click_link 'View distribution'
|
31
|
-
click_link '
|
25
|
+
click_link '2000 to 2008'
|
32
26
|
|
33
|
-
page.should have_content "
|
27
|
+
page.should have_content "2000 to 2008 [remove] 12"
|
34
28
|
end
|
35
29
|
end
|
36
30
|
|
@@ -2,9 +2,11 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe "Blacklight Range Limit Helper" do
|
4
4
|
|
5
|
-
it "should render range text fields with/without labels" do
|
6
|
-
|
7
|
-
|
5
|
+
it "should render range text fields with/without labels" do
|
6
|
+
begin_html = Capybara.string(helper.render_range_input('pub_date', 'begin'))
|
7
|
+
begin_from_pub_html = Capybara.string(helper.render_range_input('pub_date', 'begin', 'from pub date'))
|
8
|
+
expect(begin_html).to have_css 'input.form-control.range_begin#range_pub_date_begin'
|
9
|
+
expect(begin_from_pub_html).to have_css 'label.sr-only[for="range_pub_date_begin"]'
|
8
10
|
end
|
9
11
|
|
10
12
|
end
|
@@ -19,4 +19,15 @@ class TestAppGenerator < Rails::Generators::Base
|
|
19
19
|
|
20
20
|
generate 'blacklight_range_limit'
|
21
21
|
end
|
22
|
+
|
23
|
+
def fixtures
|
24
|
+
FileUtils.mkdir_p 'spec/fixtures/solr_documents'
|
25
|
+
directory 'solr_documents', 'spec/fixtures/solr_documents'
|
26
|
+
end
|
27
|
+
|
28
|
+
def inject_into_catalog_controller
|
29
|
+
inject_into_file 'app/controllers/catalog_controller.rb', after: "config.add_facet_field 'example_pivot_field', :label => 'Pivot Field', :pivot => ['format', 'language_facet']" do
|
30
|
+
"\n config.add_facet_field 'pub_date_sort', :label => 'Publication Date Sort', :range => true"
|
31
|
+
end
|
32
|
+
end
|
22
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_range_limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -193,7 +193,9 @@ files:
|
|
193
193
|
- lib/blacklight_range_limit/view_helper_override.rb
|
194
194
|
- lib/generators/blacklight_range_limit/assets_generator.rb
|
195
195
|
- lib/generators/blacklight_range_limit/blacklight_range_limit_generator.rb
|
196
|
+
- lib/tasks/blacklight_range_limit.rake
|
196
197
|
- spec/features/blacklight_range_limit_spec.rb
|
198
|
+
- spec/fixtures/solr_documents/zero_year.yml
|
197
199
|
- spec/helpers/blacklight_range_limit_helper_spec.rb
|
198
200
|
- spec/spec_helper.rb
|
199
201
|
- spec/test_app_templates/Gemfile.extra
|
@@ -229,6 +231,7 @@ specification_version: 4
|
|
229
231
|
summary: Blacklight Range Limit plugin
|
230
232
|
test_files:
|
231
233
|
- spec/features/blacklight_range_limit_spec.rb
|
234
|
+
- spec/fixtures/solr_documents/zero_year.yml
|
232
235
|
- spec/helpers/blacklight_range_limit_helper_spec.rb
|
233
236
|
- spec/spec_helper.rb
|
234
237
|
- spec/test_app_templates/Gemfile.extra
|