faceted_search 3.5.12 → 3.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/faceted_search/facets/date.rb +1 -1
- data/app/models/faceted_search/facets/default.rb +5 -1
- data/app/models/faceted_search/facets/default_list.rb +1 -1
- data/app/models/faceted_search/facets/primitive_list.rb +1 -1
- data/app/models/faceted_search/facets.rb +6 -5
- data/app/views/faceted_search/facets/_facet-selected.html.erb +1 -1
- data/app/views/faceted_search/facets/range/_all.html.erb +3 -3
- data/app/views/faceted_search/facets/range/_selected.html.erb +1 -1
- data/app/views/faceted_search/facets/text/_all.html.erb +3 -3
- data/app/views/faceted_search/facets/text/_selected.html.erb +1 -1
- data/lib/faceted_search/version.rb +1 -1
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 118ee09dcce76e63a448bfeace430cd56bc9c9f80afa92c252590f133085f04c
|
4
|
+
data.tar.gz: 571935067534cf0ad244dd66d250b8adf7e9d038bd3c35d3b8746d661e677210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad23f4aa1e796de72646961794ea8d1c63a64fcd4ec0333710dd1277aec2af316bc62dbd58ea84eb24dd5857d5a661b01c69af310c39bd8c95786a52eeabf0e
|
7
|
+
data.tar.gz: 67ee216d08726b5966073ac33549ed89c4d47433df205a5e56a33a3137dd175a3e1f852b58b6e660527ede3833eb25b677ce4353c94a7a5117026120713ee032
|
@@ -6,7 +6,7 @@ module FacetedSearch
|
|
6
6
|
if @options[:source].present?
|
7
7
|
@options[:source]
|
8
8
|
else
|
9
|
-
results = params_array.blank? ? facets.results : facets.results_except(
|
9
|
+
results = params_array.blank? ? facets.results : facets.results_except(param_name)
|
10
10
|
results.send(:all).pluck(name).compact.map(&:year).uniq.sort
|
11
11
|
end
|
12
12
|
end
|
@@ -33,6 +33,10 @@ module FacetedSearch
|
|
33
33
|
@options[:hide_in_selected] || path_pattern?
|
34
34
|
end
|
35
35
|
|
36
|
+
def param_name
|
37
|
+
@options[:param_name] || name
|
38
|
+
end
|
39
|
+
|
36
40
|
def kind
|
37
41
|
self.class.to_s
|
38
42
|
end
|
@@ -48,7 +52,7 @@ module FacetedSearch
|
|
48
52
|
|
49
53
|
def path(custom_params = @params)
|
50
54
|
return '' if custom_params.blank?
|
51
|
-
"&facets[#{
|
55
|
+
"&facets[#{param_name}]=#{custom_params}"
|
52
56
|
end
|
53
57
|
|
54
58
|
def to_s
|
@@ -28,7 +28,7 @@ module FacetedSearch
|
|
28
28
|
def values
|
29
29
|
@values ||= begin
|
30
30
|
joined_table = facets.model_table_name.to_sym
|
31
|
-
results = params_array.blank? ? facets.results : facets.results_except(
|
31
|
+
results = params_array.blank? ? facets.results : facets.results_except(param_name)
|
32
32
|
values = source.all.joins(joined_table)
|
33
33
|
values.where(joined_table => { id: results }).or(values.where(id: params_array)).distinct
|
34
34
|
end
|
@@ -6,7 +6,7 @@ module FacetedSearch
|
|
6
6
|
if @options[:source].present?
|
7
7
|
@options[:source].where("#{field} IS NOT NULL")
|
8
8
|
else
|
9
|
-
results = params_array.compact.blank? ? facets.results : facets.results_except(
|
9
|
+
results = params_array.compact.blank? ? facets.results : facets.results_except(param_name)
|
10
10
|
results.send(:all).where("#{field} IS NOT NULL")
|
11
11
|
end
|
12
12
|
end
|
@@ -39,10 +39,10 @@ module FacetedSearch
|
|
39
39
|
@results ||= results_except []
|
40
40
|
end
|
41
41
|
|
42
|
-
def results_except(*
|
42
|
+
def results_except(*facet_param_names)
|
43
43
|
scope = @model
|
44
44
|
list.each do |facet|
|
45
|
-
next if
|
45
|
+
next if facet_param_names.include?(facet.param_name) || facet.ignore_scope?
|
46
46
|
scope = facet.add_scope(scope)
|
47
47
|
end
|
48
48
|
scope.distinct
|
@@ -95,12 +95,13 @@ module FacetedSearch
|
|
95
95
|
add_facet Range, value, options
|
96
96
|
end
|
97
97
|
|
98
|
-
def params_for(value)
|
99
|
-
|
98
|
+
def params_for(value, options)
|
99
|
+
param_name = (options[:param_name] || value).to_sym
|
100
|
+
@params[param_name] if @params.has_key? param_name
|
100
101
|
end
|
101
102
|
|
102
103
|
def add_facet(kind, value, options)
|
103
|
-
@list << kind.new(value, params_for(value), self, options)
|
104
|
+
@list << kind.new(value, params_for(value, options), self, options)
|
104
105
|
end
|
105
106
|
end
|
106
107
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<li class=" faceted__facet-selected
|
2
2
|
list-inline-item">
|
3
|
-
<%= link_to path, class: 'badge badge-light', rel: 'nofollow' do %>
|
3
|
+
<%= link_to path, class: 'badge badge-light bg-light text-dark', rel: 'nofollow' do %>
|
4
4
|
<% unless title %>
|
5
5
|
<span class="faceted__facet-selected__title d-none">
|
6
6
|
<%= title %>
|
@@ -2,18 +2,18 @@
|
|
2
2
|
<li>
|
3
3
|
<% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
|
4
4
|
<%
|
5
|
-
value = params[:facets][facet.
|
5
|
+
value = params[:facets][facet.param_name] if params.dig(:facets, facet.param_name).present?
|
6
6
|
value ||= facet.default_value
|
7
7
|
%>
|
8
8
|
<form action="<%= anchor %>" class="faceted__facet__text form-inline">
|
9
9
|
<% facet.facets.list.each do |f| %>
|
10
10
|
<% next if f == facet || f.params.blank? || f.path_pattern? %>
|
11
11
|
<input type="hidden"
|
12
|
-
name="facets[<%= f.
|
12
|
+
name="facets[<%= f.param_name %>]"
|
13
13
|
value="<%= f.params %>" />
|
14
14
|
<% end %>
|
15
15
|
<input type="range"
|
16
|
-
name="facets[<%= facet.
|
16
|
+
name="facets[<%= facet.param_name %>]"
|
17
17
|
min="<%= facet.min %>"
|
18
18
|
max="<%= facet.max %>"
|
19
19
|
step="<%= facet.step %>"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% anchor ||= '' %>
|
2
|
-
<% value = params[:facets][facet.
|
2
|
+
<% value = params[:facets][facet.param_name] if params[:facets] && params[:facets].has_key?(facet.param_name) %>
|
3
3
|
<% unless value.blank? %>
|
4
4
|
<%= render 'faceted_search/facets/facet-selected',
|
5
5
|
title: facet.title,
|
@@ -1,16 +1,16 @@
|
|
1
1
|
<% anchor ||= '' %>
|
2
2
|
<li>
|
3
3
|
<% unless facet.title.blank? %><b><%= facet.title %></b><% end %>
|
4
|
-
<% value = params[:facets][facet.
|
4
|
+
<% value = params[:facets][facet.param_name] if params[:facets] && params[:facets].has_key?(facet.param_name) %>
|
5
5
|
<form action="<%= anchor %>" class="faceted__facet__text form-inline">
|
6
6
|
<% facet.facets.list.each do |f| %>
|
7
7
|
<% next if f == facet || f.params.blank? || f.path_pattern? %>
|
8
8
|
<input type="hidden"
|
9
|
-
name="facets[<%= f.
|
9
|
+
name="facets[<%= f.param_name %>]"
|
10
10
|
value="<%= f.params %>" />
|
11
11
|
<% end %>
|
12
12
|
<input type="search"
|
13
|
-
name="facets[<%= facet.
|
13
|
+
name="facets[<%= facet.param_name %>]"
|
14
14
|
placeholder="<%= facet.placeholder %>"
|
15
15
|
value="<%= value %>"
|
16
16
|
class="form-control" />
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% anchor ||= '' %>
|
2
|
-
<% value = params[:facets][facet.
|
2
|
+
<% value = params[:facets][facet.param_name] if params[:facets] && params[:facets].has_key?(facet.param_name) %>
|
3
3
|
<% unless value.blank? %>
|
4
4
|
<%= render 'faceted_search/facets/facet-selected',
|
5
5
|
title: facet.title,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faceted_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Levy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2022-
|
13
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -19,9 +19,6 @@ dependencies:
|
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 5.2.0
|
22
|
-
- - "<"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: '7'
|
25
22
|
type: :runtime
|
26
23
|
prerelease: false
|
27
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,9 +26,6 @@ dependencies:
|
|
29
26
|
- - ">="
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: 5.2.0
|
32
|
-
- - "<"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '7'
|
35
29
|
- !ruby/object:Gem::Dependency
|
36
30
|
name: font-awesome-sass
|
37
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
179
|
- !ruby/object:Gem::Version
|
186
180
|
version: '0'
|
187
181
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.3.7
|
189
183
|
signing_key:
|
190
184
|
specification_version: 4
|
191
185
|
summary: Faceted search with Active Record
|