faceted_search 3.4.6 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/app/models/faceted_search/facets.rb +11 -4
- data/app/models/faceted_search/facets/default.rb +12 -0
- data/app/views/faceted_search/_facets.html.erb +1 -1
- data/app/views/faceted_search/_link.html.erb +5 -0
- data/app/views/faceted_search/facets/_facet-selected.html.erb +1 -1
- data/app/views/faceted_search/facets/checkboxes/_all.html.erb +5 -2
- data/app/views/faceted_search/facets/date/_all.html.erb +5 -2
- data/app/views/faceted_search/facets/full_tree/_values.html.erb +5 -6
- data/app/views/faceted_search/facets/list/_all.html.erb +5 -2
- data/app/views/faceted_search/facets/primitive_list/_all.html.erb +4 -1
- data/app/views/faceted_search/facets/tree/_all.html.erb +6 -3
- data/lib/faceted_search/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ae2e8a71d88402a509dfb5ddd82c7de29a8c18ede7d0af7a9523aa8f2eb0482
|
4
|
+
data.tar.gz: cc36ce38efdd3f1f9737a08b7a3255743f3733453ef043b4d99f15878d8aa3b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 531b6d13e425b5bb81a44c20086fa83194cca9a1477c0959f3cc2d1fc6a2f2cc3f49a82f72ff25a5157240fac7ce21cd5c8ee4477e629f6e10e553bca09762c0
|
7
|
+
data.tar.gz: a451b716afbf7726bb9437a947e23ec2a84acd440de7b48da2a71c8225195acba8620c3e8c6ce91ef4f8bfeb8cca52d648a0cd847ece7449f4d3b910d7112190
|
data/README.md
CHANGED
@@ -56,6 +56,15 @@ Create a model defining your facets:
|
|
56
56
|
# children.order(:title)
|
57
57
|
# }
|
58
58
|
# }
|
59
|
+
|
60
|
+
# Other option, with searchable (SEO) categories
|
61
|
+
filter_with_full_tree :categories, {
|
62
|
+
habtm: true,
|
63
|
+
searchable: true,
|
64
|
+
path_pattern: Proc.new { |category_id|
|
65
|
+
Rails.application.routes.url_helpers.category_path(category_id)
|
66
|
+
}
|
67
|
+
}
|
59
68
|
end
|
60
69
|
end
|
61
70
|
|
@@ -19,10 +19,17 @@ module FacetedSearch
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def path_for(facet, value)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
if facet.path_pattern?
|
23
|
+
p = "#{facet.path_pattern.call(value)}#{path}"
|
24
|
+
list.each do |current_facet|
|
25
|
+
p += current_facet.path if current_facet != facet
|
26
|
+
end
|
27
|
+
else
|
28
|
+
p = path
|
29
|
+
list.each do |current_facet|
|
30
|
+
p += current_facet == facet ? current_facet.path_for(value)
|
31
|
+
: current_facet.path
|
32
|
+
end
|
26
33
|
end
|
27
34
|
p
|
28
35
|
end
|
@@ -13,6 +13,18 @@ module FacetedSearch
|
|
13
13
|
@options[:title] || name.to_s.humanize.titleize
|
14
14
|
end
|
15
15
|
|
16
|
+
def searchable
|
17
|
+
@options[:searchable] || false
|
18
|
+
end
|
19
|
+
|
20
|
+
def path_pattern
|
21
|
+
@options[:path_pattern] || false
|
22
|
+
end
|
23
|
+
|
24
|
+
def path_pattern?
|
25
|
+
@options.has_key? :path_pattern
|
26
|
+
end
|
27
|
+
|
16
28
|
def kind
|
17
29
|
self.class.to_s
|
18
30
|
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' do %>
|
3
|
+
<%= link_to path, class: 'badge badge-light', rel: 'nofollow' do %>
|
4
4
|
<% unless title %>
|
5
5
|
<span class="faceted__facet-selected__title d-none">
|
6
6
|
<%= title %>
|
@@ -14,9 +14,12 @@
|
|
14
14
|
onclick="window.location.href='<%= path %>'"
|
15
15
|
<%= 'checked' if selected %>
|
16
16
|
/>
|
17
|
-
<%=
|
17
|
+
<%= render 'faceted_search/link',
|
18
|
+
display_value: name,
|
19
|
+
path: path,
|
20
|
+
searchable: facet.searchable %>
|
18
21
|
</li>
|
19
22
|
<% end %>
|
20
23
|
</ul>
|
21
24
|
</li>
|
22
|
-
<% end %>
|
25
|
+
<% end %>
|
@@ -4,9 +4,12 @@
|
|
4
4
|
<ol class="faceted__facet__date list-unstyled">
|
5
5
|
<% facet.values.each do |year| %>
|
6
6
|
<li class="faceted__facet__date__value <%= 'faceted__facet__date__value--selected' if facet.value_selected?(year) %>">
|
7
|
-
<%=
|
7
|
+
<%= render 'faceted_search/link',
|
8
|
+
display_value: year,
|
9
|
+
path: facet.facets.path_for(facet, year) + anchor,
|
10
|
+
searchable: facet.searchable %>
|
8
11
|
</li>
|
9
12
|
<% end %>
|
10
13
|
</ol>
|
11
14
|
</li>
|
12
|
-
<% end %>
|
15
|
+
<% end %>
|
@@ -1,11 +1,10 @@
|
|
1
1
|
<% values.each do |value| %>
|
2
|
-
<%
|
3
|
-
display_value = facet.display_method.call(value)
|
4
|
-
identifier = value.send facet.find_by
|
5
|
-
path = facet.facets.path_for(facet, identifier)
|
6
|
-
%>
|
2
|
+
<% identifier = value.send facet.find_by %>
|
7
3
|
<li class="faceted__facet__full_tree__value<%= '--selected' if facet.value_selected?(identifier) %> dd-item <%= 'dd-item--selected' if facet.value_selected?(identifier) %>">
|
8
|
-
<%=
|
4
|
+
<%= render 'faceted_search/link',
|
5
|
+
display_value: facet.display_method.call(value),
|
6
|
+
path: facet.facets.path_for(facet, identifier),
|
7
|
+
searchable: facet.searchable %>
|
9
8
|
<% child_values = facet.values_with_parent(value.id) %>
|
10
9
|
<% if child_values.any? %>
|
11
10
|
<ol class="dd-list">
|
@@ -8,9 +8,12 @@
|
|
8
8
|
display_value = facet.display_method.call(value)
|
9
9
|
%>
|
10
10
|
<li class="faceted__facet__list__value <%= 'faceted__facet__list__value--selected' if facet.value_selected?(identifier) %>">
|
11
|
-
<%=
|
11
|
+
<%= render 'faceted_search/link',
|
12
|
+
display_value: display_value,
|
13
|
+
path: facet.facets.path_for(facet, identifier) + anchor,
|
14
|
+
searchable: facet.searchable %>
|
12
15
|
</li>
|
13
16
|
<% end %>
|
14
17
|
</ol>
|
15
18
|
</li>
|
16
|
-
<% end %>
|
19
|
+
<% end %>
|
@@ -12,7 +12,10 @@
|
|
12
12
|
onclick="window.location.href='<%= path %>'"
|
13
13
|
<%= 'checked' if selected %>
|
14
14
|
/>
|
15
|
-
<%=
|
15
|
+
<%= render 'faceted_search/link',
|
16
|
+
display_value: identifier,
|
17
|
+
path: path,
|
18
|
+
searchable: facet.searchable %>
|
16
19
|
</li>
|
17
20
|
<% end %>
|
18
21
|
</ul>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
path = facet.facets.path_for(facet, identifier)
|
10
10
|
%>
|
11
11
|
<div class="faceted__facet__tree__back">
|
12
|
-
<%= link_to path do %>
|
12
|
+
<%= link_to path, rel: 'nofollow' do %>
|
13
13
|
<i class="fas fa-arrow-left"></i> <%= display_value %>
|
14
14
|
<% end %>
|
15
15
|
</div>
|
@@ -23,10 +23,13 @@
|
|
23
23
|
path = facet.facets.path_for(facet, identifier)
|
24
24
|
%>
|
25
25
|
<li class="faceted__facet__tree__value">
|
26
|
-
<%=
|
26
|
+
<%= render 'faceted_search/link',
|
27
|
+
display_value: display_value,
|
28
|
+
path: path,
|
29
|
+
searchable: facet.searchable %>
|
27
30
|
</li>
|
28
31
|
<% end %>
|
29
32
|
</ol>
|
30
33
|
</div>
|
31
34
|
</li>
|
32
|
-
<% end %>
|
35
|
+
<% end %>
|
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.
|
4
|
+
version: 3.5.0
|
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: 2021-05-
|
13
|
+
date: 2021-05-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- app/models/faceted_search/facets/text.rb
|
141
141
|
- app/models/faceted_search/facets/tree.rb
|
142
142
|
- app/views/faceted_search/_facets.html.erb
|
143
|
+
- app/views/faceted_search/_link.html.erb
|
143
144
|
- app/views/faceted_search/facets/_facet-selected.html.erb
|
144
145
|
- app/views/faceted_search/facets/checkboxes/_all.html.erb
|
145
146
|
- app/views/faceted_search/facets/checkboxes/_selected.html.erb
|