filterrific 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +8 -26
- data/doc/meta.md +1 -4
- data/lib/filterrific.rb +2 -2
- data/lib/filterrific/action_controller_extension.rb +2 -0
- data/lib/filterrific/active_record_extension.rb +5 -2
- data/lib/filterrific/param_set.rb +11 -1
- data/lib/filterrific/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71ecbc7a011b1dee80252eb991f52226d43b667c
|
4
|
+
data.tar.gz: d802da3c9c28703e80a4756e9ef2ef9f05c77d2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9db85bf8387da951cee9db1271adb80a9e0ac8df13050272c9764a8cce28d212de28fa1390ae93922906b9e14b75a98931e8bd54206a2bb3b30fc0e1aef151ef
|
7
|
+
data.tar.gz: 30f5409875bd7183bdfc66ab3339a1ecaa6170751cf803129c641d46f61311b7a6ce2b086e7c4dfb48aa331e79c56ee11235fe71b38ca6ecc2d0dee3e4e4af99
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
7
7
|
|
8
8
|
Filterrific major versions match the Ruby on Rails major versions they work with.
|
9
9
|
|
10
|
+
## [4.0.0] - Dec. 31, 2017
|
11
|
+
|
12
|
+
* This is the first release of Filterrific specifically geared towards Rails 4.x. No functional changes, just new versioning system and removal of unused code.
|
13
|
+
|
10
14
|
## [3.0.0] - Dec. 31, 2017
|
11
15
|
|
12
16
|
* 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.
|
data/README.md
CHANGED
@@ -1,24 +1,17 @@
|
|
1
|
-
|
1
|
+
Filterrific
|
2
|
+
===========
|
2
3
|
|
3
4
|
Filterrific is a Rails Engine plugin that makes it easy to filter,
|
4
5
|
search, and sort your ActiveRecord lists:
|
5
6
|
|
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
|
-
|
16
7
|
***
|
17
8
|
|
18
9
|

|
19
10
|
|
20
11
|
***
|
21
12
|
|
13
|
+
Make sure to go to the fantastic [Filterrific documentation](http://filterrific.clearcove.ca)
|
14
|
+
to find out more!
|
22
15
|
|
23
16
|
### Installation
|
24
17
|
|
@@ -29,12 +22,6 @@ or with bundler in your Gemfile:
|
|
29
22
|
`gem 'filterrific'`
|
30
23
|
|
31
24
|
|
32
|
-
### Usage
|
33
|
-
|
34
|
-
Make sure to go to the fantastic [Filterrific documentation](http://filterrific.clearcove.ca)
|
35
|
-
to find out more!
|
36
|
-
|
37
|
-
|
38
25
|
### Compatibility
|
39
26
|
|
40
27
|
Every commit to Filterrific is automatically tested against the following scenarios:
|
@@ -42,16 +29,11 @@ Every commit to Filterrific is automatically tested against the following scenar
|
|
42
29
|
| Rails version | Ruby environments | Database adapters | Build status |
|
43
30
|
|---------------|--------------------------------|------------------------------------|--------------|
|
44
31
|
| Rails 5.x | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql2, postgresql |[](https://travis-ci.org/jhund/filterrific_demo)|
|
45
|
-
| Rails 4.
|
46
|
-
| Rails 4.1 | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql, mysql2, postgresql, sqlite3 |[](https://travis-ci.org/jhund/filterrific_demo)|
|
47
|
-
| Rails 4.0 | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql, mysql2, postgresql, sqlite3 |[](https://travis-ci.org/jhund/filterrific_demo)|
|
48
|
-
| Rails 3.2 | MRI 2.0.0, 2.1.7 | mysql, mysql2, postgresql, sqlite3 |[](https://travis-ci.org/jhund/filterrific_demo)|
|
49
|
-
|
50
|
-
Filterrific version 1.x should work on older versions of Rails and Ruby, however
|
51
|
-
the 1.x branch is not supported any more.
|
32
|
+
| Rails 4.x | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql2, postgresql |[](https://travis-ci.org/jhund/filterrific_demo)|
|
52
33
|
|
53
|
-
Filterrific up to version 2.1.
|
34
|
+
Filterrific up to version 2.1.x should work on Rails 3.2 and Ruby 1.9.3. I stopped testing it though as it became too cumbersome to manage gem dependencies.
|
54
35
|
|
36
|
+
Filterrific version 1.x should work on versions prior to Rails 3.2 and older Rubies, however the 1.x branch is not supported any more.
|
55
37
|
|
56
38
|
### Guidelines for submitting issues
|
57
39
|
|
@@ -91,4 +73,4 @@ If you think you've found a bug, or have a feature request, then create an issue
|
|
91
73
|
|
92
74
|
### Copyright
|
93
75
|
|
94
|
-
Copyright (c) 2010 -
|
76
|
+
Copyright (c) 2010 - 2017 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/filterrific/blob/master/MIT-LICENSE) for details.
|
data/doc/meta.md
CHANGED
@@ -9,10 +9,7 @@ For more info see: https://github.com/svenfuchs/gem-release#usage
|
|
9
9
|
## Steps for an update
|
10
10
|
|
11
11
|
1. Update code and commit it.
|
12
|
-
2. Add entry to CHANGELOG and commit it
|
13
|
-
* h1 for major release
|
14
|
-
* h2 for minor release
|
15
|
-
* h3 for patch release
|
12
|
+
2. Add entry to CHANGELOG and commit it.
|
16
13
|
3. Bump the version with one of these commands:
|
17
14
|
* `gem bump --version 1.1.1` # Bump the gem version to the given version number
|
18
15
|
* `gem bump --version major` # 0.0.1 -> 1.0.0
|
data/lib/filterrific.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
-
if Rails::VERSION::MAJOR !=
|
4
|
-
raise "\n\nThis version of Filterrific only works with Rails
|
3
|
+
if Rails::VERSION::MAJOR != 4
|
4
|
+
raise "\n\nThis version of Filterrific only works with Rails 4.x.\nPlease see the Filterrific README for the correct version of Filterrific to use with your version of Rails!\n\n"
|
5
5
|
end
|
6
6
|
|
7
7
|
require 'filterrific/version'
|
@@ -27,6 +27,8 @@ 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.
|
30
32
|
f_params = (filterrific_params || {}).stringify_keys
|
31
33
|
opts = opts.stringify_keys
|
32
34
|
pers_id = if false == opts['persistence_id']
|
@@ -54,9 +54,12 @@ 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
|
-
|
58
|
-
#
|
57
|
+
elsif Rails::VERSION::MAJOR <= 3
|
58
|
+
# Active Record 3: send `:scoped` to class to get an ActiveRecord::Relation
|
59
59
|
scoped
|
60
|
+
else
|
61
|
+
# Active Record 4 and later: Send `:all` to class to get an ActiveRecord::Relation
|
62
|
+
all
|
60
63
|
end
|
61
64
|
|
62
65
|
# Apply filterrific params
|
@@ -29,7 +29,17 @@ module Filterrific
|
|
29
29
|
# will be already initialized with the defaults.
|
30
30
|
filterrific_params = model_class.filterrific_default_filter_params if filterrific_params.blank?
|
31
31
|
if defined?(ActionController::Parameters) && filterrific_params.is_a?(ActionController::Parameters)
|
32
|
-
|
32
|
+
permissible_filter_params = []
|
33
|
+
model_class.filterrific_available_filters.each do |p|
|
34
|
+
if filterrific_params[p].is_a?(ActionController::Parameters)
|
35
|
+
permissible_filter_params << { p => filterrific_params[p].keys }
|
36
|
+
elsif filterrific_params[p].is_a?(Array)
|
37
|
+
permissible_filter_params << { p => [] }
|
38
|
+
else
|
39
|
+
permissible_filter_params << p
|
40
|
+
end
|
41
|
+
end
|
42
|
+
filterrific_params = filterrific_params.permit(permissible_filter_params).to_h.stringify_keys
|
33
43
|
else
|
34
44
|
filterrific_params.stringify_keys!
|
35
45
|
end
|
data/lib/filterrific/version.rb
CHANGED