active_scaffold 4.0.1 → 4.0.2
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 +4 -4
- data/CHANGELOG.rdoc +9 -0
- data/lib/active_scaffold/actions/core.rb +5 -1
- data/lib/active_scaffold/attribute_params.rb +9 -5
- data/lib/active_scaffold/config/field_search.rb +7 -1
- data/lib/active_scaffold/helpers/search_column_helpers.rb +4 -2
- data/lib/active_scaffold/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1411d7317097c53427854d287da2fe123d38498ab8bbff98308798c6da5ffc9b
|
4
|
+
data.tar.gz: 46a02c5b035126602809edc855e0b6edb71f532c5bd66e91a5347a596895743e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 250738344e423f2a7509c299f7fcc813a7d36b557d245b3f983ff6bcf6c122729482f2b469625e78d2d9d4252a6d74976ebce6b8cd532ff7ca3633f391171cc3
|
7
|
+
data.tar.gz: 3bda9ffc65eeda39907a9a216ea7f6f8af6ddc799182f7a4d867a2790f9c53d5ba7ec0297326eb1bb19974734e49926bc09ac5561114030c226b986d87cd41f6
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
= 4.0.2
|
2
|
+
- Fix using update_columns in field search with search UI submitting a hash, such as date fields
|
3
|
+
- Support disabling update_columsns on field_search
|
4
|
+
|
5
|
+
= 4.0.1
|
1
6
|
- Add :text_editor show_ui, to avoid escaping html code
|
2
7
|
- Fix action link on association column named record
|
3
8
|
|
@@ -11,6 +16,10 @@
|
|
11
16
|
- Thread safety enabled by default, can't be disabled, deprecate ActiveScaffold.threadsafe!
|
12
17
|
- Support subgroups on field search
|
13
18
|
|
19
|
+
= 3.7.12
|
20
|
+
- Fix using update_columns in field search with search UI submitting a hash, such as date fields
|
21
|
+
- Support disabling update_columsns on field_search
|
22
|
+
|
14
23
|
= 3.7.11.1
|
15
24
|
- Fix action link on association column named record
|
16
25
|
|
@@ -115,7 +115,11 @@ module ActiveScaffold::Actions
|
|
115
115
|
copy_attributes(saved_record, record) if saved_record
|
116
116
|
apply_constraints_to_record(record) unless scope
|
117
117
|
create_association_with_parent record, check_match: true if nested?
|
118
|
-
|
118
|
+
if @form_action == :field_search
|
119
|
+
update_columns_from_params(record, columns, attributes || {}, :read, avoid_changes: true, search_attributes: true)
|
120
|
+
else
|
121
|
+
update_record_from_params(record, columns, attributes || {}, true)
|
122
|
+
end
|
119
123
|
end
|
120
124
|
|
121
125
|
def updated_record_with_column(column, value, scope)
|
@@ -55,13 +55,17 @@ module ActiveScaffold
|
|
55
55
|
#
|
56
56
|
# This is a secure way to apply params to a record, because it's based on a loop over the columns
|
57
57
|
# set. The columns set will not yield unauthorized columns, and it will not yield unregistered columns.
|
58
|
-
def update_record_from_params(parent_record, columns, attributes, avoid_changes = false)
|
58
|
+
def update_record_from_params(parent_record, columns, attributes, avoid_changes = false, search_attributes: false)
|
59
59
|
crud_type = parent_record.new_record? ? :create : :update
|
60
60
|
return parent_record unless parent_record.authorized_for?(crud_type: crud_type)
|
61
61
|
|
62
|
-
multi_parameter_attrs = multi_parameter_attributes(attributes)
|
63
62
|
assign_locking_column(parent_record, attributes)
|
63
|
+
update_columns_from_params(parent_record, columns, attributes, crud_type, avoid_changes: avoid_changes, search_attributes: search_attributes)
|
64
|
+
parent_record
|
65
|
+
end
|
64
66
|
|
67
|
+
def update_columns_from_params(parent_record, columns, attributes, crud_type, avoid_changes: false, search_attributes: false)
|
68
|
+
multi_parameter_attrs = multi_parameter_attributes(attributes)
|
65
69
|
columns.each_column(for: parent_record, crud_type: crud_type, flatten: true) do |column|
|
66
70
|
# Set any passthrough parameters that may be associated with this column (ie, file column "keep" and "temp" attributes)
|
67
71
|
assign_column_params(parent_record, column, attributes)
|
@@ -69,16 +73,16 @@ module ActiveScaffold
|
|
69
73
|
if multi_parameter_attrs.key? column.name.to_s
|
70
74
|
parent_record.send(:assign_multiparameter_attributes, multi_parameter_attrs[column.name.to_s])
|
71
75
|
elsif attributes.key? column.name
|
76
|
+
next if search_attributes && params_hash?(attributes[column.name])
|
77
|
+
|
72
78
|
update_column_from_params(parent_record, column, attributes[column.name], avoid_changes)
|
73
79
|
end
|
74
80
|
rescue StandardError => e
|
75
81
|
message = "on the ActiveScaffold column = :#{column.name} for #{parent_record.inspect} " \
|
76
82
|
"(value from params #{attributes[column.name].inspect})"
|
77
83
|
Rails.logger.error "#{e.class.name}: #{e.message} -- #{message}"
|
78
|
-
raise
|
84
|
+
raise e.class, "#{e.message} -- #{message}"
|
79
85
|
end
|
80
|
-
|
81
|
-
parent_record
|
82
86
|
end
|
83
87
|
|
84
88
|
def assign_column_params(parent_record, column, attributes)
|
@@ -37,6 +37,9 @@ module ActiveScaffold::Config
|
|
37
37
|
|
38
38
|
cattr_accessor :reset_form, instance_accessor: false
|
39
39
|
|
40
|
+
# whether refresh columns defined in update_columns when a column is changed, as create and update forms do
|
41
|
+
cattr_accessor :update_columns
|
42
|
+
|
40
43
|
# instance-level configuration
|
41
44
|
# ----------------------------
|
42
45
|
|
@@ -85,8 +88,11 @@ module ActiveScaffold::Config
|
|
85
88
|
|
86
89
|
attr_accessor :reset_form
|
87
90
|
|
91
|
+
# whether refresh columns defined in update_columns when a column is changed, as create and update forms do
|
92
|
+
attr_accessor :update_columns
|
93
|
+
|
88
94
|
UserSettings.class_eval do
|
89
|
-
user_attr :optional_columns, :group_options, :grouped_columns, :human_conditions, :floating_footer
|
95
|
+
user_attr :optional_columns, :group_options, :grouped_columns, :human_conditions, :floating_footer, :update_columns
|
90
96
|
end
|
91
97
|
end
|
92
98
|
end
|
@@ -6,8 +6,10 @@ module ActiveScaffold
|
|
6
6
|
# It does not do any rendering. It only decides which method is responsible for rendering.
|
7
7
|
def active_scaffold_search_for(column, options = nil)
|
8
8
|
options ||= active_scaffold_search_options(column)
|
9
|
-
|
10
|
-
|
9
|
+
if active_scaffold_config.field_search.update_columns
|
10
|
+
search_columns = active_scaffold_config.field_search.columns.visible_columns_names
|
11
|
+
options = update_columns_options(column, nil, options, form_columns: search_columns, url_params: {form_action: :field_search})
|
12
|
+
end
|
11
13
|
record = options[:object]
|
12
14
|
if column.delegated_association
|
13
15
|
record = record.send(column.delegated_association.name) || column.active_record_class.new
|
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: 4.0.
|
4
|
+
version: 4.0.2
|
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: 2025-02-
|
11
|
+
date: 2025-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|