filterrific 5.2.0 → 5.2.3

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
- SHA1:
3
- metadata.gz: 3503569504542aef40ac725cf71644ff6df5eb49
4
- data.tar.gz: 95cba3781467d0a1c96cdbfd05381afbd27d0e12
2
+ SHA256:
3
+ metadata.gz: 67e7935ca4ceb8fce5778b36879ee941aef8105f23e8a211d070eb6c8cc2cd82
4
+ data.tar.gz: 5285cb9d2f1c18988f00a82b51733cccbbef67fe02f9f673754a3c2387117c56
5
5
  SHA512:
6
- metadata.gz: d1641bc77e7522db73133f6b7b3f55af5d0ce10240f1da252d498b2ace1c0d6c0967a4c708b0d20a6681de43173d393c8aeba0a389ed653ed3942cefab0d9b9d
7
- data.tar.gz: 0e4acf669d4aeb877e1ec6132de3adf7a91f94eaa4ecdc552cd2149e2ca705d1096f4c456392a6157fcc0ab740a6c27d8d6ccf650c26f211d70587628e0f8a81
6
+ metadata.gz: 797e8e2c763a3949277f1fd1e1bd2521adbac190175286331c59dd7cba17636c41ffeb6dda91325cb45bfe97c497934124b8a92c9d3ebd625a8744068337d6e5
7
+ data.tar.gz: 4272dfb90de22d22e494a9d1d800daec913ba1a64a3f7e3c399ee6e91de11aa4b82e569ad2dbd9c75f9da9b71a88860046333a6c19cc39a2e8a711da92d88a4b
data/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ 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
+ ## [5.2.3] - Mar. 18, 2022
11
+
12
+ * Added support for Rails 7
13
+
14
+ ## [5.2.2] - Jul. 11, 2021
15
+
16
+ * Fixed Ruby 2.7 deprecated warning when trying to regex match an Integer.
17
+ * Added ability to pass custom url parameter instead of default :filterrific.
18
+ * Added basic Aria attrs to spinner for accessibility.
19
+ * Improved concurrent ajax requests: Abort prior request when new ones are triggered.
20
+
21
+ ## [5.2.1] - Aug. 5, 2019
22
+
23
+ * Fixed issue where uncommitted code was pushed to rubygems and broke array filters.
24
+
10
25
  ## [5.2.0] - Jul. 21, 2019
11
26
 
12
27
  * Make Filterrific master branch compatible with Rails 5 and 6.
data/README.md CHANGED
@@ -39,13 +39,13 @@ to find out more!
39
39
 
40
40
  Every commit to Filterrific is automatically tested against the following scenarios:
41
41
 
42
- |Filterrific version | Rails version | Ruby environments | Database adapters | Build status |
43
- |--------------------|----------------|--------------------------------|------------------------------------|--------------|
44
- | 5.x | Rails 5.x, 6.x | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql2, postgresql |[![Build Status](https://travis-ci.org/jhund/filterrific_demo.svg?branch=rails-5.x)](https://travis-ci.org/jhund/filterrific_demo)|
45
- | 4.x | Rails 4.x | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql, mysql2, postgresql, sqlite3 |[![Build Status](https://travis-ci.org/jhund/filterrific_demo.svg?branch=rails-4.x)](https://travis-ci.org/jhund/filterrific_demo)|
46
- | 3.x | Rails 3.2 | MRI 2.0.0, 2.1.7 | mysql, mysql2, postgresql, sqlite3 | Not tested|
47
- | 2.x | Rails 3.2 | MRI 1.9.3 | mysql, mysql2, postgresql, sqlite3 | Not tested|
48
- | 1.x | < 3.2 | MRI <= 1.9.3 | mysql, mysql2, postgresql, sqlite3 | Not tested|
42
+ |Filterrific version | Rails version | Ruby environments | Database adapters | Build status |
43
+ |--------------------|---------------------|--------------------------------|------------------------------------|--------------|
44
+ | 5.x | Rails 5.x, 6.x, 7.x | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql2, postgresql |[![Build Status](https://travis-ci.org/jhund/filterrific_demo.svg?branch=rails-5.x)](https://travis-ci.org/jhund/filterrific_demo)|
45
+ | 4.x | Rails 4.x | MRI 2.0.0, 2.1.7, 2.2.3, 2.3.1 | mysql, mysql2, postgresql, sqlite3 |[![Build Status](https://travis-ci.org/jhund/filterrific_demo.svg?branch=rails-4.x)](https://travis-ci.org/jhund/filterrific_demo)|
46
+ | 3.x | Rails 3.2 | MRI 2.0.0, 2.1.7 | mysql, mysql2, postgresql, sqlite3 | Not tested|
47
+ | 2.x | Rails 3.2 | MRI 1.9.3 | mysql, mysql2, postgresql, sqlite3 | Not tested|
48
+ | 1.x | < 3.2 | MRI <= 1.9.3 | mysql, mysql2, postgresql, sqlite3 | Not tested|
49
49
 
50
50
  ### Guidelines for submitting issues
51
51
 
@@ -25,8 +25,14 @@ Filterrific.submitFilterForm = function(){
25
25
  $(form).trigger('loadingFilterrificResults');
26
26
  // turn on spinner
27
27
  $('.filterrific_spinner').show();
28
+
29
+ // Abort previous ajax request
30
+ if (Filterrific.lastRequest && Filterrific.lastRequest.readyState != 4) {
31
+ Filterrific.lastRequest.abort();
32
+ }
33
+
28
34
  // Submit ajax request
29
- $.ajax({
35
+ Filterrific.lastRequest = $.ajax({
30
36
  url: url,
31
37
  data: form.serialize(),
32
38
  type: 'GET',
@@ -0,0 +1,12 @@
1
+ # Filterrific JS handling
2
+
3
+ Filterrific JS and assets can be used in a number of scenarios:
4
+
5
+ ## Rails Sprockets (asset pipeline)
6
+
7
+ ## Rails with webpacker
8
+
9
+ * https://www.reddit.com/r/rails/comments/d4o691/can_webpacker_pull_in_assets_from_a_rails_engine/
10
+
11
+ ## No JS assets, just API mode
12
+
@@ -1,3 +1,7 @@
1
+ Flexport's style guide has interesting guidelines for filter widgets:
2
+
3
+ https://www.flexport.com/design/guidelines/filtering
4
+
1
5
  All view related aspects of filterrific are handled via the view API:
2
6
 
3
7
  <%= filterrific_form_for @filterrific do |f| %>
data/doc/meta.md CHANGED
@@ -5,7 +5,6 @@ I use the gem-release gem
5
5
  For more info see: https://github.com/svenfuchs/gem-release#usage
6
6
 
7
7
 
8
-
9
8
  ## Steps for an update
10
9
 
11
10
  1. Update code and commit it.
@@ -15,17 +14,33 @@ For more info see: https://github.com/svenfuchs/gem-release#usage
15
14
  * `gem bump --version major` # 0.0.1 -> 1.0.0
16
15
  * `gem bump --version minor` # 0.0.1 -> 0.1.0
17
16
  * `gem bump --version patch` # 0.0.1 -> 0.0.2
18
- 4. Release it.
17
+ 4. Make sure there are no uncommitted changes! They will be pushed to rubygems.
18
+ 5. Release it.
19
19
  * `gem release`
20
- 5. Create a git tag and push to origin.
20
+ 6. Create a git tag and push to origin.
21
21
  `gem tag`
22
22
 
23
23
 
24
-
25
24
  ## How to run specs
26
25
 
27
- `bundle exec rake`
26
+ `bundle exec rake` in the filterrific repo
27
+
28
+
29
+ ## How to support a new major Rails version
30
+
31
+ Follow these steps when starting support for a new Rails major version:
32
+
33
+ * In `filterrific`
34
+ * Archive the current major rails version into a new branch off of master, e.g., when starting to support Rails 6, create a new branch for `5.x` from current master. This will be the branch used for ongoing 5.x support, and all new development for Rails 6 will happen in the `master` branch.
35
+ * Make all changes required to support a new version of Rails.
36
+ * Release the first `filterrific` version for Rails 6: `6.0.0`.
28
37
 
38
+ * In `filterrific_demo`
39
+ * Following the same example for Rails 6:
40
+ * Make sure that the `5.x` branch is up-to-date with master, and with current filterrific.
41
+ * Create a new `6.x` branch. In that branch create a brand new rails app using a current version of Rails 6.
42
+ * Make sure that the app works with the relevant version of `filterrific`.
43
+ * Deploy demo app to heroku.
29
44
 
30
45
 
31
46
  ## Travis CI
@@ -37,8 +52,8 @@ a branch for each minor version of Rails that is tested and supported.
37
52
  Sequence of a release:
38
53
 
39
54
  * finish updates in filterrific
40
- * run specs in each filterrific_demo branch (via `rake`)
41
- * when all specs pass, release filterrific (see above for steps)
55
+ * update filterrific_demo Gemfile to refer to local filterrific via path: "../filterrific"
56
+ * start the app and exercise it (currently there are no automated tests)
57
+ * when everything works as expected, release filterrific (see above for steps)
42
58
  * after new filterrific is released, add new release version to each branch in
43
- filterrific_demo and push each branch to trigger a Travis CI build for the
44
- new filterrific release.
59
+ filterrific_demo.
data/doc/scratchpad.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Filterrific scratchpad
2
2
 
3
+ ## 2021 Initiative
4
+
3
5
  ## TODO
4
6
 
5
- * add check that no filter_name conflicts with existing methods on included ActiveRecord class (See https://github.com/jhund/filterrific/issues/17)
7
+ * Update SW architecture and documentation according to Osterhuis Philosophy of software architecture/design book (mark advanced controller options as such to keep interface to learn simple)
6
8
 
7
9
  ## Travis
8
10
 
@@ -27,7 +27,7 @@ module Filterrific
27
27
  def render_filterrific_spinner
28
28
  %(
29
29
  <span class="filterrific_spinner" style="display:none;">
30
- #{ image_tag('filterrific/filterrific-spinner.gif') }
30
+ #{ image_tag('filterrific/filterrific-spinner.gif', alt: '', role: 'presentation') }
31
31
  </span>
32
32
  ).html_safe
33
33
  end
@@ -74,6 +74,7 @@ module Filterrific
74
74
  :label => sort_key.to_s.humanize,
75
75
  :sorting_scope_name => :sorted_by,
76
76
  :url_for_attrs => {},
77
+ :as => :filterrific
77
78
  }.merge(opts)
78
79
  opts.merge!(
79
80
  :html_attrs => opts[:html_attrs].with_indifferent_access,
@@ -110,7 +111,7 @@ module Filterrific
110
111
  new_filterrific_params = filterrific.to_hash
111
112
  .with_indifferent_access
112
113
  .merge(opts[:sorting_scope_name] => new_sorting)
113
- url_for_attrs = opts[:url_for_attrs].merge(:filterrific => new_filterrific_params)
114
+ url_for_attrs = opts[:url_for_attrs].merge(opts[:as] => new_filterrific_params)
114
115
  link_to(
115
116
  safe_join([opts[:label], opts[:current_sort_direction_indicator]], ' '),
116
117
  url_for(url_for_attrs),
@@ -133,7 +134,7 @@ module Filterrific
133
134
  new_filterrific_params = filterrific.to_hash
134
135
  .with_indifferent_access
135
136
  .merge(opts[:sorting_scope_name] => new_sorting)
136
- url_for_attrs = opts[:url_for_attrs].merge(:filterrific => new_filterrific_params)
137
+ url_for_attrs = opts[:url_for_attrs].merge(opts[:as] => new_filterrific_params)
137
138
  link_to(
138
139
  opts[:label],
139
140
  url_for(url_for_attrs),
@@ -96,12 +96,12 @@ module Filterrific
96
96
  fp[key] = val.call
97
97
  when val.is_a?(Array)
98
98
  # type cast integers in the array
99
- fp[key] = fp[key].map { |e| e =~ integer_detector_regex ? e.to_i : e }.find_all { |e| }
99
+ fp[key] = fp[key].map { |e| e =~ integer_detector_regex ? e.to_i : e }
100
100
  when val.is_a?(Hash)
101
101
  # type cast Hash to OpenStruct so that nested params render correctly
102
102
  # in the form
103
103
  fp[key] = OpenStruct.new(fp[key])
104
- when val =~ integer_detector_regex
104
+ when val.is_a?(String) && val =~ integer_detector_regex
105
105
  # type cast integer
106
106
  fp[key] = fp[key].to_i
107
107
  end
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module Filterrific
4
- VERSION = "5.2.0"
4
+ VERSION = "5.2.3"
5
5
  end
data/lib/filterrific.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- if ![5,6].include?(Rails::VERSION::MAJOR)
4
- raise "\n\nThis version of Filterrific only works with Rails 5 and 6.\nPlease see the Filterrific README for the correct version of Filterrific to use with your version of Rails!\n\n"
3
+ if ![5,6,7].include?(Rails::VERSION::MAJOR)
4
+ raise "\n\nThis version of Filterrific only works with Rails 5, 6 and 7.\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'
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: 5.2.0
4
+ version: 5.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jo Hund
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-21 00:00:00.000000000 Z
11
+ date: 2022-03-18 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.
@@ -28,6 +28,7 @@ files:
28
28
  - doc/Overview diagram.graffle/image1.tiff
29
29
  - doc/development_notes/api_design.txt
30
30
  - doc/development_notes/controller_api.txt
31
+ - doc/development_notes/javascript_handling.md
31
32
  - doc/development_notes/model_api.rb
32
33
  - doc/development_notes/view_api.txt
33
34
  - doc/meta.md
@@ -65,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
66
  - !ruby/object:Gem::Version
66
67
  version: '0'
67
68
  requirements: []
68
- rubyforge_project:
69
- rubygems_version: 2.6.14
69
+ rubygems_version: 3.1.6
70
70
  signing_key:
71
71
  specification_version: 4
72
72
  summary: A Rails engine plugin for filtering ActiveRecord lists.