blacklight_range_limit 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 34d5e12f33dab6b85a0a6124a1debc14c3ee422f
4
+ data.tar.gz: 696ebe4c0d178bfc0b6d1923be6863d2a6694a1f
5
+ SHA512:
6
+ metadata.gz: 7343e933270b6409e504b5d1dcb3476018c888f63539a0f9fe8c4720503aa6abdc9744d418cb8f1c4cb00115c86b16e395ac4d5285352c2cb708fab04fc2515c
7
+ data.tar.gz: 894027d5d73feb173af418b104e2b81810c4146acd119508d4e54282e011b1e5091e751800c56e9003e8f0fff9f83206d6edd3e39f07321222cea50b18fe09e9
data/Gemfile CHANGED
@@ -11,6 +11,17 @@ group :test do
11
11
  gem 'turbolinks'
12
12
  end
13
13
 
14
+ gem 'sass-rails'
15
+ # If we don't specify 2.11.0 we'll end up with sprockets 2.12.0 in the main
16
+ # Gemfile.lock but since sass-rails gets generated (rails new) into the test app
17
+ # it'll want sprockets 2.11.0 and we'll have a conflict
18
+ gem 'sprockets', '2.11.0'
19
+
20
+ # If we don't specify 3.2.15 we'll end up with sass 3.3.2 in the main
21
+ # Gemfile.lock but since sass-rails gets generated (rails new) into the test app
22
+ # it'll want sass 3.2.0 and we'll have a conflict
23
+ gem 'sass', '~> 3.2.0'
24
+
14
25
  if File.exists?('spec/test_app_templates/Gemfile.extra')
15
26
  eval File.read('spec/test_app_templates/Gemfile.extra'), nil, 'spec/test_app_templates/Gemfile.extra'
16
27
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.0.1
1
+ 5.0.2
@@ -2,12 +2,14 @@
2
2
  module RangeLimitHelper
3
3
 
4
4
  # type is 'begin' or 'end'
5
- def render_range_input(solr_field, type)
5
+ def render_range_input(solr_field, type, input_label = nil)
6
6
  type = type.to_s
7
-
7
+
8
8
  default = params["range"][solr_field][type] if params["range"] && params["range"][solr_field] && params["range"][solr_field][type]
9
-
10
- text_field_tag("range[#{solr_field}][#{type}]", default, :maxlength=>4, :class => "form-control range_#{type}")
9
+
10
+ html = label_tag("range[#{solr_field}][#{type}]", input_label, class: 'sr-only') if input_label.present?
11
+ html ||= ''.html_safe
12
+ html += text_field_tag("range[#{solr_field}][#{type}]", default, :maxlength=>4, :class => "form-control range_#{type}")
11
13
  end
12
14
 
13
15
  # type is 'min' or 'max'
@@ -88,8 +90,8 @@ module RangeLimitHelper
88
90
  my_params.delete("range_field")
89
91
  my_params.delete("range_start")
90
92
  my_params.delete("range_end")
91
-
93
+
92
94
  return my_params
93
95
  end
94
-
96
+
95
97
  end
@@ -1,6 +1,10 @@
1
1
  <%- # requires solr_config local passed in
2
2
 
3
- field_config = range_config(solr_field)
3
+ field_config = range_config(solr_field)
4
+ label = blacklight_config.facet_fields[solr_field].label
5
+
6
+ input_label_range_begin = field_config[:input_label_range_begin] || t("blacklight.range_limit.range_begin", field_label: label)
7
+ input_label_range_end = field_config[:input_label_range_end] || t("blacklight.range_limit.range_end", field_label: label)
4
8
  -%>
5
9
 
6
10
  <div class="limit_content range_limit">
@@ -35,7 +39,7 @@
35
39
  <%= hidden_field_tag("search_field", "dummy_range") %>
36
40
  <% end %>
37
41
 
38
- <%= render_range_input(solr_field, :begin) %> – <%= render_range_input(solr_field, :end) %>
42
+ <%= render_range_input(solr_field, :begin, input_label_range_begin) %> – <%= render_range_input(solr_field, :end, input_label_range_end) %>
39
43
  <%= submit_tag 'Limit', :class=>'submit btn btn-default' %>
40
44
 
41
45
  <% end %>
@@ -0,0 +1,5 @@
1
+ en:
2
+ blacklight:
3
+ range_limit:
4
+ range_begin: "%{field_label} range begin"
5
+ range_end: "%{field_label} range end"
@@ -1,4 +1,4 @@
1
- # Copy BlacklightRangeLimit assets to public folder in current app.
1
+ # Copy BlacklightRangeLimit assets to public folder in current app.
2
2
  # If you want to do this on application startup, you can
3
3
  # add this next line to your one of your environment files --
4
4
  # generally you'd only want to do this in 'development', and can
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
  # Need the requires here so we can call the generator from environment.rb
11
- # as suggested above.
11
+ # as suggested above.
12
12
  require 'rails/generators'
13
13
  require 'rails/generators/base'
14
14
  module BlacklightRangeLimit
@@ -16,7 +16,7 @@ module BlacklightRangeLimit
16
16
  source_root File.join(BlacklightRangeLimit::Engine.root, 'app', 'assets')
17
17
 
18
18
  def assets
19
- application_css = Dir["app/assets/stylesheets/application{.css,.scss,.css.scs}"].first
19
+ application_css = Dir["app/assets/stylesheets/application{.css,.scss,.css.scss}"].first
20
20
 
21
21
  if application_css
22
22
 
@@ -25,7 +25,7 @@ module BlacklightRangeLimit
25
25
  *
26
26
  * Used by blacklight_range_limit
27
27
  *= require 'blacklight_range_limit'
28
- *
28
+ *
29
29
  }
30
30
  end
31
31
  else
@@ -39,12 +39,11 @@ module BlacklightRangeLimit
39
39
  // this:
40
40
  //= require 'blacklight_range_limit'
41
41
 
42
- }
42
+ }
43
43
  end
44
44
  end
45
-
45
+
46
46
 
47
47
 
48
48
  end
49
49
  end
50
-
@@ -4,16 +4,17 @@ describe "Blacklight Range Limit" do
4
4
  before do
5
5
  CatalogController.blacklight_config = Blacklight::Configuration.new
6
6
  CatalogController.configure_blacklight do |config|
7
- config.add_facet_field 'pub_date_sort', :range => true
7
+ config.add_facet_field 'pub_date_sort', :label => 'Publication Date Sort', :range => true
8
8
  config.default_solr_params[:'facet.field'] = config.facet_fields.keys
9
9
  end
10
-
11
10
  end
12
11
 
13
12
  it "should show the range limit facet" do
14
13
  visit '/catalog'
15
14
  page.should have_selector 'input.range_begin'
16
15
  page.should have_selector 'input.range_end'
16
+ page.should have_selector 'label.sr-only[for="range_pub_date_sort_begin"]', :text => 'Publication Date Sort range begin'
17
+ page.should have_selector 'label.sr-only[for="range_pub_date_sort_end"]', :text => 'Publication Date Sort range end'
17
18
  end
18
19
 
19
20
  it "should provide distribution information" do
@@ -32,3 +33,23 @@ describe "Blacklight Range Limit" do
32
33
  page.should have_content "1941 to 1944 [remove] 1"
33
34
  end
34
35
  end
36
+
37
+ describe "Blacklight Range Limit with configured input labels" do
38
+ before do
39
+ CatalogController.blacklight_config = Blacklight::Configuration.new
40
+ CatalogController.configure_blacklight do |config|
41
+ config.add_facet_field 'pub_date_sort', :range => {
42
+ :input_label_range_begin => 'from publication date',
43
+ :input_label_range_end => 'to publication date'
44
+ }
45
+ config.default_solr_params[:'facet.field'] = config.facet_fields.keys
46
+ end
47
+ end
48
+
49
+ it "should show the range limit facet" do
50
+ visit '/catalog'
51
+ page.should have_selector 'label.sr-only[for="range_pub_date_sort_begin"]', :text => 'from publication date'
52
+ page.should have_selector 'label.sr-only[for="range_pub_date_sort_end"]', :text => 'to publication date'
53
+ end
54
+
55
+ end
@@ -0,0 +1,10 @@
1
+ require "spec_helper"
2
+
3
+ describe "Blacklight Range Limit Helper" do
4
+
5
+ it "should render range text fields with/without labels" do
6
+ expect(helper.render_range_input('pub_date', 'begin')).to match /^<input class=\"form-control range_begin\" id=\"range_pub_date_begin\" maxlength=\"4\"/
7
+ expect(helper.render_range_input('pub_date', 'begin', 'from pub date')).to match /^<label class=\"sr-only\" for=\"range_pub_date_begin\">from pub date<\/label>/
8
+ end
9
+
10
+ end
@@ -19,7 +19,6 @@ group :test do
19
19
  gem 'capybara'
20
20
  end
21
21
  gem 'simplecov', :platform => :mri_19
22
- gem 'simplecov-rcov', :platform => :mri_19
23
22
  end
24
23
 
25
24
  gem 'jettywrapper', '>= 1.2.0'
@@ -3,8 +3,9 @@ require 'rails/generators'
3
3
  class TestAppGenerator < Rails::Generators::Base
4
4
  source_root File.expand_path("../../../../test_app_templates", __FILE__)
5
5
 
6
- def copy_blacklight_test_app_rake_task
7
- copy_file "lib/tasks/blacklight_test_app.rake"
6
+ # This is only necessary for Rails 3
7
+ def remove_index
8
+ remove_file "public/index.html"
8
9
  end
9
10
 
10
11
  def run_blacklight_generator
metadata CHANGED
@@ -1,8 +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.1
5
- prerelease:
4
+ version: 5.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jonathan Rochkind
@@ -10,168 +9,150 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-03-10 00:00:00.000000000 Z
12
+ date: 2014-08-13 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '3.0'
23
- - - <
21
+ - - "<"
24
22
  - !ruby/object:Gem::Version
25
23
  version: '5.0'
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ! '>='
28
+ - - ">="
32
29
  - !ruby/object:Gem::Version
33
30
  version: '3.0'
34
- - - <
31
+ - - "<"
35
32
  - !ruby/object:Gem::Version
36
33
  version: '5.0'
37
34
  - !ruby/object:Gem::Dependency
38
35
  name: jquery-rails
39
36
  requirement: !ruby/object:Gem::Requirement
40
- none: false
41
37
  requirements:
42
- - - ! '>='
38
+ - - ">="
43
39
  - !ruby/object:Gem::Version
44
40
  version: '0'
45
41
  type: :runtime
46
42
  prerelease: false
47
43
  version_requirements: !ruby/object:Gem::Requirement
48
- none: false
49
44
  requirements:
50
- - - ! '>='
45
+ - - ">="
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
48
  - !ruby/object:Gem::Dependency
54
49
  name: blacklight
55
50
  requirement: !ruby/object:Gem::Requirement
56
- none: false
57
51
  requirements:
58
- - - ! '>='
52
+ - - ">="
59
53
  - !ruby/object:Gem::Version
60
54
  version: 5.0.0.pre4
61
- - - <
55
+ - - "<"
62
56
  - !ruby/object:Gem::Version
63
57
  version: '6'
64
58
  type: :runtime
65
59
  prerelease: false
66
60
  version_requirements: !ruby/object:Gem::Requirement
67
- none: false
68
61
  requirements:
69
- - - ! '>='
62
+ - - ">="
70
63
  - !ruby/object:Gem::Version
71
64
  version: 5.0.0.pre4
72
- - - <
65
+ - - "<"
73
66
  - !ruby/object:Gem::Version
74
67
  version: '6'
75
68
  - !ruby/object:Gem::Dependency
76
69
  name: rspec
77
70
  requirement: !ruby/object:Gem::Requirement
78
- none: false
79
71
  requirements:
80
- - - ! '>='
72
+ - - ">="
81
73
  - !ruby/object:Gem::Version
82
74
  version: '2.0'
83
75
  type: :development
84
76
  prerelease: false
85
77
  version_requirements: !ruby/object:Gem::Requirement
86
- none: false
87
78
  requirements:
88
- - - ! '>='
79
+ - - ">="
89
80
  - !ruby/object:Gem::Version
90
81
  version: '2.0'
91
82
  - !ruby/object:Gem::Dependency
92
83
  name: rspec-rails
93
84
  requirement: !ruby/object:Gem::Requirement
94
- none: false
95
85
  requirements:
96
- - - ! '>='
86
+ - - ">="
97
87
  - !ruby/object:Gem::Version
98
88
  version: '0'
99
89
  type: :development
100
90
  prerelease: false
101
91
  version_requirements: !ruby/object:Gem::Requirement
102
- none: false
103
92
  requirements:
104
- - - ! '>='
93
+ - - ">="
105
94
  - !ruby/object:Gem::Version
106
95
  version: '0'
107
96
  - !ruby/object:Gem::Dependency
108
97
  name: capybara
109
98
  requirement: !ruby/object:Gem::Requirement
110
- none: false
111
99
  requirements:
112
- - - ! '>='
100
+ - - ">="
113
101
  - !ruby/object:Gem::Version
114
102
  version: '0'
115
103
  type: :development
116
104
  prerelease: false
117
105
  version_requirements: !ruby/object:Gem::Requirement
118
- none: false
119
106
  requirements:
120
- - - ! '>='
107
+ - - ">="
121
108
  - !ruby/object:Gem::Version
122
109
  version: '0'
123
110
  - !ruby/object:Gem::Dependency
124
111
  name: sqlite3
125
112
  requirement: !ruby/object:Gem::Requirement
126
- none: false
127
113
  requirements:
128
- - - ! '>='
114
+ - - ">="
129
115
  - !ruby/object:Gem::Version
130
116
  version: '0'
131
117
  type: :development
132
118
  prerelease: false
133
119
  version_requirements: !ruby/object:Gem::Requirement
134
- none: false
135
120
  requirements:
136
- - - ! '>='
121
+ - - ">="
137
122
  - !ruby/object:Gem::Version
138
123
  version: '0'
139
124
  - !ruby/object:Gem::Dependency
140
125
  name: launchy
141
126
  requirement: !ruby/object:Gem::Requirement
142
- none: false
143
127
  requirements:
144
- - - ! '>='
128
+ - - ">="
145
129
  - !ruby/object:Gem::Version
146
130
  version: '0'
147
131
  type: :development
148
132
  prerelease: false
149
133
  version_requirements: !ruby/object:Gem::Requirement
150
- none: false
151
134
  requirements:
152
- - - ! '>='
135
+ - - ">="
153
136
  - !ruby/object:Gem::Version
154
137
  version: '0'
155
138
  - !ruby/object:Gem::Dependency
156
139
  name: jettywrapper
157
140
  requirement: !ruby/object:Gem::Requirement
158
- none: false
159
141
  requirements:
160
- - - ~>
142
+ - - "~>"
161
143
  - !ruby/object:Gem::Version
162
144
  version: '1.5'
163
- - - ! '>='
145
+ - - ">="
164
146
  - !ruby/object:Gem::Version
165
147
  version: 1.5.2
166
148
  type: :development
167
149
  prerelease: false
168
150
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
151
  requirements:
171
- - - ~>
152
+ - - "~>"
172
153
  - !ruby/object:Gem::Version
173
154
  version: '1.5'
174
- - - ! '>='
155
+ - - ">="
175
156
  - !ruby/object:Gem::Version
176
157
  version: 1.5.2
177
158
  description:
@@ -181,8 +162,8 @@ executables: []
181
162
  extensions: []
182
163
  extra_rdoc_files: []
183
164
  files:
184
- - .gitignore
185
- - .travis.yml
165
+ - ".gitignore"
166
+ - ".travis.yml"
186
167
  - Gemfile
187
168
  - LICENSE
188
169
  - README.md
@@ -199,6 +180,7 @@ files:
199
180
  - app/views/blacklight_range_limit/range_segments.html.erb
200
181
  - blacklight_range_limit.gemspec
201
182
  - config/jetty.yml
183
+ - config/locales/blacklight_range_limit.en.yml
202
184
  - config/routes.rb
203
185
  - config/solr.yml
204
186
  - doc/example-screenshot.png
@@ -212,10 +194,10 @@ files:
212
194
  - lib/generators/blacklight_range_limit/assets_generator.rb
213
195
  - lib/generators/blacklight_range_limit/blacklight_range_limit_generator.rb
214
196
  - spec/features/blacklight_range_limit_spec.rb
197
+ - spec/helpers/blacklight_range_limit_helper_spec.rb
215
198
  - spec/spec_helper.rb
216
199
  - spec/test_app_templates/Gemfile.extra
217
200
  - spec/test_app_templates/lib/generators/test_app_generator.rb
218
- - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
219
201
  - vendor/assets/javascripts/bootstrap-slider.js
220
202
  - vendor/assets/javascripts/flot/excanvas.min.js
221
203
  - vendor/assets/javascripts/flot/jquery.flot.js
@@ -224,32 +206,30 @@ files:
224
206
  homepage: https://github.com/projectblacklight/blacklight_range_limit
225
207
  licenses:
226
208
  - Apache 2.0
209
+ metadata: {}
227
210
  post_install_message:
228
211
  rdoc_options: []
229
212
  require_paths:
230
213
  - lib
231
214
  required_ruby_version: !ruby/object:Gem::Requirement
232
- none: false
233
215
  requirements:
234
- - - ! '>='
216
+ - - ">="
235
217
  - !ruby/object:Gem::Version
236
218
  version: '0'
237
219
  required_rubygems_version: !ruby/object:Gem::Requirement
238
- none: false
239
220
  requirements:
240
- - - ! '>='
221
+ - - ">="
241
222
  - !ruby/object:Gem::Version
242
223
  version: '0'
243
224
  requirements: []
244
225
  rubyforge_project:
245
- rubygems_version: 1.8.23
226
+ rubygems_version: 2.2.2
246
227
  signing_key:
247
- specification_version: 3
228
+ specification_version: 4
248
229
  summary: Blacklight Range Limit plugin
249
230
  test_files:
250
231
  - spec/features/blacklight_range_limit_spec.rb
232
+ - spec/helpers/blacklight_range_limit_helper_spec.rb
251
233
  - spec/spec_helper.rb
252
234
  - spec/test_app_templates/Gemfile.extra
253
235
  - spec/test_app_templates/lib/generators/test_app_generator.rb
254
- - spec/test_app_templates/lib/tasks/blacklight_test_app.rake
255
- has_rdoc:
@@ -1,14 +0,0 @@
1
- require 'rspec/core/rake_task'
2
-
3
- desc "run the blacklight gem spec"
4
- gem_home = File.expand_path('../../../../..', __FILE__)
5
-
6
- namespace :blacklight_test_app do
7
-
8
- RSpec::Core::RakeTask.new(:spec) do |t|
9
- t.pattern = gem_home + '/spec/**/*_spec.rb'
10
- t.rspec_opts = "--colour"
11
- t.ruby_opts = "-I#{gem_home}/spec"
12
- end
13
-
14
- end