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 +4 -4
- data/CHANGELOG +4 -0
- data/lib/active_scaffold/actions/core.rb +21 -7
- data/lib/active_scaffold/constraints.rb +9 -8
- data/lib/active_scaffold/core.rb +6 -21
- data/lib/active_scaffold/version.rb +1 -1
- data/test/misc/constraints_test.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dd09eacd583985f362d688856906e072120a233
|
4
|
+
data.tar.gz: 3d48f8933ac709ea1f6b9e4495b1144ab4510abd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15888fe68ed0b4c072285d1dab51508ac3f2f5efb90a8bcf100d84324d8ed5734b2adab150e8f456062c1300a4a1383d3922529825f2668e7cd6ffaacccd18b0
|
7
|
+
data.tar.gz: 74c98c0d0578b2bf00c652b4e645f9d029bceae3140dd0432c2340dd8f88461bea5bbb891577d04f90f0b52928f4ea248fe2298ad86cf9872b82ccf8bdc4c080
|
data/CHANGELOG
CHANGED
@@ -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
|
-
|
244
|
-
|
245
|
-
active_scaffold_config.
|
246
|
-
|
247
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
|
data/lib/active_scaffold/core.rb
CHANGED
@@ -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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
@@ -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.
|
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-
|
11
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|