active_scaffold 4.0.0 → 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 +16 -0
- data/app/assets/javascripts/jquery/active_scaffold.js +2 -2
- data/lib/active_scaffold/actions/core.rb +5 -1
- data/lib/active_scaffold/actions/subform.rb +1 -2
- data/lib/active_scaffold/attribute_params.rb +9 -5
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +9 -0
- 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,12 @@
|
|
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
|
6
|
+
- Add :text_editor show_ui, to avoid escaping html code
|
7
|
+
- Fix action link on association column named record
|
8
|
+
|
9
|
+
= 4.0.0
|
1
10
|
- Add tabbed_by to group of columns in forms. The columns in the group must be collection associations, with a common column or association, used to partition them in different tabs.
|
2
11
|
- Fix tableless in rails >= 7.1
|
3
12
|
- Stop using cow_proxy for thread safety:
|
@@ -7,6 +16,13 @@
|
|
7
16
|
- Thread safety enabled by default, can't be disabled, deprecate ActiveScaffold.threadsafe!
|
8
17
|
- Support subgroups on field search
|
9
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
|
+
|
23
|
+
= 3.7.11.1
|
24
|
+
- Fix action link on association column named record
|
25
|
+
|
10
26
|
= 3.7.11
|
11
27
|
- Add partial list_messages_content to reduce code duplication, and better support replacing list view with other way to render records
|
12
28
|
- Support selector for records body in create_record_row JS method, better support replacing list view with other way to render records
|
@@ -1301,8 +1301,8 @@
|
|
1301
1301
|
if (element.length > 0) {
|
1302
1302
|
element.data(); // $ 1.4.2 workaround
|
1303
1303
|
if (typeof(element.data('action_link')) === 'undefined' && !element.hasClass('as_adapter')) {
|
1304
|
-
var parent = element.closest('.record');
|
1305
|
-
if (parent.length === 0) parent = element.closest('.actions');
|
1304
|
+
var parent = element.parent().closest('.record');
|
1305
|
+
if (parent.length === 0) parent = element.parent().closest('.actions');
|
1306
1306
|
if (parent.is('.record')) {
|
1307
1307
|
// record action
|
1308
1308
|
var target = parent.find('a.as_action');
|
@@ -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)
|
@@ -14,14 +14,13 @@ module ActiveScaffold::Actions
|
|
14
14
|
# don't apply if scope, subform inside subform, because constraints won't apply to parent_record
|
15
15
|
apply_constraints_to_record parent_record unless @scope
|
16
16
|
create_association_with_parent parent_record, check_match: true if nested?
|
17
|
+
cache_generated_id(parent_record, params[:generated_id])
|
17
18
|
parent_record
|
18
19
|
end
|
19
20
|
|
20
21
|
def do_edit_associated
|
21
22
|
@scope = params[:scope]
|
22
23
|
@parent_record = params[:id].nil? ? new_parent_record : find_if_allowed(params[:id], :update)
|
23
|
-
|
24
|
-
cache_generated_id(@parent_record, params[:generated_id]) if @parent_record.new_record?
|
25
24
|
@column = active_scaffold_config.columns[params[:child_association]]
|
26
25
|
|
27
26
|
@record = (find_associated_record if params[:associated_id]) ||
|
@@ -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)
|
@@ -36,5 +36,14 @@ class ActiveScaffold::Bridges::TinyMce
|
|
36
36
|
base.class_eval { alias_method :active_scaffold_search_text_editor, :active_scaffold_search_text }
|
37
37
|
end
|
38
38
|
end
|
39
|
+
|
40
|
+
module ShowColumnHelpers
|
41
|
+
def active_scaffold_show_text_editor(record, column, ui_options: column.options)
|
42
|
+
record.send(column.name).html_safe # rubocop:disable Rails/OutputSafety
|
43
|
+
end
|
44
|
+
|
45
|
+
# Alias, in case the column uses :tinymce form_ui
|
46
|
+
alias active_scaffold_show_tinymce active_scaffold_show_text_editor
|
47
|
+
end
|
39
48
|
end
|
40
49
|
end
|
@@ -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-
|
11
|
+
date: 2025-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|