filterrific 5.2.3 → 5.2.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
  SHA256:
3
- metadata.gz: 67e7935ca4ceb8fce5778b36879ee941aef8105f23e8a211d070eb6c8cc2cd82
4
- data.tar.gz: 5285cb9d2f1c18988f00a82b51733cccbbef67fe02f9f673754a3c2387117c56
3
+ metadata.gz: 7a53832d4bfd9c1cb30eed06e91d869a4f0b342463ec90114a7e7c3daa8f182e
4
+ data.tar.gz: f3de3b1fdf50a5c7f6edf6db0b344975e63c3f5f5d0360719b2d3985da42367f
5
5
  SHA512:
6
- metadata.gz: 797e8e2c763a3949277f1fd1e1bd2521adbac190175286331c59dd7cba17636c41ffeb6dda91325cb45bfe97c497934124b8a92c9d3ebd625a8744068337d6e5
7
- data.tar.gz: 4272dfb90de22d22e494a9d1d800daec913ba1a64a3f7e3c399ee6e91de11aa4b82e569ad2dbd9c75f9da9b71a88860046333a6c19cc39a2e8a711da92d88a4b
6
+ metadata.gz: 9350f8e1758891f7bde26afb7eb71b85c84a91f6a74f7dfacd04e47daa2f599e0ea9fba93620c3ce7af5704bb52daf350860e413dffbb9a37e6e8a0381b1de24
7
+ data.tar.gz: 1ed64d381e113c63ada585acee2bdc4f17cda96aff0b2f408e1cb9e06fe2a05c7cb33d223ef857f3170573e0f2aa210fa065d0f7f45e231c20dccacc2c079237
data/CHANGELOG.md CHANGED
@@ -7,6 +7,15 @@ 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.5] - Feb 12, 2023
11
+
12
+ * Fixes an issue around presence of current_sorting
13
+
14
+ ## [5.2.4] - Jan 30, 2023
15
+
16
+ * Remove JS dependency on jquery
17
+ * Make code compliant with standard.rb rules
18
+
10
19
  ## [5.2.3] - Mar. 18, 2022
11
20
 
12
21
  * Added support for Rails 7
data/README.md CHANGED
@@ -66,8 +66,8 @@ If you think you've found a bug, or have a feature request, then create an issue
66
66
  ### Resources
67
67
 
68
68
  * [Documentation](http://filterrific.clearcove.ca)
69
- * [Live demo](https://filterrific-demo.herokuapp.com) using classic Rails views.
70
- * [Live JSON API demo](https://filterrific-json-api-demo.herokuapp.com/) using React and Mobx.
69
+ * [Demo App](https://github.com/jhund/filterrific_demo) using classic Rails views.
70
+ * [API Demo App](https://github.com/jhund/filterrific_json_api_demo) using React and Mobx.
71
71
  * [Changelog](https://github.com/jhund/filterrific/blob/master/CHANGELOG.md)
72
72
  * [Source code (github)](https://github.com/jhund/filterrific)
73
73
  * [Issues](https://github.com/jhund/filterrific/issues)
@@ -86,4 +86,4 @@ If you think you've found a bug, or have a feature request, then create an issue
86
86
 
87
87
  ### Copyright
88
88
 
89
- Copyright (c) 2010 - 2019 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/filterrific/blob/master/MIT-LICENSE) for details.
89
+ Copyright (c) 2010 - 2023 Jo Hund. See [(MIT) LICENSE](https://github.com/jhund/filterrific/blob/master/MIT-LICENSE) for details.
data/Rakefile CHANGED
@@ -1,17 +1,17 @@
1
1
  begin
2
- require 'bundler/setup'
2
+ require "bundler/setup"
3
3
  rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
5
  end
6
6
 
7
7
  Bundler::GemHelper.install_tasks
8
8
 
9
- require 'rake/testtask'
9
+ require "rake/testtask"
10
10
  Rake::TestTask.new do |test|
11
- test.libs << 'spec'
12
- test.pattern = 'spec/**/*_spec.rb'
11
+ test.libs << "spec"
12
+ test.pattern = "spec/**/*_spec.rb"
13
13
  test.verbose = true
14
14
  end
15
15
 
16
- require 'wwtd/tasks'
17
- task default: 'wwtd:local'
16
+ require "wwtd/tasks"
17
+ task default: "wwtd:local"
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Javascript behaviors for Filterrific.
3
+ * http://filterrific.clearcove.ca
4
+ *
5
+ * Released under the MIT license
6
+ *
7
+ */
8
+
9
+ // Create global Filterrific namespace
10
+ if (typeof Filterrific === 'undefined') {
11
+ var Filterrific = {};
12
+ }
13
+
14
+ // Define function to submit Filterrific filter form
15
+ Filterrific.submitFilterForm = function() {
16
+ var form = Filterrific.findParents(this, '#filterrific_filter')[0];
17
+
18
+ // send before event
19
+ form.dispatchEvent(new Event('loadingFilterrificResults'));
20
+
21
+ // turn on spinner
22
+ document.querySelector('.filterrific_spinner').style.display = 'block';
23
+
24
+ // Abort previous XMLHttpRequest request
25
+ if (Filterrific.lastRequest && Filterrific.lastRequest.readyState != 4) {
26
+ Filterrific.lastRequest.abort();
27
+ }
28
+
29
+ // Submit XMLHttpRequest request
30
+ Filterrific.lastRequest = Filterrific.prepareRequest(form);
31
+ Filterrific.lastRequest.send();
32
+ };
33
+
34
+ Filterrific.prepareRequest = function(form) {
35
+ var url = form.getAttribute('action'),
36
+ formData = new FormData(form),
37
+ params = new URLSearchParams(formData),
38
+ xhr = new XMLHttpRequest();
39
+
40
+ if (url.indexOf('?') < 0) {
41
+ url += '?' + params;
42
+ } else {
43
+ url += '&' + params;
44
+ }
45
+
46
+ xhr.open("GET", url, true);
47
+ xhr.setRequestHeader('Accept', 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01');
48
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
49
+ xhr.onreadystatechange = function() {
50
+ if (xhr.readyState === XMLHttpRequest.DONE) {
51
+ return Filterrific.processResponse(form, xhr);
52
+ }
53
+ }
54
+
55
+ return xhr;
56
+ }
57
+
58
+ Filterrific.processResponse = function(form, xhr) {
59
+ var rawResponse = (_ref = xhr.response) != null ? _ref : xhr.responseText,
60
+ type = xhr.getResponseHeader('Content-Type'),
61
+ response;
62
+
63
+ if (typeof rawResponse === 'string' && typeof type === 'string') {
64
+ if (type.match(/\bjson\b/)) {
65
+ try {
66
+ response = JSON.parse(rawResponse);
67
+ } catch (_error) {}
68
+ } else if (type.match(/\b(?:java|ecma)script\b/)) {
69
+ script = document.createElement('script');
70
+ script.setAttribute('nonce', Filterrific.cspNonce());
71
+ script.text = rawResponse;
72
+ document.head.appendChild(script).parentNode.removeChild(script);
73
+ } else if (type.match(/\b(xml|html|svg)\b/)) {
74
+ parser = new DOMParser();
75
+ type = type.replace(/;.+/, '');
76
+ try {
77
+ response = parser.parseFromString(rawResponse, type);
78
+ } catch (_error) {}
79
+ }
80
+ }
81
+
82
+ // send after event
83
+ form.dispatchEvent(new Event('loadedFilterrificResults'));
84
+ document.querySelector('.filterrific_spinner').style.display = 'none';
85
+
86
+ return response;
87
+ }
88
+
89
+ Filterrific.cspNonce = function() {
90
+ return document.querySelector("meta[name=csp-nonce]")?.content
91
+ }
92
+
93
+ Filterrific.findParents = function(elem, selector) {
94
+ var elements = [];
95
+ var ishaveselector = selector !== undefined;
96
+
97
+ while ((elem = elem.parentElement) !== null) {
98
+ if (elem.nodeType !== Node.ELEMENT_NODE) {
99
+ continue;
100
+ }
101
+
102
+ if (!ishaveselector || elem.matches(selector)) {
103
+ elements.push(elem);
104
+ }
105
+ }
106
+
107
+ return elements;
108
+ };
109
+
110
+ Filterrific.observe_field = function(inputs_selector, frequency, callback) {
111
+ frequency = frequency * 1000;
112
+
113
+ document.querySelectorAll(inputs_selector).forEach(input => {
114
+ var prev = input.value;
115
+ var check = function() {
116
+ // if removed clear the interval and don't fire the callback
117
+ if (removed()) {
118
+ if(ti) clearInterval(ti);
119
+ return;
120
+ }
121
+ var val = input.value;
122
+ if (prev != val) {
123
+ prev = val;
124
+
125
+ // invokes the callback on $this
126
+ if (callback && typeof callback === 'function') {
127
+ callback.call(input);
128
+ }
129
+ }
130
+ };
131
+
132
+ var removed = function() {
133
+ return input.closest('html').length == 0
134
+ };
135
+
136
+ var reset = function() {
137
+ if (ti) {
138
+ clearInterval(ti);
139
+ ti = setInterval(check, frequency);
140
+ }
141
+ };
142
+ check();
143
+ var ti = setInterval(check, frequency); // invoke check periodically
144
+ // reset counter after user interaction
145
+ // mousemove is for selects
146
+ input.addEventListener('keyup', reset);
147
+ input.addEventListener('click', reset);
148
+ input.addEventListener('mousemove', reset);
149
+ })
150
+ };
151
+
152
+
153
+ Filterrific.init = function() {
154
+ // Add change event handler to all Filterrific filter inputs.
155
+ var filterrificForm = document.querySelector('#filterrific_filter');
156
+ filterrificForm.querySelectorAll('input, textarea, select, textarea').forEach(input => {
157
+ input.addEventListener('change', Filterrific.submitFilterForm)
158
+ })
159
+
160
+ // Add periodic observer to selected inputs.
161
+ // Use this for text fields you want to observe for change, e.g., a search input.
162
+ Filterrific.observe_field(
163
+ ".filterrific-periodically-observed",
164
+ 0.5,
165
+ Filterrific.submitFilterForm
166
+ );
167
+ };
168
+
169
+
170
+ // Initialize event observers on document ready and turbolinks page:load
171
+ document.addEventListener('turbolinks:load', Filterrific.init);
172
+ document.addEventListener('DOMContentLoaded', Filterrific.init)
@@ -1,13 +1,11 @@
1
- # -*- coding: utf-8 -*-
2
1
  #
3
2
  # Adds Filterrific methods ActionController instances
4
3
  #
5
4
  module Filterrific
6
5
  module ActionControllerExtension
7
-
8
6
  include HasResetFilterrificUrlMixin
9
7
 
10
- protected
8
+ protected
11
9
 
12
10
  # @param model_class [Class]
13
11
  # @param filterrific_params [ActionController::Params, Hash] typically the
@@ -33,29 +31,29 @@ module Filterrific
33
31
  def initialize_filterrific(model_class, filterrific_params, opts = {})
34
32
  f_params = (filterrific_params || {}).stringify_keys
35
33
  opts = opts.stringify_keys
36
- pers_id = if false == opts['persistence_id']
34
+ pers_id = if opts["persistence_id"] == false
37
35
  nil
38
36
  else
39
- opts['persistence_id'] || compute_default_persistence_id
37
+ opts["persistence_id"] || compute_default_persistence_id
40
38
  end
41
39
 
42
- if (f_params.delete('reset_filterrific'))
40
+ if f_params.delete("reset_filterrific")
43
41
  # Reset query and session_persisted params
44
- session[pers_id] = nil if pers_id
45
- redirect_to url_for({}) and return false # requires `or return` in calling action.
42
+ session[pers_id] = nil if pers_id
43
+ redirect_to url_for({}) and return false # requires `or return` in calling action.
46
44
  end
47
45
 
48
46
  f_params = compute_filterrific_params(model_class, f_params, opts, pers_id)
49
47
 
50
48
  filterrific = Filterrific::ParamSet.new(model_class, f_params)
51
- filterrific.select_options = opts['select_options']
52
- session[pers_id] = filterrific.to_hash if pers_id
49
+ filterrific.select_options = opts["select_options"]
50
+ session[pers_id] = filterrific.to_hash if pers_id
53
51
  filterrific
54
52
  end
55
53
 
56
54
  # Computes a default persistence id based on controller and action name
57
55
  def compute_default_persistence_id
58
- [controller_name, action_name].join('#')
56
+ [controller_name, action_name].join("#")
59
57
  end
60
58
 
61
59
  # Computes filterrific params using a number of strategies. Limits params
@@ -68,17 +66,17 @@ module Filterrific
68
66
  # Defaults to true.
69
67
  # @param persistence_id [String, nil]
70
68
  def compute_filterrific_params(model_class, filterrific_params, opts, persistence_id)
71
- opts = { "sanitize_params" => true }.merge(opts.stringify_keys)
69
+ opts = {"sanitize_params" => true}.merge(opts.stringify_keys)
72
70
  r = (
73
71
  filterrific_params.presence || # start with passed in params
74
72
  (persistence_id && session[persistence_id].presence) || # then try session persisted params if persistence_id is present
75
- opts['default_filter_params'] || # then use passed in opts
73
+ opts["default_filter_params"] || # then use passed in opts
76
74
  model_class.filterrific_default_filter_params # finally use model_class defaults
77
75
  ).stringify_keys
78
- r.slice!(*opts['available_filters'].map(&:to_s)) if opts['available_filters']
76
+ r.slice!(*opts["available_filters"].map(&:to_s)) if opts["available_filters"]
79
77
  # Sanitize params to prevent reflected XSS attack
80
78
  if opts["sanitize_params"]
81
- r.each { |k,v| r[k] = sanitize_filterrific_param(r[k]) }
79
+ r.each { |k, v| r[k] = sanitize_filterrific_param(r[k]) }
82
80
  end
83
81
  r
84
82
  end
@@ -94,7 +92,7 @@ module Filterrific
94
92
  val.map { |e| sanitize_filterrific_param(e) }
95
93
  when Hash
96
94
  # Return Hash
97
- val.inject({}) { |m, (k,v)| m[k] = sanitize_filterrific_param(v); m }
95
+ val.each_with_object({}) { |(k, v), m| m[k] = sanitize_filterrific_param(v); }
98
96
  when NilClass
99
97
  # Nothing to do, use val as is
100
98
  val
@@ -105,6 +103,5 @@ module Filterrific
105
103
  val
106
104
  end
107
105
  end
108
-
109
106
  end
110
107
  end
@@ -1,10 +1,8 @@
1
- # -*- coding: utf-8 -*-
2
1
  #
3
2
  # Adds Filterrific view helpers to ActionView instances
4
3
  #
5
4
  module Filterrific
6
5
  module ActionViewExtension
7
-
8
6
  include HasResetFilterrificUrlMixin
9
7
 
10
8
  # Sets all options on form_for to defaults that work with Filterrific
@@ -17,8 +15,8 @@ module Filterrific
17
15
  options[:html][:method] ||= :get
18
16
  options[:html][:id] ||= :filterrific_filter
19
17
  options[:url] ||= url_for(
20
- :controller => controller.controller_name,
21
- :action => controller.action_name
18
+ controller: controller.controller_name,
19
+ action: controller.action_name
22
20
  )
23
21
  form_for(record, options, &block)
24
22
  end
@@ -27,7 +25,7 @@ module Filterrific
27
25
  def render_filterrific_spinner
28
26
  %(
29
27
  <span class="filterrific_spinner" style="display:none;">
30
- #{ image_tag('filterrific/filterrific-spinner.gif', alt: '', role: 'presentation') }
28
+ #{image_tag("filterrific/filterrific-spinner.gif", alt: "", role: "presentation")}
31
29
  </span>
32
30
  ).html_safe
33
31
  end
@@ -65,23 +63,27 @@ module Filterrific
65
63
  # Override the target URL attributes to be used for `url_for`. Default: {} (current URL).
66
64
  def filterrific_sorting_link(filterrific, sort_key, opts = {})
67
65
  opts = {
68
- :active_column_class => 'filterrific_current_sort_column',
69
- :inactive_column_class => 'filterrific_sort_column',
70
- :ascending_indicator => '',
71
- :default_sort_direction => 'asc',
72
- :descending_indicator => '',
73
- :html_attrs => {},
74
- :label => sort_key.to_s.humanize,
75
- :sorting_scope_name => :sorted_by,
76
- :url_for_attrs => {},
77
- :as => :filterrific
66
+ active_column_class: "filterrific_current_sort_column",
67
+ inactive_column_class: "filterrific_sort_column",
68
+ ascending_indicator: "",
69
+ default_sort_direction: "asc",
70
+ descending_indicator: "",
71
+ html_attrs: {},
72
+ label: sort_key.to_s.humanize,
73
+ sorting_scope_name: :sorted_by,
74
+ url_for_attrs: {},
75
+ as: :filterrific
78
76
  }.merge(opts)
79
77
  opts.merge!(
80
- :html_attrs => opts[:html_attrs].with_indifferent_access,
81
- :current_sorting => (current_sorting = filterrific.send(opts[:sorting_scope_name])),
82
- :current_sort_key => current_sorting ? current_sorting.gsub(/_asc|_desc/, '') : nil,
83
- :current_sort_direction => current_sorting ? (current_sorting =~ /_desc\z/ ? 'desc' : 'asc') : nil,
84
- :current_sort_direction_indicator => (current_sorting =~ /_desc\z/ ? opts[:descending_indicator] : opts[:ascending_indicator]),
78
+ html_attrs: opts[:html_attrs].with_indifferent_access,
79
+ current_sorting: (current_sorting = filterrific.send(opts[:sorting_scope_name])),
80
+ current_sort_key: current_sorting ? current_sorting.gsub(/_asc|_desc/, "") : nil,
81
+ current_sort_direction: if current_sorting
82
+ current_sorting.end_with?("_desc") ? "desc" : "asc"
83
+ end,
84
+ current_sort_direction_indicator: if current_sorting
85
+ (current_sorting.end_with?("_desc") ? opts[:descending_indicator] : opts[:ascending_indicator])
86
+ end
85
87
  )
86
88
  new_sort_key = sort_key.to_s
87
89
  if new_sort_key == opts[:current_sort_key]
@@ -93,7 +95,7 @@ module Filterrific
93
95
  end
94
96
  end
95
97
 
96
- protected
98
+ protected
97
99
 
98
100
  # Renders HTML to reverse sort order on currently sorted column.
99
101
  # @param filterrific [Filterrific::ParamSet]
@@ -102,20 +104,20 @@ module Filterrific
102
104
  # @return [String] an HTML fragment
103
105
  def filterrific_sorting_link_reverse_order(filterrific, new_sort_key, opts)
104
106
  # current sort column, toggle search_direction
105
- new_sort_direction = 'asc' == opts[:current_sort_direction] ? 'desc' : 'asc'
106
- new_sorting = safe_join([new_sort_key, new_sort_direction], '_')
107
+ new_sort_direction = opts[:current_sort_direction] == "asc" ? "desc" : "asc"
108
+ new_sorting = safe_join([new_sort_key, new_sort_direction], "_")
107
109
  css_classes = safe_join([
108
110
  opts[:active_column_class],
109
111
  opts[:html_attrs].delete(:class)
110
- ].compact, ' ')
112
+ ].compact, " ")
111
113
  new_filterrific_params = filterrific.to_hash
112
- .with_indifferent_access
113
- .merge(opts[:sorting_scope_name] => new_sorting)
114
+ .with_indifferent_access
115
+ .merge(opts[:sorting_scope_name] => new_sorting)
114
116
  url_for_attrs = opts[:url_for_attrs].merge(opts[:as] => new_filterrific_params)
115
117
  link_to(
116
- safe_join([opts[:label], opts[:current_sort_direction_indicator]], ' '),
118
+ safe_join([opts[:label], opts[:current_sort_direction_indicator]], " "),
117
119
  url_for(url_for_attrs),
118
- opts[:html_attrs].reverse_merge(:class => css_classes, :method => :get, :remote => true)
120
+ opts[:html_attrs].reverse_merge(class: css_classes, method: :get, remote: true)
119
121
  )
120
122
  end
121
123
 
@@ -126,21 +128,20 @@ module Filterrific
126
128
  # @return [String] an HTML fragment
127
129
  def filterrific_sorting_link_new_column(filterrific, new_sort_key, opts)
128
130
  new_sort_direction = opts[:default_sort_direction]
129
- new_sorting = safe_join([new_sort_key, new_sort_direction], '_')
131
+ new_sorting = safe_join([new_sort_key, new_sort_direction], "_")
130
132
  css_classes = safe_join([
131
133
  opts[:inactive_column_class],
132
134
  opts[:html_attrs].delete(:class)
133
- ].compact, ' ')
135
+ ].compact, " ")
134
136
  new_filterrific_params = filterrific.to_hash
135
- .with_indifferent_access
136
- .merge(opts[:sorting_scope_name] => new_sorting)
137
+ .with_indifferent_access
138
+ .merge(opts[:sorting_scope_name] => new_sorting)
137
139
  url_for_attrs = opts[:url_for_attrs].merge(opts[:as] => new_filterrific_params)
138
140
  link_to(
139
141
  opts[:label],
140
142
  url_for(url_for_attrs),
141
- opts[:html_attrs].reverse_merge(:class => css_classes, :method => :get, :remote => true)
143
+ opts[:html_attrs].reverse_merge(class: css_classes, method: :get, remote: true)
142
144
  )
143
145
  end
144
-
145
146
  end
146
147
  end
@@ -1,12 +1,10 @@
1
- # -*- coding: utf-8 -*-
2
1
  #
3
2
  # Adds Filterrific methods to ActiveRecord::Base model_class.
4
3
  #
5
- require 'filterrific/param_set'
4
+ require "filterrific/param_set"
6
5
 
7
6
  module Filterrific
8
7
  module ActiveRecordExtension
9
-
10
8
  # Adds Filterrific behavior to class when called like so:
11
9
  #
12
10
  # filterrific(
@@ -34,7 +32,6 @@ module Filterrific
34
32
  validate_filterrific_available_filters
35
33
  assign_filterrific_default_filter_params(opts)
36
34
  validate_filterrific_default_filter_params
37
-
38
35
  end
39
36
 
40
37
  # Returns ActiveRecord relation based on filterrific_param_set.
@@ -46,7 +43,7 @@ module Filterrific
46
43
  unless filterrific_param_set.is_a?(Filterrific::ParamSet)
47
44
  raise(
48
45
  ArgumentError,
49
- "Invalid Filterrific::ParamSet: #{ filterrific_param_set.inspect }"
46
+ "Invalid Filterrific::ParamSet: #{filterrific_param_set.inspect}"
50
47
  )
51
48
  end
52
49
 
@@ -69,7 +66,7 @@ module Filterrific
69
66
  ar_rel
70
67
  end
71
68
 
72
- protected
69
+ protected
73
70
 
74
71
  # Defines a :sorted_by scope based on attrs
75
72
  # @param attrs [Hash] with keys as
@@ -83,7 +80,7 @@ module Filterrific
83
80
  # @return [void]
84
81
  def assign_filterrific_available_filters(opts)
85
82
  self.filterrific_available_filters = (
86
- filterrific_available_filters + (opts['available_filters'] || [])
83
+ filterrific_available_filters + (opts["available_filters"] || [])
87
84
  ).map(&:to_s).uniq.sort
88
85
  end
89
86
 
@@ -97,7 +94,7 @@ module Filterrific
97
94
 
98
95
  def assign_filterrific_default_filter_params(opts)
99
96
  self.filterrific_default_filter_params = (
100
- opts['default_filter_params'] || {}
97
+ opts["default_filter_params"] || {}
101
98
  ).stringify_keys
102
99
  end
103
100
 
@@ -106,9 +103,8 @@ module Filterrific
106
103
  if (
107
104
  inv_fdfps = filterrific_default_filter_params.keys - filterrific_available_filters
108
105
  ).any?
109
- raise(ArgumentError, "Invalid default filter params: #{ inv_fdfps.inspect }")
106
+ raise(ArgumentError, "Invalid default filter params: #{inv_fdfps.inspect}")
110
107
  end
111
108
  end
112
-
113
109
  end
114
110
  end
@@ -1,16 +1,13 @@
1
- # -*- coding: utf-8 -*-
1
+ require "filterrific/param_set"
2
2
 
3
- require 'filterrific/param_set'
3
+ require "filterrific/has_reset_filterrific_url_mixin"
4
4
 
5
- require 'filterrific/has_reset_filterrific_url_mixin'
6
-
7
- require 'filterrific/action_controller_extension'
8
- require 'filterrific/action_view_extension'
9
- require 'filterrific/active_record_extension'
5
+ require "filterrific/action_controller_extension"
6
+ require "filterrific/action_view_extension"
7
+ require "filterrific/active_record_extension"
10
8
 
11
9
  module Filterrific
12
10
  class Engine < ::Rails::Engine
13
-
14
11
  # It's an engine so that we can add javascript and image assets
15
12
  # to the asset pipeline.
16
13
 
@@ -27,6 +24,5 @@ module Filterrific
27
24
  ActiveSupport.on_load :active_record do
28
25
  extend Filterrific::ActiveRecordExtension
29
26
  end
30
-
31
27
  end
32
28
  end
@@ -1,16 +1,13 @@
1
- # -*- coding: utf-8 -*-
2
1
  #
3
2
  # Adds reset_filterrific_url to controllers and views
4
3
  #
5
4
  module Filterrific
6
5
  module HasResetFilterrificUrlMixin
7
-
8
6
  # Returns a url that can be used to reset the Filterrific params
9
7
  def reset_filterrific_url(opts = {})
10
8
  url_for(
11
- { filterrific: { reset_filterrific: true } }.merge(opts)
9
+ {filterrific: {reset_filterrific: true}}.merge(opts)
12
10
  )
13
11
  end
14
-
15
12
  end
16
13
  end