blacklight_range_limit 6.5.0 → 7.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +5 -5
  2. data/.solr_wrapper.yml +0 -1
  3. data/.travis.yml +3 -4
  4. data/Gemfile +0 -4
  5. data/Rakefile +2 -0
  6. data/VERSION +1 -1
  7. data/app/assets/javascripts/blacklight_range_limit/range_limit_distro_facets.js +3 -4
  8. data/app/assets/javascripts/blacklight_range_limit/range_limit_shared.js +6 -6
  9. data/app/assets/javascripts/blacklight_range_limit/range_limit_slider.js +0 -1
  10. data/app/views/blacklight_range_limit/_range_limit_panel.html.erb +31 -33
  11. data/blacklight_range_limit.gemspec +5 -7
  12. data/lib/blacklight_range_limit.rb +1 -1
  13. data/lib/blacklight_range_limit/controller_override.rb +1 -16
  14. data/lib/blacklight_range_limit/engine.rb +1 -0
  15. data/lib/blacklight_range_limit/range_limit_builder.rb +19 -21
  16. data/lib/blacklight_range_limit/segment_calculation.rb +1 -3
  17. data/lib/blacklight_range_limit/view_helper_override.rb +39 -26
  18. data/lib/generators/blacklight_range_limit/assets_generator.rb +3 -0
  19. data/lib/generators/blacklight_range_limit/install_generator.rb +1 -1
  20. data/lib/tasks/blacklight_range_limit.rake +1 -1
  21. data/solr/conf/schema.xml +325 -564
  22. data/solr/conf/solrconfig.xml +78 -294
  23. data/solr/sample_solr_documents.yml +30 -30
  24. data/spec/features/blacklight_range_limit_spec.rb +12 -20
  25. data/spec/fixtures/solr_documents/zero_year.yml +2 -2
  26. data/spec/lib/blacklight_range_limit/segment_calculation_spec.rb +0 -14
  27. data/spec/spec_helper.rb +0 -15
  28. data/spec/test_app_templates/Gemfile.extra +1 -1
  29. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  30. metadata +18 -55
  31. data/spec/features/a_javascript_spec.rb +0 -25
  32. data/spec/lib/blacklight_range_limit/view_helper_override_helper_spec.rb +0 -127
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 454aced55fe12cf920d7f33fc5338f40707ae450e78f3863f2d99a7721c9dc40
4
- data.tar.gz: 19b80f76873f3a1a3e59ffaa7291c1f8d2f7af680a7979a8e3f3655adf716296
2
+ SHA1:
3
+ metadata.gz: 678418e9299f580737c1229110ba043559d6ab4b
4
+ data.tar.gz: d18f33c673d219e596b1ccf95f9fc51fe9e92fc2
5
5
  SHA512:
6
- metadata.gz: d8e45fed92431f1f46db61c9c76986f4552a7c01aba77aa1f85890cae4a8fc0dee42812ef4c4de0a11473653fceb1dc1e8a4f07588ae67761ecae6fa52410bab
7
- data.tar.gz: 2bf5fccb09e9f21de9c7a783e4f0e426d1eb5299010a0cea108619c30182d11d20e1df0ba58110d0f7ac036828fcdbd16e6dd243f50d8a1078a783f05317a049
6
+ metadata.gz: e7ecc681047532fdebde37e297ad35ffce54e0d0041902a7c1dba12b1f1ae9fba91ec24c82c2b2fd0be19a1e0a193327a0b6927f74f891cd51b612ee8173f1d6
7
+ data.tar.gz: ae23fa2040d85911a63019310fbc9c4d016ad6b761ae2d66b30de1e141cdea85e0ea20da06afcfc2c1945ebcdfce2f6faf095b506a487f0bba04d8d8d6d5efc9
@@ -1,7 +1,6 @@
1
1
  # Place any default configuration for solr_wrapper here
2
2
  port: 8983
3
3
  verbose: true
4
- version: 7.7.2
5
4
  collection:
6
5
  dir: solr/conf/
7
6
  name: blacklight-core
@@ -4,11 +4,10 @@ notifications:
4
4
  language: ruby
5
5
  sudo: false
6
6
  rvm:
7
- - 2.5.8
8
- - 2.6.5
7
+ - 2.3.1
9
8
 
10
9
  before_install:
11
- - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
10
+ - gem install bundler
12
11
 
13
12
  notifications:
14
13
  irc: "irc.freenode.org#blacklight"
@@ -18,4 +17,4 @@ notifications:
18
17
  global_env:
19
18
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
20
19
 
21
- jdk: oraclejdk9
20
+ jdk: oraclejdk8
data/Gemfile CHANGED
@@ -36,7 +36,3 @@ else
36
36
  end
37
37
  end
38
38
  # END ENGINE_CART BLOCK
39
-
40
- if File.exists?('spec/test_app_templates/Gemfile.extra')
41
- eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
42
- end
data/Rakefile CHANGED
@@ -6,6 +6,8 @@ require 'rspec/core/rake_task'
6
6
  require 'engine_cart/rake_task'
7
7
  require 'solr_wrapper'
8
8
 
9
+ EngineCart.fingerprint_proc = EngineCart.rails_fingerprint_proc
10
+
9
11
  task :default => :ci
10
12
 
11
13
  desc "Run specs"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.5.0
1
+ 7.0.0.rc1
@@ -1,5 +1,4 @@
1
1
  // for Blacklight.onLoad:
2
- //= require blacklight/core
3
2
 
4
3
  /* A custom event "plotDrawn.blacklight.rangeLimit" will be sent when flot plot
5
4
  is (re-)drawn on screen possibly with a new size. target of event will be the DOM element
@@ -199,14 +198,14 @@ Blacklight.onLoad(function() {
199
198
 
200
199
  find_segment_for = function_for_find_segment(pointer_lookup);
201
200
  var last_segment = null;
202
- $('.distribution').tooltip({'placement': 'bottom', 'trigger': 'manual', 'delay': { show: 0, hide: 100}});
201
+ $(container).tooltip({'placement': 'bottom', 'trigger': 'manual', 'delay': { show: 0, hide: 100}});
203
202
 
204
203
  $(container).bind("plothover", function (event, pos, item) {
205
204
  segment = find_segment_for(pos.x);
206
205
 
207
206
  if(segment != last_segment) {
208
207
  var title = find_segment_for(pos.x).label + ' (' + BlacklightRangeLimit.parseNum(segment.count) + ')';
209
- $('.distribution').attr("title", title).tooltip("fixTitle").tooltip("show");
208
+ $(container).attr("title", title).tooltip("_fixTitle").tooltip("show");
210
209
 
211
210
  last_segment = segment;
212
211
  }
@@ -214,7 +213,7 @@ Blacklight.onLoad(function() {
214
213
 
215
214
  $(container).bind("mouseout", function() {
216
215
  last_segment = null;
217
- $('.distribution').tooltip('hide');
216
+ $(container).tooltip('hide');
218
217
  });
219
218
  $(container).bind("plotclick", function (event, pos, item) {
220
219
  if ( plot.getSelection() == null) {
@@ -10,15 +10,15 @@
10
10
  this.options = options || {};
11
11
  }
12
12
 
13
- BlacklightRangeLimit.noConflict = function noConflict() {
14
- global.BlacklightRangeLimit = previousBlacklightRangeLimit;
15
- return BlacklightRangeLimit;
16
- };
17
-
18
13
  BlacklightRangeLimit.parseNum = function parseNum(str) {
19
14
  str = String(str).replace(/[^0-9]/g, '');
20
15
  return parseInt(str, 10);
21
16
  };
22
17
 
18
+ BlacklightRangeLimit.noConflict = function noConflict() {
19
+ global.BlacklightRangeLimit = previousBlacklightRangeLimit;
20
+ return BlacklightRangeLimit;
21
+ };
22
+
23
23
  global.BlacklightRangeLimit = BlacklightRangeLimit;
24
- }(this);
24
+ }(this);
@@ -1,5 +1,4 @@
1
1
  // for Blacklight.onLoad:
2
- //= require blacklight/core
3
2
 
4
3
  Blacklight.onLoad(function() {
5
4
 
@@ -1,19 +1,19 @@
1
1
  <%- # requires solr_config local passed in
2
- field_config = range_config(solr_field)
3
- label = facet_field_label(solr_field)
4
-
2
+ field_config = range_config(field_name)
3
+ label = facet_field_label(field_name)
4
+
5
5
  input_label_range_begin = field_config[:input_label_range_begin] || t("blacklight.range_limit.range_begin", field_label: label)
6
6
  input_label_range_end = field_config[:input_label_range_end] || t("blacklight.range_limit.range_end", field_label: label)
7
7
  maxlength = field_config[:maxlength]
8
8
  -%>
9
9
 
10
10
  <div class="limit_content range_limit">
11
- <% if has_selected_range_limit?(solr_field) %>
11
+ <% if has_selected_range_limit?(field_name) %>
12
12
  <ul class="current list-unstyled facet-values">
13
13
  <li class="selected">
14
14
  <span class="facet-label">
15
- <span class="selected"><%= range_display(solr_field) %></span>
16
- <%= link_to remove_range_param(solr_field), :class=>"remove", :title => t('blacklight.range_limit.remove_limit') do %>
15
+ <span class="selected"><%= range_display(field_name) %></span>
16
+ <%= link_to remove_range_param(field_name), :class=>"remove", :title => t('blacklight.range_limit.remove_limit') do %>
17
17
  <span class="glyphicon glyphicon-remove"></span>
18
18
  <span class="sr-only">[<%= t('blacklight.range_limit.remove_limit') %>]</span>
19
19
  <% end %>
@@ -21,64 +21,63 @@
21
21
  <span class="selected facet-count"><%= number_with_delimiter(@response.total) %></span>
22
22
  </li>
23
23
  </ul>
24
-
24
+
25
25
  <% end %>
26
26
 
27
- <% unless selected_missing_for_range_limit?(solr_field) %>
28
- <%= form_tag search_action_path, :method => :get, class: [BlacklightRangeLimit.classes[:form], "range_#{solr_field}"].join(' ') do %>
27
+ <% unless selected_missing_for_range_limit?(field_name) %>
28
+ <%= form_tag search_action_path, :method => :get, class: [BlacklightRangeLimit.classes[:form], "range_#{field_name}"].join(' ') do %>
29
29
  <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:page)) %>
30
-
30
+
31
31
  <!-- we need to include a dummy search_field parameter if none exists,
32
32
  to trick blacklight into displaying actual search results instead
33
33
  of home page. Not a great solution, but easiest for now. -->
34
34
  <% unless params.has_key?(:search_field) %>
35
35
  <%= hidden_field_tag("search_field", "dummy_range") %>
36
36
  <% end %>
37
-
38
- <%= render_range_input(solr_field, :begin, input_label_range_begin, maxlength) %> – <%= render_range_input(solr_field, :end, input_label_range_end, maxlength) %>
37
+
38
+ <%= render_range_input(field_name, :begin, input_label_range_begin, maxlength) %> – <%= render_range_input(field_name, :end, input_label_range_end, maxlength) %>
39
39
  <%= submit_tag t('blacklight.range_limit.submit_limit'), class: BlacklightRangeLimit.classes[:submit] %>
40
-
41
40
  <% end %>
42
41
  <% end %>
43
-
42
+
44
43
  <!-- no results profile if missing is selected -->
45
- <% unless selected_missing_for_range_limit?(solr_field) %>
44
+ <% unless selected_missing_for_range_limit?(field_name) %>
46
45
  <!-- you can hide this if you want, but it has to be on page if you want
47
46
  JS slider and calculated facets to show up, JS sniffs it. -->
48
47
  <div class="profile">
49
- <% if stats_for_field?(solr_field) %>
48
+ <% if stats_for_field?(field_name) %>
50
49
  <!-- No stats information found for field in search response -->
51
50
  <% end %>
52
51
 
53
- <% if (min = range_results_endpoint(solr_field, :min)) &&
54
- (max = range_results_endpoint(solr_field, :max)) %>
52
+ <% if (min = range_results_endpoint(field_name, :min)) &&
53
+ (max = range_results_endpoint(field_name, :max)) %>
55
54
  <p class="range subsection <%= "slider_js" unless field_config[:slider_js] == false %>">
56
- Current results range from <span class="min"><%= range_results_endpoint(solr_field, :min) %></span> to <span class="max"><%= range_results_endpoint(solr_field, :max) %></span>
55
+ Current results range from <span class="min"><%= range_results_endpoint(field_name, :min) %></span> to <span class="max"><%= range_results_endpoint(field_name, :max) %></span>
57
56
  </p>
58
-
57
+
59
58
  <% if field_config[:segments] != false %>
60
59
  <div class="distribution subsection <%= 'chart_js' unless field_config[:chart_js] == false %>">
61
60
  <!-- if we already fetched segments from solr, display them
62
61
  here. Otherwise, display a link to fetch them, which JS
63
62
  will AJAX fetch. -->
64
- <% if solr_range_queries_to_a(solr_field).length > 0 %>
65
-
66
- <%= render(:partial => "blacklight_range_limit/range_segments", :locals => {:solr_field => solr_field}) %>
67
-
68
- <% else %>
69
- <%= link_to('View distribution', main_app.url_for(search_state.to_h.merge(action: 'range_limit', range_field: solr_field, range_start: min, range_end: max)), :class => "load_distribution") %>
63
+ <% if solr_range_queries_to_a(field_name).length > 0 %>
64
+
65
+ <%= render(:partial => "blacklight_range_limit/range_segments", :locals => {:solr_field => field_name}) %>
66
+
67
+ <% else %>
68
+ <%= link_to('View distribution', main_app.url_for(search_state.to_h.merge(action: 'range_limit', range_field: field_name, range_start: min, range_end: max)), :class => "load_distribution") %>
70
69
  <% end %>
71
70
  </div>
72
- <% end %>
71
+ <% end %>
73
72
  <% end %>
74
-
75
-
76
-
77
- <% if (stats = stats_for_field(solr_field)) && stats["missing"] > 0 %>
73
+
74
+
75
+
76
+ <% if (stats = stats_for_field(field_name)) && stats["missing"] > 0 %>
78
77
  <ul class="missing list-unstyled facet-values subsection">
79
78
  <li>
80
79
  <span class="facet-label">
81
- <%= link_to BlacklightRangeLimit.labels[:missing], add_range_missing(solr_field) %>
80
+ <%= link_to BlacklightRangeLimit.labels[:missing], add_range_missing(field_name) %>
82
81
  </span>
83
82
  <span class="facet-count">
84
83
  <%= number_with_delimiter(stats["missing"]) %>
@@ -89,4 +88,3 @@
89
88
  </div>
90
89
  <% end %>
91
90
  </div>
92
-
@@ -17,18 +17,16 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.license = 'Apache 2.0'
19
19
 
20
- s.add_dependency 'rails', '>= 4.2', '< 6'
20
+ s.add_dependency 'rails', '>= 3.0'
21
21
  s.add_dependency 'jquery-rails' # our JS needs jquery_rails
22
- s.add_dependency 'blacklight', '~> 6.10'
22
+ s.add_dependency 'blacklight'
23
+ s.add_dependency 'tether-rails'
23
24
 
24
- s.add_development_dependency 'chromedriver-helper'
25
25
  s.add_development_dependency 'rspec', '~> 3.0'
26
26
  s.add_development_dependency 'rspec-rails'
27
27
  s.add_development_dependency 'capybara'
28
28
  s.add_development_dependency 'sqlite3'
29
29
  s.add_development_dependency 'launchy'
30
- s.add_development_dependency 'selenium-webdriver'
31
- s.add_development_dependency 'solr_wrapper', '~> 2.2'
32
- s.add_development_dependency 'engine_cart', '~> 2.0'
33
- s.add_development_dependency 'webdrivers'
30
+ s.add_development_dependency 'solr_wrapper', '~> 0.14'
31
+ s.add_development_dependency 'engine_cart', '~> 1.0'
34
32
  end
@@ -19,7 +19,7 @@ module BlacklightRangeLimit
19
19
  }
20
20
  self.classes = {
21
21
  form: 'range_limit subsection form-inline',
22
- submit: 'submit btn btn-default'
22
+ submit: 'submit btn btn-secondary'
23
23
  }
24
24
 
25
25
  # Add element to array only if it's not already there
@@ -9,7 +9,6 @@ module BlacklightRangeLimit
9
9
  included do
10
10
  helper BlacklightRangeLimit::ViewHelperOverride
11
11
  helper RangeLimitHelper
12
- helper_method :has_range_limit_parameters?
13
12
  end
14
13
 
15
14
  # Action method of our own!
@@ -23,24 +22,10 @@ module BlacklightRangeLimit
23
22
  # field (with start/end params) mentioned in query params
24
23
  # range_field, range_start, and range_end
25
24
 
26
- @response, _ = search_results(params) do |search_builder|
25
+ @response, _ = search_service.search_results do |search_builder|
27
26
  search_builder.except(:add_range_limit_params).append(:fetch_specific_range_limit)
28
27
  end
29
-
30
28
  render('blacklight_range_limit/range_segments', :locals => {:solr_field => params[:range_field]}, :layout => !request.xhr?)
31
29
  end
32
-
33
- # over-ride, call super, but make sure our range limits count too
34
- def has_search_parameters?
35
- super || has_range_limit_parameters?
36
- end
37
-
38
- def has_range_limit_parameters?(my_params = params)
39
- my_params[:range] &&
40
- my_params[:range].to_unsafe_h.any? do |key, v|
41
- v.present? && v.respond_to?(:'[]') &&
42
- (v["begin"].present? || v["end"].present? || v["missing"].present?)
43
- end
44
- end
45
30
  end
46
31
  end
@@ -2,6 +2,7 @@ require 'blacklight'
2
2
  require 'blacklight_range_limit'
3
3
  require 'rails'
4
4
  require 'jquery-rails'
5
+ require 'tether-rails'
5
6
 
6
7
  module BlacklightRangeLimit
7
8
  class Engine < Rails::Engine
@@ -12,48 +12,46 @@ module BlacklightRangeLimit
12
12
 
13
13
  # Method added to to fetch proper things for date ranges.
14
14
  def add_range_limit_params(solr_params)
15
- ranged_facet_configs =
16
- blacklight_config.facet_fields.select { |key, config| config.range }
15
+ ranged_facet_configs =
16
+ blacklight_config.facet_fields.select { |key, config| config.range }
17
17
  # In ruby 1.8, hash.select returns an array of pairs, in ruby 1.9
18
- # it returns a hash. Turn it into a hash either way.
18
+ # it returns a hash. Turn it into a hash either way.
19
19
  ranged_facet_configs = Hash[ ranged_facet_configs ] unless ranged_facet_configs.kind_of?(Hash)
20
-
20
+
21
21
  ranged_facet_configs.each_pair do |solr_field, config|
22
22
  solr_params["stats"] = "true"
23
23
  solr_params["stats.field"] ||= []
24
- solr_params["stats.field"] << solr_field
25
-
26
- range_config = BlacklightRangeLimit.range_config(blacklight_config, config.field)
27
-
24
+ solr_params["stats.field"] << solr_field
25
+
28
26
  hash = blacklight_params["range"] && blacklight_params["range"][solr_field] ?
29
27
  blacklight_params["range"][solr_field] :
30
28
  {}
31
-
29
+
32
30
  if !hash["missing"].blank?
33
31
  # missing specified in request params
34
32
  solr_params[:fq] ||= []
35
33
  solr_params[:fq] << "-#{solr_field}:[* TO *]"
36
-
34
+
37
35
  elsif !(hash["begin"].blank? && hash["end"].blank?)
38
36
  # specified in request params, begin and/or end, might just have one
39
37
  start = hash["begin"].blank? ? "*" : hash["begin"]
40
38
  finish = hash["end"].blank? ? "*" : hash["end"]
41
-
39
+
42
40
  solr_params[:fq] ||= []
43
41
  solr_params[:fq] << "#{solr_field}: [#{start} TO #{finish}]"
44
-
45
- if (range_config[:segments] != false && start != "*" && finish != "*")
42
+
43
+ if (config.segments != false && start != "*" && finish != "*")
46
44
  # Add in our calculated segments, can only do with both boundaries.
47
45
  add_range_segments_to_solr!(solr_params, solr_field, start.to_i, finish.to_i)
48
46
  end
49
-
50
- elsif (range_config[:segments] != false &&
51
- boundaries = range_config[:assumed_boundaries])
47
+
48
+ elsif (config.segments != false &&
49
+ boundaries = config.assumed_boundaries)
52
50
  # assumed_boundaries in config
53
51
  add_range_segments_to_solr!(solr_params, solr_field, boundaries[0], boundaries[1])
54
52
  end
55
53
  end
56
-
54
+
57
55
  return solr_params
58
56
  end
59
57
 
@@ -61,10 +59,10 @@ module BlacklightRangeLimit
61
59
  # Another processing method, this one is NOT included in default processing chain,
62
60
  # it is specifically swapped in *instead of* add_range_limit_params for
63
61
  # certain ajax requests that only want to fetch range limit segments for
64
- # ONE field.
62
+ # ONE field.
65
63
  #
66
64
  # It turns off facetting and sets rows to 0 as well, only results for
67
- # single specified field are needed.
65
+ # single specified field are needed.
68
66
  #
69
67
  # Specified field and parameters are specified in incoming parameters
70
68
  # range_field, range_start, range_end
@@ -74,13 +72,13 @@ module BlacklightRangeLimit
74
72
  finish = blacklight_params[:range_end].to_i
75
73
 
76
74
  add_range_segments_to_solr!(solr_params, solr_field, start, finish )
77
-
75
+
78
76
  # Remove all field faceting for efficiency, we won't be using it.
79
77
  solr_params.delete("facet.field")
80
78
  solr_params.delete("facet.field".to_sym)
81
79
 
82
80
  # We don't need any actual rows either
83
- solr_params[:rows] = 0
81
+ solr_params[:rows] = 0
84
82
 
85
83
  return solr_params
86
84
  end
@@ -16,8 +16,6 @@ module BlacklightRangeLimit
16
16
 
17
17
  field_config = BlacklightRangeLimit.range_config(blacklight_config, solr_field)
18
18
 
19
- return solr_params unless field_config
20
-
21
19
  solr_params[:"facet.query"] ||= []
22
20
 
23
21
  boundaries = boundaries_for_range_facets(min, max, (field_config[:num_segments] || 10) )
@@ -30,7 +28,7 @@ module BlacklightRangeLimit
30
28
  solr_params[:"facet.query"] << "#{solr_field}:[#{first} TO #{last}]"
31
29
  end
32
30
 
33
- solr_params
31
+ return solr_params
34
32
  end
35
33
 
36
34
  # returns an array of 'boundaries' for producing approx num_div
@@ -11,6 +11,19 @@
11
11
  super
12
12
  end
13
13
 
14
+ def has_range_limit_parameters?(my_params = params)
15
+ my_params[:range] &&
16
+ my_params[:range].to_unsafe_h.any? do |key, v|
17
+ v.present? && v.respond_to?(:'[]') &&
18
+ (v["begin"].present? || v["end"].present? || v["missing"].present?)
19
+ end
20
+ end
21
+
22
+ # over-ride, call super, but make sure our range limits count too
23
+ def has_search_parameters?
24
+ super || has_range_limit_parameters?
25
+ end
26
+
14
27
  def query_has_constraints?(my_params = params)
15
28
  super || has_range_limit_parameters?(my_params)
16
29
  end
@@ -29,26 +42,39 @@
29
42
  end
30
43
 
31
44
  def render_constraints_filters(my_params = params)
45
+ content = super(my_params)
32
46
  # add a constraint for ranges?
33
- range_params(my_params).keys.each_with_object(super) do |solr_field, content|
34
- content << render_constraint_element(
35
- facet_field_label(solr_field),
36
- range_display(solr_field, my_params),
37
- escape_value: false,
38
- remove: remove_range_param(solr_field, my_params)
39
- )
47
+ unless my_params[:range].blank?
48
+ my_params[:range].each_pair do |solr_field, hash|
49
+
50
+ next unless hash["missing"] || (!hash["begin"].blank?) || (!hash["end"].blank?)
51
+ content << render_constraint_element(
52
+ facet_field_label(solr_field),
53
+ range_display(solr_field, my_params),
54
+ :escape_value => false,
55
+ :remove => remove_range_param(solr_field, my_params)
56
+ )
57
+ end
40
58
  end
59
+ return content
41
60
  end
42
61
 
43
62
  def render_search_to_s_filters(my_params)
63
+ content = super(my_params)
44
64
  # add a constraint for ranges?
45
- range_params(my_params).keys.each_with_object(super) do |solr_field, content|
46
- content << render_search_to_s_element(
47
- facet_field_label(solr_field),
48
- range_display(solr_field, my_params),
49
- escape_value: false
50
- )
65
+ unless my_params[:range].blank?
66
+ my_params[:range].each_pair do |solr_field, hash|
67
+ next unless hash["missing"] || (!hash["begin"].blank?) || (! hash["end"].blank?)
68
+
69
+ content << render_search_to_s_element(
70
+ facet_field_label(solr_field),
71
+ range_display(solr_field, my_params),
72
+ :escape_value => false
73
+ )
74
+
75
+ end
51
76
  end
77
+ return content
52
78
  end
53
79
 
54
80
  def remove_range_param(solr_field, my_params = params)
@@ -84,17 +110,4 @@
84
110
  BlacklightRangeLimit.range_config(blacklight_config, solr_field)
85
111
  end
86
112
 
87
- private
88
-
89
- def range_params(my_params = params)
90
- return {} unless my_params[:range].is_a?(ActionController::Parameters) || my_params[:range].is_a?(Hash)
91
-
92
- my_params[:range].select do |_solr_field, range_options|
93
- next unless range_options
94
-
95
- [range_options['missing'].presence,
96
- range_options['begin'].presence,
97
- range_options['end'].presence].any?
98
- end
99
- end
100
113
  end