faceted_search 3.5.15 → 3.6.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
  SHA256:
3
- metadata.gz: 118ee09dcce76e63a448bfeace430cd56bc9c9f80afa92c252590f133085f04c
4
- data.tar.gz: 571935067534cf0ad244dd66d250b8adf7e9d038bd3c35d3b8746d661e677210
3
+ metadata.gz: 9f3a631dcd6d16b556a25e2db756808ce7173708ccd02a23fc6854c5e8c30f01
4
+ data.tar.gz: ea0745c3ed87fd105f497dadd007a8417a01c1cc6f2925e0c93fe0aaa3e208d9
5
5
  SHA512:
6
- metadata.gz: 3ad23f4aa1e796de72646961794ea8d1c63a64fcd4ec0333710dd1277aec2af316bc62dbd58ea84eb24dd5857d5a661b01c69af310c39bd8c95786a52eeabf0e
7
- data.tar.gz: 67ee216d08726b5966073ac33549ed89c4d47433df205a5e56a33a3137dd175a3e1f852b58b6e660527ede3833eb25b677ce4353c94a7a5117026120713ee032
6
+ metadata.gz: dbe3a9ae5256ba40b72fd9d7cd2568d41bcfa96c13c999652e3dfc55894c4eb5dd6fbf1b580e98bb79183243d9798f303e2122de481b3d47d0582ab18c1c0800
7
+ data.tar.gz: d8eb1931049507e9f175c9c08c1e92ed883d87e1f29d21c039a80f50483158e55a75e6453b5c10cb8048af07867abc3e46a379423b42d832487b0a5bf8380b4c
data/README.md CHANGED
@@ -49,6 +49,7 @@ Create a model defining your facets:
49
49
  children.order(:title)
50
50
  }
51
51
  }
52
+ filter_with_boolean :active
52
53
  # Other tree option, shows all values
53
54
  # filter_with_full_tree :categories, {
54
55
  # habtm: true,
@@ -0,0 +1,14 @@
1
+ module FacetedSearch
2
+ class Facets::Boolean < Facets::Default
3
+
4
+ def selected?
5
+ params == "true"
6
+ end
7
+
8
+ def add_scope(scope)
9
+ selected? ? scope.where(name => true)
10
+ : scope
11
+ end
12
+
13
+ end
14
+ end
@@ -95,6 +95,10 @@ module FacetedSearch
95
95
  add_facet Range, value, options
96
96
  end
97
97
 
98
+ def filter_with_boolean(value, options = {})
99
+ add_facet Boolean, value, options
100
+ end
101
+
98
102
  def params_for(value, options)
99
103
  param_name = (options[:param_name] || value).to_sym
100
104
  @params[param_name] if @params.has_key? param_name
@@ -20,10 +20,12 @@ reset ||= 'Reset'
20
20
  <% partial = "#{facet.kind.underscore}/all" %>
21
21
  <%= render partial, facet: facet, anchor: anchor %>
22
22
  <% end %>
23
- <li class="faceted__facet__reinit">
24
- <a href="<%= facets.path %>" rel="nofollow">
25
- <i class="fas fa-ban"></i>
26
- <%= reset %>
27
- </a>
28
- </li>
23
+ <% if facets.has_params? %>
24
+ <li class="faceted__facet__reinit">
25
+ <a href="<%= facets.path %>" rel="nofollow">
26
+ <i class="fas fa-ban"></i>
27
+ <%= reset %>
28
+ </a>
29
+ </li>
30
+ <% end %>
29
31
  </ul>
@@ -0,0 +1,15 @@
1
+ <%
2
+ anchor ||= ''
3
+ selected = facet.selected?
4
+ target = !selected
5
+ path = facet.facets.path_for(facet, target) + anchor
6
+ %>
7
+ <li>
8
+ <label>
9
+ <input type="checkbox"
10
+ onclick="window.location.href='<%= path %>'"
11
+ <%= 'checked' if facet.selected? %>
12
+ />
13
+ <%= facet.title %>
14
+ </label>
15
+ </li>
@@ -0,0 +1,8 @@
1
+ <% anchor ||= '' %>
2
+ <% value = params[:facets][facet.param_name] if params[:facets] && params[:facets].has_key?(facet.param_name) %>
3
+ <% unless value.blank? %>
4
+ <%= render 'faceted_search/facets/facet-selected',
5
+ title: facet.title,
6
+ value: facet.title,
7
+ path: facet.facets.path_for(facet, nil) + anchor %>
8
+ <% end %>
@@ -1,3 +1,3 @@
1
1
  module FacetedSearch
2
- VERSION = '3.5.15'
2
+ VERSION = '3.6.0'
3
3
  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.5.15
4
+ version: 3.6.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: 2022-07-18 00:00:00.000000000 Z
13
+ date: 2023-01-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -112,7 +112,7 @@ dependencies:
112
112
  version: '0'
113
113
  description: All you need to create a faceted search, as simple as possible
114
114
  email:
115
- - alevy@lespoupees.paris
115
+ - arnaud.levy@noesya.coop
116
116
  - sebastien.gaya@gmail.com
117
117
  - sebousan@gmail.com
118
118
  executables: []
@@ -124,6 +124,7 @@ files:
124
124
  - Rakefile
125
125
  - app/assets/stylesheets/faceted_search.sass
126
126
  - app/models/faceted_search/facets.rb
127
+ - app/models/faceted_search/facets/boolean.rb
127
128
  - app/models/faceted_search/facets/checkboxes.rb
128
129
  - app/models/faceted_search/facets/date.rb
129
130
  - app/models/faceted_search/facets/default.rb
@@ -137,6 +138,8 @@ files:
137
138
  - app/views/faceted_search/_facets.html.erb
138
139
  - app/views/faceted_search/_link.html.erb
139
140
  - app/views/faceted_search/facets/_facet-selected.html.erb
141
+ - app/views/faceted_search/facets/boolean/_all.html.erb
142
+ - app/views/faceted_search/facets/boolean/_selected.html.erb
140
143
  - app/views/faceted_search/facets/checkboxes/_all.html.erb
141
144
  - app/views/faceted_search/facets/checkboxes/_selected.html.erb
142
145
  - app/views/faceted_search/facets/date/_all.html.erb
@@ -160,7 +163,7 @@ files:
160
163
  - lib/faceted_search/railtie.rb
161
164
  - lib/faceted_search/version.rb
162
165
  - lib/tasks/faceted_search_tasks.rake
163
- homepage: http://github.com/lespoupeesrusses/faceted_search
166
+ homepage: http://github.com/noesya/faceted_search
164
167
  licenses:
165
168
  - MIT
166
169
  metadata: {}