filterrific 2.1.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -62
- data/README.md +18 -5
- data/doc/scratchpad.md +4 -0
- data/lib/filterrific.rb +4 -0
- data/lib/filterrific/action_controller_extension.rb +0 -2
- data/lib/filterrific/active_record_extension.rb +2 -5
- data/lib/filterrific/engine_api.rb +26 -0
- data/lib/filterrific/param_set.rb +0 -8
- data/lib/filterrific/version.rb +1 -1
- data/lib/filterrific_api.rb +7 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 771515c7025eb50eb134294d03a3a92006e7bd13
|
4
|
+
data.tar.gz: 050cae50516c688d0decb04e42867ea6b850368e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4acf9f6d39fa6c2aa6bd1820fbfe760ca39df1acd19494cd9010afc5ae027d625291a34ad42f5ded6b737ac3a60a5ca143e9559c79fa2f40dd87df6e38417024
|
7
|
+
data.tar.gz: 6c15ede2f3ab0f0cf36a885dbc4d9826c13fa37978a916aed0718e123644efee580b7468178edd339490975fb58605dc1dcb7737d6287e57f0f739ab2cef3a13
|
data/CHANGELOG.md
CHANGED
@@ -1,53 +1,25 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
name_asc: 'Name (A-Z)',
|
16
|
-
name_desc: 'Name (Z-A)',
|
17
|
-
},
|
18
|
-
)
|
19
|
-
|
20
|
-
filterrific(
|
21
|
-
default_filter_params: { sorted_by: 'name_asc' },
|
22
|
-
custom_scopes: [
|
23
|
-
:with_country,
|
24
|
-
...
|
25
|
-
],
|
26
|
-
lookup_filters: [ # column_value_filters:, value_filters:
|
27
|
-
:with_country_id,
|
28
|
-
:with_state,
|
29
|
-
]
|
30
|
-
search_query: {
|
31
|
-
match_terms: :any, # [:all]
|
32
|
-
auto_wildcard: :suffix, # [:prefix, :both, :none]
|
33
|
-
columns: [:first_name, :email, :last_name],
|
34
|
-
case_sensitive: false, # [true]
|
35
|
-
},
|
36
|
-
sorted_by: {
|
37
|
-
name_asc: 'Name (A-Z)',
|
38
|
-
name_desc: 'Name (Z-A)',
|
39
|
-
},
|
40
|
-
)
|
41
|
-
|
42
|
-
### 2.1.2
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
Filterrific major versions match the Ruby on Rails major versions they work with.
|
9
|
+
|
10
|
+
## [3.0.0] - Dec. 31, 2017
|
11
|
+
|
12
|
+
* This is the first release of Filterrific specifically geared towards Rails 3.x. No functional changes, just new versioning system and removal of unused code.
|
13
|
+
|
14
|
+
## [2.1.2] - Nov. 11, 2016
|
43
15
|
|
44
16
|
* Removed older way of initializing assets, relying on config/initializers/assets.rb for all versions of Rails.
|
45
17
|
|
46
|
-
|
18
|
+
## [2.1.1] - Nov. 11, 2016
|
47
19
|
|
48
20
|
* Reverted asset initialization back to working state for versions prior to Rails5.
|
49
21
|
|
50
|
-
## 2.1.0
|
22
|
+
## [2.1.0] - Nov. 6, 2016
|
51
23
|
|
52
24
|
* Updated filterrific for Rails 5 compatibility:
|
53
25
|
* Turbolinks compatibility (thanks @olegantonyan)
|
@@ -58,7 +30,7 @@
|
|
58
30
|
* Improved param casting to Int: hyphens and zeros (thanks @grit96)
|
59
31
|
|
60
32
|
|
61
|
-
|
33
|
+
## [2.0.5] - May 4, 2015
|
62
34
|
|
63
35
|
* Feature: Allow disabling of session persistence by passing `false` as
|
64
36
|
`:persistence_id` option.
|
@@ -68,7 +40,7 @@
|
|
68
40
|
|
69
41
|
|
70
42
|
|
71
|
-
|
43
|
+
## [2.0.4] - Mar. 10, 2015
|
72
44
|
|
73
45
|
* Objectify nested params so that they render correctly on the form when
|
74
46
|
restored from session or URL params.
|
@@ -77,26 +49,26 @@
|
|
77
49
|
|
78
50
|
|
79
51
|
|
80
|
-
|
52
|
+
## [2.0.3] - Jan. 30, 2015
|
81
53
|
|
82
54
|
* Cleaned up obsolete option names
|
83
55
|
|
84
56
|
|
85
57
|
|
86
|
-
|
58
|
+
## [2.0.2] - Jan. 28, 2015
|
87
59
|
|
88
60
|
* Fixed bugs in ActionControllerExtension
|
89
61
|
* Improved test coverage
|
90
62
|
|
91
63
|
|
92
64
|
|
93
|
-
|
65
|
+
## [2.0.1] - Jan. 28, 2015
|
94
66
|
|
95
67
|
* Fixed regression with Rails 3.2 (doesn't support `#deep_stringify_keys`)
|
96
68
|
|
97
69
|
|
98
70
|
|
99
|
-
|
71
|
+
## [2.0.0] - Jan. 28, 2015
|
100
72
|
|
101
73
|
API changes:
|
102
74
|
|
@@ -114,25 +86,25 @@ API changes:
|
|
114
86
|
|
115
87
|
|
116
88
|
|
117
|
-
|
89
|
+
## [1.4.3] - Jan. 12, 2015
|
118
90
|
|
119
91
|
* Handle case where Filterrific filter params are empty.
|
120
92
|
|
121
93
|
|
122
94
|
|
123
|
-
|
95
|
+
## [1.4.2] - Oct. 18, 2014
|
124
96
|
|
125
97
|
* Updated initialization of ActiveRecord and ActionView extensions again
|
126
98
|
|
127
99
|
|
128
100
|
|
129
|
-
|
101
|
+
## [1.4.1] - Oct. 15, 2014
|
130
102
|
|
131
103
|
* Updated initialization of ActiveRecord and ActionView extensions
|
132
104
|
|
133
105
|
|
134
106
|
|
135
|
-
|
107
|
+
## [1.4.0] - Oct. 13, 2014
|
136
108
|
|
137
109
|
* Better support for new versions of Rails (integration tests are done in filterrific_demo)
|
138
110
|
* Fixed asset pipeline for filterrific-spinner.gif.
|
@@ -143,13 +115,13 @@ API changes:
|
|
143
115
|
|
144
116
|
|
145
117
|
|
146
|
-
|
118
|
+
## [1.3.1] - Jun. 18, 2014
|
147
119
|
|
148
120
|
* Changed ParamSet#select_options so that a complete hash can be assigned
|
149
121
|
|
150
122
|
|
151
123
|
|
152
|
-
## 1.3.0
|
124
|
+
## [1.3.0] - Jun. 3, 2014
|
153
125
|
|
154
126
|
* Added ParamSet#select_options (thanks @pnomolos).
|
155
127
|
* Added ParamSet#signature to quickly test two param_sets for equality.
|
@@ -164,7 +136,7 @@ API changes:
|
|
164
136
|
|
165
137
|
|
166
138
|
|
167
|
-
## 1.2.0
|
139
|
+
## [1.2.0] - May 16, 2013
|
168
140
|
|
169
141
|
* Added simple wrapper for Filterrific::ParamSet.new so that it can be
|
170
142
|
instantiated with Filterrific.new instead of Filterrific::ParamSet.new.
|
@@ -177,7 +149,7 @@ API changes:
|
|
177
149
|
|
178
150
|
|
179
151
|
|
180
|
-
## 1.1.0
|
152
|
+
## [1.1.0] - May 8, 2013
|
181
153
|
|
182
154
|
* Major refactor.
|
183
155
|
* Added specs.
|
@@ -186,25 +158,25 @@ API changes:
|
|
186
158
|
|
187
159
|
|
188
160
|
|
189
|
-
|
161
|
+
## [1.0.1] - Nov. 9, 2011
|
190
162
|
|
191
163
|
* Bug fix: Replaced stringify_keys with map.to_s (filter_names is an Array, not a Hash!).
|
192
164
|
|
193
165
|
|
194
166
|
|
195
|
-
|
167
|
+
## [1.0.0] - Nov. 9, 2011
|
196
168
|
|
197
169
|
* Support for Rails 3.1.
|
198
170
|
* New model api.
|
199
171
|
|
200
172
|
|
201
173
|
|
202
|
-
## 0.1.0,
|
174
|
+
## [0.1.0] - Aug. 1, 2010
|
203
175
|
|
204
176
|
* Replicate functionality of Rails 2.3 version.
|
205
177
|
|
206
178
|
|
207
179
|
|
208
|
-
|
180
|
+
## [0.0.1] - Jul. 30, 2010
|
209
181
|
|
210
182
|
* Initial setup.
|
data/README.md
CHANGED
@@ -1,17 +1,24 @@
|
|
1
|
-
Filterrific
|
2
|
-
===========
|
1
|
+
# Filterrific
|
3
2
|
|
4
3
|
Filterrific is a Rails Engine plugin that makes it easy to filter,
|
5
4
|
search, and sort your ActiveRecord lists:
|
6
5
|
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* Makes heavy use of ActiveRecord Scopes
|
10
|
+
* ActionController helpers to shuttle filter params from ActionView forms to ActiveRecord based models, and to return matching records back from ActiveRecord to ActionView.
|
11
|
+
* Form helpers to build powerful search and filter forms with ease.
|
12
|
+
* Javascript assets to auto-submit filter form on change via AJAX.
|
13
|
+
* Image asset to show a spinner in the Filterrific form when new records are being loaded via AJAX.
|
14
|
+
* API option to use Filterrific with Rails API mode. Just use `gem 'filterrific', require: 'filterrific_api'` in your Gemfile.
|
15
|
+
|
7
16
|
***
|
8
17
|
|
9
18
|
![A filterrific enhanced list](https://github.com/jhund/filterrific/blob/gh-pages/images/screenshot_s.png)
|
10
19
|
|
11
20
|
***
|
12
21
|
|
13
|
-
Make sure to go to the fantastic [Filterrific documentation](http://filterrific.clearcove.ca)
|
14
|
-
to find out more!
|
15
22
|
|
16
23
|
### Installation
|
17
24
|
|
@@ -22,6 +29,12 @@ or with bundler in your Gemfile:
|
|
22
29
|
`gem 'filterrific'`
|
23
30
|
|
24
31
|
|
32
|
+
### Usage
|
33
|
+
|
34
|
+
Make sure to go to the fantastic [Filterrific documentation](http://filterrific.clearcove.ca)
|
35
|
+
to find out more!
|
36
|
+
|
37
|
+
|
25
38
|
### Compatibility
|
26
39
|
|
27
40
|
Every commit to Filterrific is automatically tested against the following scenarios:
|
@@ -78,4 +91,4 @@ If you think you've found a bug, or have a feature request, then create an issue
|
|
78
91
|
|
79
92
|
### Copyright
|
80
93
|
|
81
|
-
Copyright (c) 2010 -
|
94
|
+
Copyright (c) 2010 - 2018 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/filterrific/blob/master/MIT-LICENSE) for details.
|
data/doc/scratchpad.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## TODO
|
4
4
|
|
5
|
+
* Go to deep_stringify_keys (in ActionControllerExtension#initialize_filterrific)
|
6
|
+
* Lock Gemfile to correct version of Rails
|
7
|
+
* Add Rails major version check to filterrific.rb
|
8
|
+
* In ParamSet#condition_filterrific_params: Why are we type casting integers?
|
5
9
|
* add check that no filter_name conflicts with existing methods on included ActiveRecord class (See https://github.com/jhund/filterrific/issues/17)
|
6
10
|
* fix reset url, make controller method, helper method
|
7
11
|
|
data/lib/filterrific.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
+
if Rails::VERSION::MAJOR != 3
|
4
|
+
raise "\n\nThis version of Filterrific only works with Rails 3.x.\nPlease see the Filterrific README for the correct version of Filterrific to use with your version of Rails!\n\n"
|
5
|
+
end
|
6
|
+
|
3
7
|
require 'filterrific/version'
|
4
8
|
require 'filterrific/engine'
|
5
9
|
|
@@ -27,8 +27,6 @@ module Filterrific
|
|
27
27
|
# dynamic values.
|
28
28
|
# @return [Filterrific::ParamSet]
|
29
29
|
def initialize_filterrific(model_class, filterrific_params, opts = {})
|
30
|
-
# We used #deep_stringify_keys, however that breaks on Rails 3.x, so we
|
31
|
-
# went back to #stringify_keys which should be sufficient.
|
32
30
|
f_params = (filterrific_params || {}).stringify_keys
|
33
31
|
opts = opts.stringify_keys
|
34
32
|
pers_id = if false == opts['persistence_id']
|
@@ -54,12 +54,9 @@ module Filterrific
|
|
54
54
|
ar_rel = if ActiveRecord::Relation === self
|
55
55
|
# self is already an ActiveRecord::Relation, use as is
|
56
56
|
self
|
57
|
-
elsif Rails::VERSION::MAJOR <= 3
|
58
|
-
# Active Record 3: send `:scoped` to class to get an ActiveRecord::Relation
|
59
|
-
scoped
|
60
57
|
else
|
61
|
-
#
|
62
|
-
|
58
|
+
# Send `:scoped` to class to get an ActiveRecord::Relation
|
59
|
+
scoped
|
63
60
|
end
|
64
61
|
|
65
62
|
# Apply filterrific params
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'filterrific/param_set'
|
4
|
+
|
5
|
+
require 'filterrific/action_controller_extension'
|
6
|
+
require 'filterrific/active_record_extension'
|
7
|
+
|
8
|
+
module Filterrific
|
9
|
+
class EngineApi < ::Rails::Engine
|
10
|
+
|
11
|
+
TODO: Since this is API only, I don't think we need an engine!
|
12
|
+
# It's an engine so that we can add javascript and image assets
|
13
|
+
# to the asset pipeline.
|
14
|
+
|
15
|
+
isolate_namespace Filterrific
|
16
|
+
|
17
|
+
ActiveSupport.on_load :action_controller do
|
18
|
+
include Filterrific::ActionControllerExtension
|
19
|
+
end
|
20
|
+
|
21
|
+
ActiveSupport.on_load :active_record do
|
22
|
+
extend Filterrific::ActiveRecordExtension
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -45,13 +45,6 @@ module Filterrific
|
|
45
45
|
model_class.filterrific_find(self)
|
46
46
|
end
|
47
47
|
|
48
|
-
# Returns true if this instance of Filterrific has params other than the
|
49
|
-
# defaults.
|
50
|
-
# @return [Boolean]
|
51
|
-
def has_filters_applied?
|
52
|
-
sdf
|
53
|
-
end
|
54
|
-
|
55
48
|
# Returns Filterrific::ParamSet as hash (used for URL params and serialization)
|
56
49
|
# @return [Hash] with stringified keys
|
57
50
|
def to_hash
|
@@ -83,7 +76,6 @@ module Filterrific
|
|
83
76
|
protected
|
84
77
|
|
85
78
|
# Conditions params: Evaluates Procs and type casts integer values.
|
86
|
-
# TODO: Why are we type casting integers?
|
87
79
|
# @param fp [Hash] the filterrific params hash
|
88
80
|
# @return[Hash] the conditioned params hash
|
89
81
|
def condition_filterrific_params(fp)
|
data/lib/filterrific/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filterrific
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jo Hund
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Filterrific is a Rails Engine plugin that makes it easy to filter, search,
|
14
14
|
and sort your ActiveRecord lists.
|
@@ -37,9 +37,11 @@ files:
|
|
37
37
|
- lib/filterrific/action_view_extension.rb
|
38
38
|
- lib/filterrific/active_record_extension.rb
|
39
39
|
- lib/filterrific/engine.rb
|
40
|
+
- lib/filterrific/engine_api.rb
|
40
41
|
- lib/filterrific/has_reset_filterrific_url_mixin.rb
|
41
42
|
- lib/filterrific/param_set.rb
|
42
43
|
- lib/filterrific/version.rb
|
44
|
+
- lib/filterrific_api.rb
|
43
45
|
- spec/filterrific/action_controller_extension_spec.rb
|
44
46
|
- spec/filterrific/action_view_extension_spec.rb
|
45
47
|
- spec/filterrific/active_record_extension_spec.rb
|
@@ -66,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
68
|
version: '0'
|
67
69
|
requirements: []
|
68
70
|
rubyforge_project:
|
69
|
-
rubygems_version: 2.
|
71
|
+
rubygems_version: 2.6.11
|
70
72
|
signing_key:
|
71
73
|
specification_version: 4
|
72
74
|
summary: A Rails engine plugin for filtering ActiveRecord lists.
|