forty_facets 0.0.4 → 0.0.5

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: 25afbbdd35eee3919efcdbf6766ef3173ad1a2fe
4
- data.tar.gz: 864056c9c65d99a49a890177d7ff87440a18d62b
3
+ metadata.gz: 83edd5ef19658c58ba68e8a0e45a01f84e03703f
4
+ data.tar.gz: 0134b19f051971d1cdba2aa1009517a1b61e60b3
5
5
  SHA512:
6
- metadata.gz: 6f40a9650e2b73e552092a810e33c06390f81f554185e6d8af4749b881828ed5065a06e013ca1956b08eff121920bf19b613598a931cbc1fd60fe687da915187
7
- data.tar.gz: 2e49716fd8a9b30ffe935d49976f2175068507c2c4448996913b2c08ea1e10e9714a3c91265560e3d573f0804f13c9100effc31a317f654418df3a20517d67e5
6
+ metadata.gz: 342c89c8336bfdc51ccbc487ccd30d1eaa4de7caf0c2617d6d6da86291326bfd9d41c9a3dae0f0e4cee46988a16084f633b99bdab04428d79b5e6a2e77303dfe
7
+ data.tar.gz: 74d86c743767e2a2f76a3d442e3ea60c3985f385ba6c91dd8e5a15fdefa5535381ebb3dd482dc46addbc66011e381f0e3aaff145691f8b17f0031129fc18fcaa
data/README.md CHANGED
@@ -53,9 +53,14 @@ class HomeController < ApplicationController
53
53
  class MovieSearch < FortyFacets::FacetSearch
54
54
  model 'Movie' # which model to search for
55
55
  text :title # filter by a generic string entered by the user
56
+ range :price, name: 'Price' # filter by ranges for decimal fields
56
57
  facet :genre, name: 'Genre' # generate a filter with all values of 'genre' occuring in the result
57
58
  facet :year, name: 'Releaseyear', order: :year # additionally oder values in the year field
58
59
  facet :studio, name: 'Studio', order: :name
60
+
61
+ orders 'Title' => :title,
62
+ 'price, cheap first' => "price asc",
63
+ 'price, expensive first' => {price: :desc, title: :desc}
59
64
  end
60
65
 
61
66
  def index
@@ -27,7 +27,7 @@ module FortyFacets
27
27
 
28
28
  def facet
29
29
  my_column = association.association_foreign_key
30
- counts = without.result.select("#{my_column} as foreign_id, count(#{my_column}) as occurrences").group(my_column)
30
+ counts = without.result.reorder('').select("#{my_column} as foreign_id, count(#{my_column}) as occurrences").group(my_column)
31
31
  entities_by_id = klass.find(counts.map(&:foreign_id)).group_by(&:id)
32
32
  facet = counts.inject([]) do |sum, count|
33
33
  facet_entity = entities_by_id[count.foreign_id].first
@@ -17,7 +17,7 @@ module FortyFacets
17
17
  end
18
18
 
19
19
  def absolute_interval
20
- @abosultes ||= without.result.select("min(#{filter_definition.model_field}) as min, max(#{filter_definition.model_field}) as max").first
20
+ @abosultes ||= without.result.reorder('').select("min(#{filter_definition.model_field}) as min, max(#{filter_definition.model_field}) as max").first
21
21
  end
22
22
 
23
23
  def absolute_min
@@ -1,3 +1,3 @@
1
1
  module FortyFacets
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forty_facets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Axel Tetzlaff