active_scaffold 3.4.13 → 3.4.14

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: fd09ee16b2e93880391fad8eab47d2b2e41687c4
4
- data.tar.gz: 186a9efd135d86b371ae7cf93206634753aed0ca
3
+ metadata.gz: 4dd09eacd583985f362d688856906e072120a233
4
+ data.tar.gz: 3d48f8933ac709ea1f6b9e4495b1144ab4510abd
5
5
  SHA512:
6
- metadata.gz: 4cf41d9f68f77f7bd4ce86e457ad7ce536a4cf646a088b196867cacd74d654f428966f30f148f11aa2972a00575609e14bdd9b3ccb297ece4833927315a7de7f
7
- data.tar.gz: cff3c6c6c20eabb9a99961a1991fb7ddaada2baef7476170c5c508a8017a8fbea6d986710d153ba3ebb38cb0d058fc122d1ee5046741ed1920e8e98c8f26682d
6
+ metadata.gz: 15888fe68ed0b4c072285d1dab51508ac3f2f5efb90a8bcf100d84324d8ed5734b2adab150e8f456062c1300a4a1383d3922529825f2668e7cd6ffaacccd18b0
7
+ data.tar.gz: 74c98c0d0578b2bf00c652b4e645f9d029bceae3140dd0432c2340dd8f88461bea5bbb891577d04f90f0b52928f4ea248fe2298ad86cf9872b82ccf8bdc4c080
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ = 3.4.14
2
+ - fix filter order in AS controllers which inherit from AS controllers
3
+ - clean code
4
+
1
5
  = 3.4.13
2
6
  - fix parent_prefixes deprecation on rails 4.2
3
7
  - set parent record on add existing
@@ -238,15 +238,29 @@ module ActiveScaffold::Actions
238
238
  @record = find_if_allowed(params[:id], crud_type_or_security_options, klass)
239
239
  end
240
240
 
241
+ def active_scaffold_session_storage_key(id = nil)
242
+ id ||= params[:eid] || "#{params[:controller]}#{"_#{nested_parent_id}" if nested?}"
243
+ "as:#{id}"
244
+ end
245
+
246
+ def active_scaffold_session_storage(id = nil)
247
+ session_index = active_scaffold_session_storage_key(id)
248
+ session[session_index] ||= {}
249
+ session[session_index]
250
+ end
251
+
252
+ def clear_storage
253
+ session_index = active_scaffold_session_storage_key
254
+ session.delete(session_index) unless session[session_index].present?
255
+ end
256
+
241
257
  # at some point we need to pass the session and params into config. we'll just take care of that before any particular action occurs by passing those hashes off to the UserSettings class of each action.
242
258
  def handle_user_settings
243
- if self.class.uses_active_scaffold?
244
- storage = active_scaffold_config.store_user_settings ? active_scaffold_session_storage : {}
245
- active_scaffold_config.actions.each do |action_name|
246
- conf_instance = active_scaffold_config.send(action_name) rescue next
247
- next if conf_instance.class::UserSettings == ActiveScaffold::Config::Base::UserSettings # if it hasn't been extended, skip it
248
- conf_instance.user = conf_instance.class::UserSettings.new(conf_instance, storage, params)
249
- end
259
+ storage = active_scaffold_config.store_user_settings ? active_scaffold_session_storage : {}
260
+ active_scaffold_config.actions.each do |action_name|
261
+ conf_instance = active_scaffold_config.send(action_name) rescue next
262
+ next if conf_instance.class::UserSettings == ActiveScaffold::Config::Base::UserSettings # if it hasn't been extended, skip it
263
+ conf_instance.user = conf_instance.class::UserSettings.new(conf_instance, storage, params)
250
264
  end
251
265
  end
252
266
 
@@ -1,5 +1,8 @@
1
1
  module ActiveScaffold
2
2
  module Constraints
3
+ def self.included(base)
4
+ base.helper_method :active_scaffold_constraints
5
+ end
3
6
 
4
7
  protected
5
8
 
@@ -22,14 +25,12 @@ module ActiveScaffold
22
25
  end
23
26
  end
24
27
 
25
- if self.class.uses_active_scaffold?
26
- # we actually want to do this whether constrained_fields exist or not, so that we can reset the array when they don't
27
- active_scaffold_config.actions.each do |action_name|
28
- next if exclude_actions.include?(action_name)
29
- action = active_scaffold_config.send(action_name)
30
- next unless action.respond_to? :columns
31
- action.columns.constraint_columns = constrained_fields
32
- end
28
+ # we actually want to do this whether constrained_fields exist or not, so that we can reset the array when they don't
29
+ active_scaffold_config.actions.each do |action_name|
30
+ next if exclude_actions.include?(action_name)
31
+ action = active_scaffold_config.send(action_name)
32
+ next unless action.respond_to? :columns
33
+ action.columns.constraint_columns = constrained_fields
33
34
  end
34
35
  end
35
36
 
@@ -2,7 +2,6 @@ module ActiveScaffold
2
2
  module Core
3
3
  def self.included(base)
4
4
  base.extend(ClassMethods)
5
- base.helper_method :active_scaffold_constraints
6
5
  end
7
6
 
8
7
  def active_scaffold_config
@@ -12,22 +11,6 @@ module ActiveScaffold
12
11
  def active_scaffold_config_for(klass)
13
12
  self.class.active_scaffold_config_for(klass)
14
13
  end
15
-
16
- def active_scaffold_session_storage_key(id = nil)
17
- id ||= params[:eid] || "#{params[:controller]}#{"_#{nested_parent_id}" if nested?}"
18
- "as:#{id}"
19
- end
20
-
21
- def active_scaffold_session_storage(id = nil)
22
- session_index = active_scaffold_session_storage_key(id)
23
- session[session_index] ||= {}
24
- session[session_index]
25
- end
26
-
27
- def clear_storage
28
- session_index = active_scaffold_session_storage_key
29
- session.delete(session_index) unless session[session_index].present?
30
- end
31
14
 
32
15
  module ClassMethods
33
16
  def active_scaffold(model_id = nil, &block)
@@ -60,10 +43,12 @@ module ActiveScaffold
60
43
  end
61
44
  # include the rest of the code into the controller: the action core and the included actions
62
45
  module_eval do
63
- include ActiveScaffold::Finder
64
- include ActiveScaffold::Constraints
65
- include ActiveScaffold::AttributeParams
66
- include ActiveScaffold::Actions::Core
46
+ unless self < ActiveScaffold::Actions::Core
47
+ include ActiveScaffold::Finder
48
+ include ActiveScaffold::Constraints
49
+ include ActiveScaffold::AttributeParams
50
+ include ActiveScaffold::Actions::Core
51
+ end
67
52
  active_scaffold_config.actions.each do |mod|
68
53
  name = mod.to_s.camelize
69
54
  include "ActiveScaffold::Actions::#{name}".constantize
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 13
5
+ PATCH = 14
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -84,6 +84,7 @@ end
84
84
  class ConstraintsTestObject
85
85
  # stub out what the mixin expects to find ...
86
86
  def self.before_filter(*args); end
87
+ def self.helper_method(*); end
87
88
  attr_accessor :active_scaffold_preload
88
89
  attr_accessor :active_scaffold_references
89
90
  attr_accessor :active_scaffold_habtm_joins
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.13
4
+ version: 3.4.14
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-09 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: shoulda