active_scaffold 3.4.14 → 3.4.16

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dd09eacd583985f362d688856906e072120a233
4
- data.tar.gz: 3d48f8933ac709ea1f6b9e4495b1144ab4510abd
3
+ metadata.gz: 247539a2068b350fca651a90998fd9627de11326
4
+ data.tar.gz: fe55bfa49b3670fed3d8015034eab74343d80aab
5
5
  SHA512:
6
- metadata.gz: 15888fe68ed0b4c072285d1dab51508ac3f2f5efb90a8bcf100d84324d8ed5734b2adab150e8f456062c1300a4a1383d3922529825f2668e7cd6ffaacccd18b0
7
- data.tar.gz: 74c98c0d0578b2bf00c652b4e645f9d029bceae3140dd0432c2340dd8f88461bea5bbb891577d04f90f0b52928f4ea248fe2298ad86cf9872b82ccf8bdc4c080
6
+ metadata.gz: 528632a5420784e879854874f60fad64d4705569021d9b57278cc2144d2301efbe2180176f23d7a521eb2cca1efe17f67abdf04cce45dc87ffed2ad4e20e16bc
7
+ data.tar.gz: 954b32ea74a131e29b0555612a9f2f444ccead1887a12d65be00bf80a3b14d8fca914152219603c7a31d7e3aaa63bedcd72d45118d8637246b0ef6281e19fe59
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ = 3.4.16
2
+ - add scoped_query to list methods, so it can be used for calculations, like each_record_in_scope is used to iterate over every filtered record
3
+ - fix field_search_ignore? and search_ignore?
4
+ - fix reset on search forms loaded with session search
5
+
1
6
  = 3.4.14
2
7
  - fix filter order in AS controllers which inherit from AS controllers
3
8
  - clean code
@@ -127,7 +127,11 @@ jQuery(document).ready(function($) {
127
127
 
128
128
  if (action_link && action_link.position) {
129
129
  action_link.close();
130
- } else if (link.hasClass('reset')) link.closest('form').get(0).reset();
130
+ } else if (link.hasClass('reset')) {
131
+ var form = link.closest('form');
132
+ if (form.is('.search')) form.find(':input:visible:not([type=submit])').val('');
133
+ else form.trigger('reset');
134
+ }
131
135
  return true;
132
136
  });
133
137
  jQuery(document).on('ajax:error', 'a.as_cancel', function(event, xhr, status, error) {
@@ -38,10 +38,6 @@ module ActiveScaffold::Actions
38
38
  def search_params
39
39
  @search_params || active_scaffold_session_storage['search']
40
40
  end
41
-
42
- def global_search_ignore?
43
- active_scaffold_config.list.always_show_search == true
44
- end
45
41
 
46
42
  # The default security delegates to ActiveRecordPermissions.
47
43
  # You may override the method to customize.
@@ -73,8 +73,8 @@ module ActiveScaffold::Actions
73
73
  end
74
74
  end
75
75
 
76
- def search_ignore?
77
- active_scaffold_config.list.always_show_search == :field_search || global_search_ignore?
76
+ def field_search_ignore?
77
+ active_scaffold_config.list.always_show_search && active_scaffold_config.list.search_partial == 'field_search'
78
78
  end
79
79
 
80
80
  private
@@ -128,10 +128,16 @@ module ActiveScaffold::Actions
128
128
  end
129
129
 
130
130
  def each_record_in_scope
131
- do_search if respond_to? :do_search, true
132
- set_includes_for_columns
133
- # where(nil) is needed because we need a relation
134
- append_to_query(beginning_of_chain.where(nil), finder_options).each {|record| yield record}
131
+ scoped_query.each {|record| yield record}
132
+ end
133
+
134
+ def scoped_query
135
+ @scoped_query ||= begin
136
+ do_search if respond_to? :do_search, true
137
+ set_includes_for_columns
138
+ # where(nil) is needed because we need a relation
139
+ append_to_query(beginning_of_chain.where(nil), finder_options)
140
+ end
135
141
  end
136
142
 
137
143
  # The default security delegates to ActiveRecordPermissions.
@@ -37,7 +37,7 @@ module ActiveScaffold::Actions
37
37
  end
38
38
 
39
39
  def search_ignore?
40
- active_scaffold_config.list.always_show_search == :search || global_search_ignore?
40
+ active_scaffold_config.list.always_show_search && active_scaffold_config.list.search_partial == 'search'
41
41
  end
42
42
 
43
43
  private
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 14
5
+ PATCH = 16
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.14
4
+ version: 3.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-13 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: shoulda