blacklight_advanced_search 6.2.1 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 050411c1a81b12203d148e6573bdcf65a1e24f6d
4
- data.tar.gz: 23537090bf069c31ed54b42f07bcc60fd18fdf86
3
+ metadata.gz: 33b94befa971635c4bd30d04c7815456b0034f06
4
+ data.tar.gz: 067174a8dcfca40bba99bf800d7298f121a13890
5
5
  SHA512:
6
- metadata.gz: 96ccfb9dfb3c8a8b14bb973ff9adaff70ce15e722b706b0b428396e3c2b5e08263bc2f5b0bdf14b80a6a64c5eb01ce311dce4585032a7f279b18dfe172bdc6f2
7
- data.tar.gz: 25f215056e4225475c068732e8facd4c09c60e71d3a2a4bd90ce44a5f4de916608d0d775435fa8fd452edb6b94abeee69b70c861e0fd727d7c428d1260133aca
6
+ metadata.gz: 499300f4afbac09f41dc8f6f8d7347d3dcd797a1cf6939e561d620edbf5a54f7ef938325ee7031c038be7c5b1c99e3d8ebc62e99e19edf4eb023cc20822a7c70
7
+ data.tar.gz: cd024418479b6607098a2ffb3b96cb16d3333abdf12ff192ad81a9166838ee2b5fadf6857c7ef95912d4593e560fa8e39b0577cbe8831c81da98634072160e78
data/.rubocop_todo.yml CHANGED
@@ -1,18 +1,89 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-08-25 19:29:18 -0700 using RuboCop version 0.42.0.
3
+ # on 2017-06-13 08:15:08 -0700 using RuboCop version 0.49.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Manually added to prevent `unrecognized cop` warnings during execution.
10
- require: rubocop-rspec
9
+ # Offense count: 2
10
+ # Configuration parameters: Include.
11
+ # Include: **/Gemfile, **/gems.rb
12
+ Bundler/DuplicatedGem:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: Include, TreatCommentsAsGroupSeparators.
19
+ # Include: **/Gemfile, **/gems.rb
20
+ Bundler/OrderedGems:
21
+ Exclude:
22
+ - 'Gemfile'
23
+
24
+ # Offense count: 1
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: EnforcedHashRocketStyle, SupportedHashRocketStyles, EnforcedColonStyle, SupportedColonStyles, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
27
+ # SupportedHashRocketStyles: key, separator, table
28
+ # SupportedColonStyles: key, separator, table
29
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
30
+ Layout/AlignHash:
31
+ Exclude:
32
+ - 'lib/parsing_nesting/tree.rb'
33
+
34
+ # Offense count: 4
35
+ # Cop supports --auto-correct.
36
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
37
+ # SupportedStyles: with_first_parameter, with_fixed_indentation
38
+ Layout/AlignParameters:
39
+ Exclude:
40
+ - 'lib/blacklight_advanced_search/render_constraints_override.rb'
41
+
42
+ # Offense count: 2
43
+ # Cop supports --auto-correct.
44
+ Layout/EmptyLineAfterMagicComment:
45
+ Exclude:
46
+ - 'lib/generators/blacklight_advanced_search/templates/saved_searches_controller.rb'
47
+ - 'lib/generators/blacklight_advanced_search/templates/search_history_controller.rb'
48
+
49
+ # Offense count: 1
50
+ # Cop supports --auto-correct.
51
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
52
+ # SupportedStyles: symmetrical, new_line, same_line
53
+ Layout/MultilineArrayBraceLayout:
54
+ Exclude:
55
+ - 'spec/parsing_nesting/consuming_spec.rb'
11
56
 
12
57
  # Offense count: 2
58
+ # Cop supports --auto-correct.
59
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
60
+ # SupportedStyles: symmetrical, new_line, same_line
61
+ Layout/MultilineMethodCallBraceLayout:
62
+ Exclude:
63
+ - 'lib/blacklight_advanced_search/render_constraints_override.rb'
64
+
65
+ # Offense count: 10
66
+ # Cop supports --auto-correct.
67
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
68
+ # SupportedStyles: aligned, indented
69
+ Layout/MultilineOperationIndentation:
70
+ Exclude:
71
+ - 'lib/blacklight_advanced_search/advanced_search_builder.rb'
72
+ - 'lib/blacklight_advanced_search/controller.rb'
73
+ - 'lib/parsing_nesting/grammar.rb'
74
+ - 'lib/parsing_nesting/tree.rb'
75
+
76
+ # Offense count: 1
77
+ # Cop supports --auto-correct.
78
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
79
+ # SupportedStyles: space, no_space
80
+ Layout/SpaceBeforeBlockBraces:
81
+ Exclude:
82
+ - 'blacklight_advanced_search.gemspec'
83
+
84
+ # Offense count: 1
13
85
  Lint/AmbiguousOperator:
14
86
  Exclude:
15
- - 'app/helpers/advanced_helper.rb'
16
87
  - 'spec/parsing_nesting/to_solr_spec.rb'
17
88
 
18
89
  # Offense count: 3
@@ -23,8 +94,8 @@ Lint/AssignmentInCondition:
23
94
 
24
95
  # Offense count: 3
25
96
  # Cop supports --auto-correct.
26
- # Configuration parameters: AlignWith, SupportedStyles, AutoCorrect.
27
- # SupportedStyles: keyword, variable, start_of_line
97
+ # Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
98
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
28
99
  Lint/EndAlignment:
29
100
  Exclude:
30
101
  - 'lib/blacklight_advanced_search/advanced_search_builder.rb'
@@ -50,7 +121,7 @@ Metrics/AbcSize:
50
121
  Metrics/CyclomaticComplexity:
51
122
  Max: 11
52
123
 
53
- # Offense count: 14
124
+ # Offense count: 13
54
125
  # Configuration parameters: CountComments.
55
126
  Metrics/MethodLength:
56
127
  Max: 22
@@ -59,6 +130,14 @@ Metrics/MethodLength:
59
130
  Metrics/PerceivedComplexity:
60
131
  Max: 13
61
132
 
133
+ # Offense count: 1
134
+ RSpec/BeforeAfterAll:
135
+ Exclude:
136
+ - 'spec/spec_helper.rb'
137
+ - 'spec/rails_helper.rb'
138
+ - 'spec/support/**/*.rb'
139
+ - 'spec/features/blacklight_advanced_search_form_spec.rb'
140
+
62
141
  # Offense count: 7
63
142
  RSpec/DescribeClass:
64
143
  Exclude:
@@ -70,6 +149,12 @@ RSpec/DescribeClass:
70
149
  - 'spec/parsing_nesting/consuming_spec.rb'
71
150
  - 'spec/parsing_nesting/to_solr_spec.rb'
72
151
 
152
+ # Offense count: 6
153
+ RSpec/EmptyLineAfterFinalLet:
154
+ Exclude:
155
+ - 'spec/helpers/advanced_helper_spec.rb'
156
+ - 'spec/lib/advanced_search_builder_spec.rb'
157
+
73
158
  # Offense count: 21
74
159
  # Configuration parameters: Max.
75
160
  RSpec/ExampleLength:
@@ -89,69 +174,58 @@ RSpec/ExampleWording:
89
174
  - 'spec/parsing_nesting/to_solr_spec.rb'
90
175
 
91
176
  # Offense count: 1
92
- # Configuration parameters: CustomTransform.
177
+ # Configuration parameters: CustomTransform, IgnoreMethods.
93
178
  RSpec/FilePath:
94
179
  Exclude:
95
180
  - 'spec/lib/advanced_search_builder_spec.rb'
96
181
 
97
- # Offense count: 17
182
+ # Offense count: 10
98
183
  # Configuration parameters: AssignmentOnly.
99
184
  RSpec/InstanceVariable:
100
185
  Exclude:
101
- - 'spec/lib/deep_merge_spec.rb'
102
186
  - 'spec/parsing_nesting/consuming_spec.rb'
103
187
  - 'spec/parsing_nesting/to_solr_spec.rb'
104
188
 
105
189
  # Offense count: 2
106
- # Configuration parameters: EnforcedStyle, SupportedStyles.
107
- # SupportedStyles: allow, expect
108
- RSpec/MessageExpectation:
109
- Exclude:
110
- - 'spec/helpers/advanced_helper_spec.rb'
190
+ # Configuration parameters: SupportedStyles.
191
+ # SupportedStyles: have_received, receive
192
+ RSpec/MessageSpies:
193
+ EnforcedStyle: receive
111
194
 
112
- # Offense count: 29
195
+ # Offense count: 33
113
196
  RSpec/MultipleExpectations:
114
197
  Max: 6
115
198
 
116
- # Offense count: 4
117
- # Configuration parameters: MaxNesting.
199
+ # Offense count: 10
200
+ # Configuration parameters: Max.
118
201
  RSpec/NestedGroups:
119
202
  Exclude:
120
203
  - 'spec/lib/advanced_search_builder_spec.rb'
204
+ - 'spec/parsing_nesting/to_solr_spec.rb'
121
205
 
122
- # Offense count: 5
206
+ # Offense count: 2
123
207
  # Configuration parameters: IgnoreSymbolicNames.
124
208
  RSpec/VerifiedDoubles:
125
209
  Exclude:
126
210
  - 'spec/helpers/advanced_helper_spec.rb'
127
- - 'spec/lib/advanced_search_builder_spec.rb'
128
211
 
129
212
  # Offense count: 1
130
213
  Rails/OutputSafety:
131
214
  Exclude:
132
215
  - 'lib/blacklight_advanced_search/render_constraints_override.rb'
133
216
 
134
- # Offense count: 1
135
- Style/AccessorMethodName:
136
- Exclude:
137
- - 'app/controllers/blacklight_advanced_search/advanced_controller.rb'
138
-
139
- # Offense count: 9
217
+ # Offense count: 2
140
218
  # Cop supports --auto-correct.
141
- # Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
142
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
143
- Style/AlignHash:
219
+ # Configuration parameters: NotNilAndNotEmpty, NotBlank, UnlessBlank.
220
+ Rails/Present:
144
221
  Exclude:
145
- - 'lib/parsing_nesting/tree.rb'
146
- - 'spec/lib/deep_merge_spec.rb'
222
+ - 'app/helpers/blacklight_advanced_search/advanced_helper_behavior.rb'
223
+ - 'lib/blacklight_advanced_search/advanced_query_parser.rb'
147
224
 
148
- # Offense count: 4
149
- # Cop supports --auto-correct.
150
- # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
151
- # SupportedStyles: with_first_parameter, with_fixed_indentation
152
- Style/AlignParameters:
225
+ # Offense count: 1
226
+ Style/AccessorMethodName:
153
227
  Exclude:
154
- - 'lib/blacklight_advanced_search/render_constraints_override.rb'
228
+ - 'app/controllers/blacklight_advanced_search/advanced_controller.rb'
155
229
 
156
230
  # Offense count: 7
157
231
  # Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -166,49 +240,34 @@ Style/ClassAndModuleChildren:
166
240
  - 'lib/blacklight_advanced_search/render_constraints_override.rb'
167
241
  - 'lib/parsing_nesting/tree.rb'
168
242
 
169
- # Offense count: 1
170
- Style/ClassVars:
171
- Exclude:
172
- - 'lib/blacklight_advanced_search/advanced_search_builder.rb'
173
-
174
- # Offense count: 25
243
+ # Offense count: 26
175
244
  Style/Documentation:
245
+ Enabled: false
246
+
247
+ # Offense count: 1
248
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
249
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
250
+ Style/FileName:
176
251
  Exclude:
177
- - 'spec/**/*'
178
- - 'test/**/*'
179
- - 'lib/blacklight_advanced_search.rb'
180
- - 'lib/blacklight_advanced_search/advanced_search_builder.rb'
181
- - 'lib/blacklight_advanced_search/catalog_helper_override.rb'
182
- - 'lib/blacklight_advanced_search/filter_parser.rb'
183
- - 'lib/blacklight_advanced_search/parsing_nesting_parser.rb'
184
- - 'lib/blacklight_advanced_search/redirect_legacy_params_filter.rb'
185
- - 'lib/blacklight_advanced_search/version.rb'
186
- - 'lib/generators/blacklight_advanced_search/assets_generator.rb'
187
- - 'lib/generators/blacklight_advanced_search/blacklight_advanced_search_generator.rb'
188
- - 'lib/generators/blacklight_advanced_search/install_generator.rb'
189
- - 'lib/generators/blacklight_advanced_search/templates/advanced_controller.rb'
190
- - 'lib/generators/blacklight_advanced_search/templates/saved_searches_controller.rb'
191
- - 'lib/generators/blacklight_advanced_search/templates/search_history_controller.rb'
192
- - 'lib/parsing_nesting/grammar.rb'
193
- - 'lib/parsing_nesting/tree.rb'
252
+ - 'Gemfile'
194
253
 
195
- # Offense count: 4
254
+ # Offense count: 6
196
255
  # Configuration parameters: MinBodyLength.
197
256
  Style/GuardClause:
198
257
  Exclude:
199
- - 'app/helpers/advanced_helper.rb'
258
+ - 'app/helpers/blacklight_advanced_search/advanced_helper_behavior.rb'
200
259
  - 'lib/blacklight_advanced_search/advanced_search_builder.rb'
260
+ - 'lib/blacklight_advanced_search/redirect_legacy_params_filter.rb'
201
261
  - 'lib/blacklight_advanced_search/render_constraints_override.rb'
202
262
  - 'lib/parsing_nesting/tree.rb'
203
263
 
204
264
  # Offense count: 76
205
265
  # Cop supports --auto-correct.
206
266
  # Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
207
- # SupportedStyles: ruby19, ruby19_no_mixed_keys, hash_rockets
267
+ # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
208
268
  Style/HashSyntax:
209
269
  Exclude:
210
270
  - 'Rakefile'
211
- - 'app/helpers/advanced_helper.rb'
212
271
  - 'lib/blacklight_advanced_search/advanced_query_parser.rb'
213
272
  - 'lib/blacklight_advanced_search/redirect_legacy_params_filter.rb'
214
273
  - 'lib/blacklight_advanced_search/render_constraints_override.rb'
@@ -229,50 +288,21 @@ Style/MethodName:
229
288
  Exclude:
230
289
  - 'spec/lib/filter_parser_spec.rb'
231
290
 
232
- # Offense count: 1
233
- # Cop supports --auto-correct.
234
- # Configuration parameters: EnforcedStyle, SupportedStyles.
235
- # SupportedStyles: symmetrical, new_line, same_line
236
- Style/MultilineArrayBraceLayout:
237
- Exclude:
238
- - 'spec/parsing_nesting/consuming_spec.rb'
239
-
240
- # Offense count: 1
241
- # Cop supports --auto-correct.
242
- # Configuration parameters: EnforcedStyle, SupportedStyles.
243
- # SupportedStyles: symmetrical, new_line, same_line
244
- Style/MultilineHashBraceLayout:
245
- Exclude:
246
- - 'spec/lib/deep_merge_spec.rb'
247
-
248
- # Offense count: 2
249
- # Cop supports --auto-correct.
250
- # Configuration parameters: EnforcedStyle, SupportedStyles.
251
- # SupportedStyles: symmetrical, new_line, same_line
252
- Style/MultilineMethodCallBraceLayout:
253
- Exclude:
254
- - 'lib/blacklight_advanced_search/render_constraints_override.rb'
255
-
256
- # Offense count: 10
257
- # Cop supports --auto-correct.
258
- # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
259
- # SupportedStyles: aligned, indented
260
- Style/MultilineOperationIndentation:
261
- Exclude:
262
- - 'lib/blacklight_advanced_search/advanced_search_builder.rb'
263
- - 'lib/blacklight_advanced_search/controller.rb'
264
- - 'lib/parsing_nesting/grammar.rb'
265
- - 'lib/parsing_nesting/tree.rb'
266
-
267
- # Offense count: 7
291
+ # Offense count: 5
268
292
  # Cop supports --auto-correct.
269
293
  # Configuration parameters: AllowSafeAssignment.
270
294
  Style/ParenthesesAroundCondition:
271
295
  Exclude:
272
- - 'lib/blacklight_advanced_search.rb'
273
296
  - 'lib/blacklight_advanced_search/catalog_helper_override.rb'
274
297
  - 'lib/blacklight_advanced_search/render_constraints_override.rb'
275
298
 
299
+ # Offense count: 2
300
+ # Cop supports --auto-correct.
301
+ # Configuration parameters: PreferredDelimiters.
302
+ Style/PercentLiteralDelimiters:
303
+ Exclude:
304
+ - 'spec/lib/filter_parser_spec.rb'
305
+
276
306
  # Offense count: 4
277
307
  # Cop supports --auto-correct.
278
308
  Style/PerlBackrefs:
@@ -292,10 +322,20 @@ Style/PredicateName:
292
322
 
293
323
  # Offense count: 5
294
324
  # Cop supports --auto-correct.
325
+ # Configuration parameters: EnforcedStyle, SupportedStyles.
326
+ # SupportedStyles: short, verbose
295
327
  Style/PreferredHashMethods:
296
328
  Exclude:
297
329
  - 'lib/parsing_nesting/tree.rb'
298
330
 
331
+ # Offense count: 4
332
+ # Cop supports --auto-correct.
333
+ # Configuration parameters: AllowMultipleReturnValues.
334
+ Style/RedundantReturn:
335
+ Exclude:
336
+ - 'app/helpers/blacklight_advanced_search/advanced_helper_behavior.rb'
337
+ - 'lib/blacklight_advanced_search/render_constraints_override.rb'
338
+
299
339
  # Offense count: 6
300
340
  # Cop supports --auto-correct.
301
341
  Style/RedundantSelf:
@@ -312,7 +352,7 @@ Style/RedundantSelf:
312
352
  Style/SpecialGlobalVars:
313
353
  EnforcedStyle: use_perl_names
314
354
 
315
- # Offense count: 430
355
+ # Offense count: 398
316
356
  # Cop supports --auto-correct.
317
357
  # Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
318
358
  # SupportedStyles: single_quotes, double_quotes
@@ -327,6 +367,13 @@ Style/StringLiteralsInInterpolation:
327
367
  Exclude:
328
368
  - 'lib/parsing_nesting/tree.rb'
329
369
 
370
+ # Offense count: 1
371
+ # Cop supports --auto-correct.
372
+ # Configuration parameters: MinSize, SupportedStyles.
373
+ # SupportedStyles: percent, brackets
374
+ Style/SymbolArray:
375
+ EnforcedStyle: brackets
376
+
330
377
  # Offense count: 9
331
378
  # Cop supports --auto-correct.
332
379
  # Configuration parameters: IgnoredMethods.
@@ -349,9 +396,3 @@ Style/TrailingUnderscoreVariable:
349
396
  Style/VariableName:
350
397
  Exclude:
351
398
  - 'lib/parsing_nesting/tree.rb'
352
-
353
- Style/RedundantReturn:
354
- Enabled: false
355
-
356
- Style/GuardClause:
357
- Enabled: false
data/.travis.yml CHANGED
@@ -2,8 +2,13 @@ notifications:
2
2
  email: false
3
3
 
4
4
  rvm:
5
- - 2.3.1
6
- - 2.2.5
5
+ - 2.4.1
6
+ - 2.3.3
7
+
8
+ matrix:
9
+ include:
10
+ - rvm: 2.3.3
11
+ env: "RAILS_VERSION=5.0.3"
7
12
 
8
13
  notifications:
9
14
  irc: "irc.freenode.org#blacklight"
@@ -13,4 +18,4 @@ env:
13
18
  global:
14
19
  - NOKOGIRI_USE_SYSTEM_LIBRARIES=true
15
20
 
16
- jdk: oraclejdk8
21
+ jdk: oraclejdk8
data/Gemfile CHANGED
@@ -31,6 +31,7 @@ else
31
31
  gem 'responders', '~> 2.0'
32
32
  gem 'sass-rails', '>= 5.0'
33
33
  gem 'coffee-rails', '~> 4.1.0'
34
+ gem 'json', '~> 1.8'
34
35
  when /^4.[01]/
35
36
  gem 'sass-rails', '< 5.0'
36
37
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.2.1
1
+ 6.3.0
@@ -1,49 +1,4 @@
1
1
  # Helper methods for the advanced search form
2
2
  module AdvancedHelper
3
- # Fill in default from existing search, if present
4
- # -- if you are using same search fields for basic
5
- # search and advanced, will even fill in properly if existing
6
- # search used basic search on same field present in advanced.
7
- def label_tag_default_for(key)
8
- if !params[key].blank?
9
- return params[key]
10
- elsif params["search_field"] == key
11
- return params["q"]
12
- else
13
- return nil
14
- end
15
- end
16
-
17
- # Is facet value in adv facet search results?
18
- def facet_value_checked?(field, value)
19
- BlacklightAdvancedSearch::QueryParser.new(params, blacklight_config).filters_include_value?(field, value)
20
- end
21
-
22
- def select_menu_for_field_operator
23
- options = {
24
- t('blacklight_advanced_search.all') => 'AND',
25
- t('blacklight_advanced_search.any') => 'OR'
26
- }.sort
27
-
28
- select_tag(:op, options_for_select(options, params[:op]), :class => 'input-small')
29
- end
30
-
31
- # Current params without fields that will be over-written by adv. search,
32
- # or other fields we don't want.
33
- def advanced_search_context
34
- my_params = params.except :page, :commit, :f_inclusive, :q, :search_field, :op, :action, :index, :sort, :controller, :utf8
35
-
36
- my_params.except! *search_fields_for_advanced_search.map { |_key, field_def| field_def[:key] }
37
- end
38
-
39
- def search_fields_for_advanced_search
40
- @search_fields_for_advanced_search ||= begin
41
- blacklight_config.search_fields.select { |_k, v| v.include_in_advanced_search || v.include_in_advanced_search.nil? }
42
- end
43
- end
44
-
45
- # Use configured facet partial name for facet or fallback on 'catalog/facet_limit'
46
- def advanced_search_facet_partial_name(display_facet)
47
- facet_configuration_for_field(display_facet.name).try(:partial) || "catalog/facet_limit"
48
- end
3
+ include BlacklightAdvancedSearch::AdvancedHelperBehavior
49
4
  end
@@ -0,0 +1,57 @@
1
+ module BlacklightAdvancedSearch
2
+ # implementation for AdvancedHelper
3
+ module AdvancedHelperBehavior
4
+ # Fill in default from existing search, if present
5
+ # -- if you are using same search fields for basic
6
+ # search and advanced, will even fill in properly if existing
7
+ # search used basic search on same field present in advanced.
8
+ def label_tag_default_for(key)
9
+ if !params[key].blank?
10
+ return params[key]
11
+ elsif params["search_field"] == key
12
+ return params["q"]
13
+ else
14
+ return nil
15
+ end
16
+ end
17
+
18
+ # Is facet value in adv facet search results?
19
+ def facet_value_checked?(field, value)
20
+ BlacklightAdvancedSearch::QueryParser.new(params, blacklight_config).filters_include_value?(field, value)
21
+ end
22
+
23
+ def select_menu_for_field_operator
24
+ options = {
25
+ t('blacklight_advanced_search.all') => 'AND',
26
+ t('blacklight_advanced_search.any') => 'OR'
27
+ }.sort
28
+
29
+ select_tag(:op, options_for_select(options, params[:op]), class: 'input-small')
30
+ end
31
+
32
+ # Current params without fields that will be over-written by adv. search,
33
+ # or other fields we don't want.
34
+ def advanced_search_context
35
+ my_params = search_state.params_for_search.except :page, :f_inclusive, :q, :search_field, :op, :index, :sort
36
+
37
+ my_params.except!(*search_fields_for_advanced_search.map { |_key, field_def| field_def[:key] })
38
+ end
39
+
40
+ def search_fields_for_advanced_search
41
+ @search_fields_for_advanced_search ||= begin
42
+ blacklight_config.search_fields.select { |_k, v| v.include_in_advanced_search || v.include_in_advanced_search.nil? }
43
+ end
44
+ end
45
+
46
+ def facet_field_names_for_advanced_search
47
+ @facet_field_names_for_advanced_search ||= begin
48
+ blacklight_config.facet_fields.select { |_k, v| v.include_in_advanced_search || v.include_in_advanced_search.nil? }.values.map(&:field)
49
+ end
50
+ end
51
+
52
+ # Use configured facet partial name for facet or fallback on 'catalog/facet_limit'
53
+ def advanced_search_facet_partial_name(display_facet)
54
+ facet_configuration_for_field(display_facet.name).try(:partial) || "catalog/facet_limit"
55
+ end
56
+ end
57
+ end
@@ -12,5 +12,5 @@
12
12
  %>
13
13
 
14
14
  <div class="advanced-facet-limits panel-group">
15
- <%= render_facet_partials facet_field_names %>
15
+ <%= render_facet_partials facet_field_names_for_advanced_search %>
16
16
  </div>
@@ -2,5 +2,6 @@ require 'blacklight'
2
2
 
3
3
  module BlacklightAdvancedSearch
4
4
  class Engine < Rails::Engine
5
+ require 'jquery-rails'
5
6
  end
6
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight_advanced_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.1
4
+ version: 6.3.0
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: 2016-12-13 00:00:00.000000000 Z
12
+ date: 2017-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -182,6 +182,7 @@ files:
182
182
  - app/controllers/advanced_controller.rb
183
183
  - app/controllers/blacklight_advanced_search/advanced_controller.rb
184
184
  - app/helpers/advanced_helper.rb
185
+ - app/helpers/blacklight_advanced_search/advanced_helper_behavior.rb
185
186
  - app/views/advanced/_advanced_search_facets.html.erb
186
187
  - app/views/advanced/_advanced_search_facets_as_select.html.erb
187
188
  - app/views/advanced/_advanced_search_fields.html.erb
@@ -266,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
267
  version: '0'
267
268
  requirements: []
268
269
  rubyforge_project: blacklight
269
- rubygems_version: 2.5.1
270
+ rubygems_version: 2.6.11
270
271
  signing_key:
271
272
  specification_version: 4
272
273
  summary: Blacklight Advanced Search plugin