filterrific 1.4.2 → 1.4.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
2
  SHA1:
3
- metadata.gz: 818d80584a2a4db43f268028613b856a6ef52528
4
- data.tar.gz: 3744f644a940ddccbb6233027a7a4b919e009547
3
+ metadata.gz: dfb96075da4c30641cdfb5fdf747706a310f0324
4
+ data.tar.gz: fc4f107545fa2838949eb88be2b0beee14927d14
5
5
  SHA512:
6
- metadata.gz: f7e1fe41394af2fc4e59e9daa1f0523d3b67a1d93288b047f5b76b8962adb84c7d0f61645639fa28d8cca5e6a2ed133fd01b927c7feea182040a4b9d35e0cc08
7
- data.tar.gz: 61bf2d0d764c43a252b637ade5b0f4161541d9aeb8ed9b4623acf07a1a96e9dd67023bb8dcc1820df3a8d97c78ba2e15daf7bc5d41281a1be20dfd395473b238
6
+ metadata.gz: 32d36a46d02d7fd55951b41c05e54022696dcccee1cb184fdf6da63bf469104e8279141a7fd620a4dbb49a24c8f579a58a4646963ef632f3672f75c8478d95b2
7
+ data.tar.gz: 1d427b2a134182022656d1ef5cc3347e2c3f05d9fdcb4bb81cb8d8ad15a1f0cac7e6266f73670dd979df1afa30433e4ba93ca1ef380837a41ef4f79fa6f0c372
data/CHANGELOG.md CHANGED
@@ -46,6 +46,9 @@ API changes
46
46
  * Dropped support for Rails <= 3.0.0 (because of ActiveRecord
47
47
  bug fixes in 3.1, and use of asset pipeline)
48
48
 
49
+ ### 1.4.3
50
+
51
+ * Handle case where Filterrific filter params are empty.
49
52
 
50
53
  ### 1.4.2
51
54
 
data/README.md CHANGED
@@ -1,8 +1,14 @@
1
1
  Filterrific
2
2
  ===========
3
3
 
4
- Filterrific is a Rails Engine plugin that makes it easy to add filtering,
5
- searching, and sorting to your ActiveRecord lists.
4
+ Filterrific is a Rails Engine plugin that makes it easy to filter,
5
+ search, and sort your ActiveRecord lists:
6
+
7
+ ***
8
+
9
+ ![A filterrific enhanced list](https://github.com/jhund/filterrific/blob/gh-pages/images/screenshot_s.png)
10
+
11
+ ***
6
12
 
7
13
  Make sure to go to the fantastic [Filterrific documentation](http://filterrific.clearcove.ca)
8
14
  to find out more!
@@ -43,6 +49,7 @@ I'm happy to help you if you encounter problems when using filterrific. You'll m
43
49
  * what version of Ruby are you using? (run `ruby -v` in your app root)
44
50
  * If you get an exception, include the entire stack trace, including the error message.
45
51
  * Include any relevant code snippets (your model, controller, and view code).
52
+ * When pasting code, please use [markdown code formatting](https://help.github.com/articles/github-flavored-markdown/#fenced-code-blocks). It will be much easier to read.
46
53
 
47
54
 
48
55
  ### Resources
@@ -66,4 +73,4 @@ I'm happy to help you if you encounter problems when using filterrific. You'll m
66
73
 
67
74
  ### Copyright
68
75
 
69
- Copyright (c) 2010 - 2014 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/filterrific/blob/master/MIT-LICENSE) for details.
76
+ Copyright (c) 2010 - 2015 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/filterrific/blob/master/MIT-LICENSE) for details.
@@ -0,0 +1,33 @@
1
+ # Filterrific Rails Conf Talk
2
+
3
+
4
+ Topics to cover:
5
+
6
+ * filter and sort ActiveRecord lists end to end with lots of code
7
+ * AR scope patterns
8
+ * advanced use cases
9
+ * export to CSV/XLS
10
+ * saved searches
11
+ * full text search
12
+ * multiple form inputs for single scope
13
+ * checkbox arrays (collection_check_boxes)
14
+ * filter persistence strategies
15
+ * session
16
+ * none (query param)
17
+ * database (saved searches)
18
+
19
+ Target audience:
20
+
21
+ * intermediate
22
+
23
+
24
+ Title ideas:
25
+
26
+ * Tame/awesomify your ActiveRecord lists with Filterrific
27
+ * Dive deep into ActiveRecord scopes, and learn about Filterrific
28
+ * Slice and dice your data in many ways with AR scopes and Filterrific
29
+
30
+ Other talk ideas (possibly lightning talks?):
31
+
32
+ * How to safely mutate objects in Rails
33
+ * Service objects, DCI, processors: all dependencies go in one direction
data/doc/scratchpad.md CHANGED
@@ -25,6 +25,7 @@ Ruby 1.8.7
25
25
  Ruby 1.9.3
26
26
  Ruby 2.0
27
27
  Ruby 2.1
28
+ Ruby 2.2 No No No No
28
29
 
29
30
  Each combination is also tested for postgres and mysql
30
31
 
@@ -58,6 +58,7 @@ module Filterrific
58
58
  def filterrific_sorting_link(filterrific, sort_key, options = {})
59
59
  options = {
60
60
  :active_column_class => 'filterrific_current_sort_column',
61
+ :inactive_column_class => 'filterrific_sort_column',
61
62
  :ascending_indicator => '⬆',
62
63
  :default_sort_direction => 'asc',
63
64
  :descending_indicator => '⬇',
@@ -96,6 +97,10 @@ module Filterrific
96
97
  # new sort column, change sort column
97
98
  new_sort_direction = options[:default_sort_direction]
98
99
  new_sorting = [new_sort_key, new_sort_direction].join('_')
100
+ css_classes = [
101
+ options[:inactive_column_class],
102
+ options[:html_attrs].delete(:class)
103
+ ].compact.join(' ')
99
104
  new_filterrific_params = filterrific.to_hash
100
105
  .with_indifferent_access
101
106
  .merge(options[:sorting_scope_name] => new_sorting)
@@ -103,7 +108,7 @@ module Filterrific
103
108
  link_to(
104
109
  options[:label],
105
110
  url_for(url_for_attrs),
106
- options[:html_attrs].reverse_merge(:method => :get, :remote => true)
111
+ options[:html_attrs].reverse_merge(:class => css_classes, :method => :get, :remote => true)
107
112
  )
108
113
  end
109
114
  end
@@ -41,17 +41,26 @@ module Filterrific
41
41
  raise(ArgumentError, "Invalid Filterrific::ParamSet: #{ filterrific_param_set.inspect }")
42
42
  end
43
43
 
44
- # set initial ar_proxy to including class
45
- ar_proxy = self
44
+ # initialize active record relation
45
+ ar_rel = if ::ActiveRecord::Relation === self
46
+ # self is already an ActiveRecord::Relation, use as is
47
+ self
48
+ elsif 3 >= Rails::VERSION::MAJOR
49
+ # Active Record 3: send `:scoped` to class to get an ActiveRecord::Relation
50
+ scoped
51
+ else
52
+ # Active Record 4 and later: Send `:all` to class to get an ActiveRecord::Relation
53
+ all
54
+ end
46
55
 
47
56
  # apply filterrific params
48
57
  self.filterrific_filter_names.each do |filter_name|
49
58
  filter_param = filterrific_param_set.send(filter_name)
50
59
  next if filter_param.blank? # skip blank filter_params
51
- ar_proxy = ar_proxy.send(filter_name, filter_param)
60
+ ar_rel = ar_rel.send(filter_name, filter_param)
52
61
  end
53
62
 
54
- ar_proxy
63
+ ar_rel
55
64
  end
56
65
 
57
66
  protected
@@ -1,3 +1,3 @@
1
1
  module Filterrific
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.3"
3
3
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'active_record'
3
3
  require 'filterrific/active_record_extension'
4
4
 
5
- ActiveRecord::Base.extend Filterrific::ActiveRecordExtension::ClassMethods
5
+ ActiveRecord::Base.extend Filterrific::ActiveRecordExtension
6
6
 
7
7
  module Filterrific
8
8
 
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: 1.4.2
4
+ version: 1.4.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: 2014-10-18 00:00:00.000000000 Z
11
+ date: 2015-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,8 +80,8 @@ dependencies:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.5.5
83
- description: Filterrific is a Rails Engine plugin that makes it easy to add filtering,
84
- searching, and sorting to your ActiveRecord lists.
83
+ description: Filterrific is a Rails Engine plugin that makes it easy to filter, search,
84
+ and sort your ActiveRecord lists.
85
85
  email: jhund@clearcove.ca
86
86
  executables: []
87
87
  extensions: []
@@ -101,6 +101,7 @@ files:
101
101
  - doc/development_notes/model_api.rb
102
102
  - doc/development_notes/view_api.txt
103
103
  - doc/meta.md
104
+ - doc/rails_conf_talk.md
104
105
  - doc/scratchpad.md
105
106
  - lib/filterrific.rb
106
107
  - lib/filterrific/action_view_extension.rb
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  version: '0'
134
135
  requirements: []
135
136
  rubyforge_project:
136
- rubygems_version: 2.2.2
137
+ rubygems_version: 2.4.5
137
138
  signing_key:
138
139
  specification_version: 4
139
140
  summary: A Rails engine plugin for filtering ActiveRecord lists.