active_scaffold 3.4.26 → 3.4.27
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 +4 -0
- data/app/assets/javascripts/jquery/active_scaffold.js +1 -0
- data/lib/active_scaffold/actions/create.rb +1 -1
- data/lib/active_scaffold/actions/update.rb +1 -1
- data/lib/active_scaffold/attribute_params.rb +0 -1
- data/lib/active_scaffold/extensions/unsaved_associated.rb +10 -1
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/list_column_helpers.rb +1 -0
- data/lib/active_scaffold/version.rb +1 -1
- 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: 48dc2381977713791be4113ae363aec520dbc8e0
|
4
|
+
data.tar.gz: 98506d01af1b998e7692b1bf5c7ca1a720686a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f6740e7329844cbd546da3bc5738063bdb35ae794479cd5168d9cca99f0333f38644291a97d67d53104a517d55811f02771b410d2c0dc1991d7c7c2a86280c2
|
7
|
+
data.tar.gz: 0f1ef0aa8d699221e6dec5b71a4ff0669dfde7adbc3cb7c9d0f7428fe027dbc321cbc9a394254fe6f15b15a6ae9f8c06bf2277cdf6cbb60c747cfb2cdce51d7f
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
= 3.4.27
|
2
|
+
- support use_html option in columns for inplace_edit
|
3
|
+
- don't add errors added on update_record_from_params to flash[:warning], they are on errors array, keep errors from update_record_from_params when running valid?
|
4
|
+
|
1
5
|
= 3.4.26
|
2
6
|
- fix padding for dynamic action_group inside action_group
|
3
7
|
- fix using gem with symlink in BUNDLE_PATH option of config/bundle file
|
@@ -758,6 +758,7 @@ var ActiveScaffold = {
|
|
758
758
|
if (column_heading.data('ie-rows')) options.textarea_rows = column_heading.data('ie-rows');
|
759
759
|
if (column_heading.data('ie-cols')) options.textarea_cols = column_heading.data('ie-cols');
|
760
760
|
if (column_heading.data('ie-size')) options.text_size = column_heading.data('ie-size');
|
761
|
+
if (column_heading.data('ie-use-html')) options.use_html = column_heading.data('ie-use-html');
|
761
762
|
},
|
762
763
|
|
763
764
|
create_inplace_editor: function(span, options) {
|
@@ -102,7 +102,7 @@ module ActiveScaffold::Actions
|
|
102
102
|
create_association_with_parent(@record) if nested?
|
103
103
|
before_create_save(@record)
|
104
104
|
# errors to @record can be added by update_record_from_params when association fails to set and ActiveRecord::RecordNotSaved is raised
|
105
|
-
self.successful = [@record.
|
105
|
+
self.successful = [@record.keeping_errors { @record.valid? }, @record.associated_valid?].all? # this syntax avoids a short-circuit
|
106
106
|
create_save(@record) unless options[:skip_save]
|
107
107
|
end
|
108
108
|
rescue ActiveRecord::ActiveRecordError => ex
|
@@ -109,7 +109,7 @@ module ActiveScaffold::Actions
|
|
109
109
|
@record = update_record_from_params(@record, active_scaffold_config.update.columns, attributes) unless options[:no_record_param_update]
|
110
110
|
before_update_save(@record)
|
111
111
|
# errors to @record can be added by update_record_from_params when association fails to set and ActiveRecord::RecordNotSaved is raised
|
112
|
-
self.successful = [@record.
|
112
|
+
self.successful = [@record.keeping_errors { @record.valid? }, @record.associated_valid?].all? # this syntax avoids a short-circuit
|
113
113
|
if successful?
|
114
114
|
@record.save! && @record.save_associated!
|
115
115
|
after_update_save(@record)
|
@@ -5,7 +5,7 @@ class ActiveRecord::Base
|
|
5
5
|
path << self
|
6
6
|
# using [].all? syntax to avoid a short-circuit
|
7
7
|
# errors to associated record can be added by update_record_from_params when association fails to set and ActiveRecord::RecordNotSaved is raised
|
8
|
-
with_unsaved_associated { |a| [a.
|
8
|
+
with_unsaved_associated { |a| [a.keeping_errors { a.valid? }, a.associated_valid?(path)].all? }
|
9
9
|
end
|
10
10
|
|
11
11
|
def save_associated
|
@@ -20,6 +20,15 @@ class ActiveRecord::Base
|
|
20
20
|
with_unsaved_associated { |a| a.errors.count == 0 && a.no_errors_in_associated? }
|
21
21
|
end
|
22
22
|
|
23
|
+
def keeping_errors
|
24
|
+
old_errors = errors.dup if errors.present?
|
25
|
+
yield.tap do
|
26
|
+
(old_errors || []).each do |attr|
|
27
|
+
old_errors[attr].each { |msg| errors.add(attr, msg) unless errors.added?(attr, msg) }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
23
32
|
protected
|
24
33
|
|
25
34
|
# Provide an override to allow the model to restrict which associations are considered
|
@@ -29,7 +29,7 @@ module ActiveScaffold
|
|
29
29
|
alias_method :active_scaffold_human_condition_float, :active_scaffold_human_condition_integer
|
30
30
|
|
31
31
|
def active_scaffold_human_condition_string(column, value)
|
32
|
-
opt = ActiveScaffold::Finder::STRING_COMPARATORS.
|
32
|
+
opt = ActiveScaffold::Finder::STRING_COMPARATORS.key(value[:opt]) || value[:opt]
|
33
33
|
to = "- #{value[:to]}" if opt == 'BETWEEN'
|
34
34
|
format_human_condition column, opt, "'#{value[:from]}'", to
|
35
35
|
end
|
@@ -256,6 +256,7 @@ module ActiveScaffold
|
|
256
256
|
data[:ie_rows] = column.options[:rows] || 5 if column.column.try(:type) == :text
|
257
257
|
data[:ie_cols] = column.options[:cols] if column.options[:cols]
|
258
258
|
data[:ie_size] = column.options[:size] if column.options[:size]
|
259
|
+
data[:ie_use_html] = column.options[:use_html] if column.options[:use_html]
|
259
260
|
|
260
261
|
if column.list_ui == :checkbox
|
261
262
|
data[:ie_mode] = :inline_checkbox
|
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.27
|
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-08
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brakeman
|