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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e391ff964c183c36df4416f85b6c0d1466a44a9
4
- data.tar.gz: a5b83b15499bb227ecb459381ca02b421261b383
3
+ metadata.gz: 48dc2381977713791be4113ae363aec520dbc8e0
4
+ data.tar.gz: 98506d01af1b998e7692b1bf5c7ca1a720686a5a
5
5
  SHA512:
6
- metadata.gz: f85596592ba07b109e8d645c124a409e610b94df3b47495411e0ff2419a80fbcb617668b1c8029ef8e30f74b224c3a94de684bd390d171ea4848f4e698fdec15
7
- data.tar.gz: a8645b27cd94fed33c84d8ffd5ef5073f5ea9e99e8cf27430a1bd6ea798e6679b1444f9cc3fd8e5f2f1c51d7a0ef8a11907c723ba31a813a8cbc3d2d1595c4c1
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.errors.empty? && @record.valid?, @record.associated_valid?].all? # this syntax avoids a short-circuit
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.errors.empty? && @record.valid?, @record.associated_valid?].all? # this syntax avoids a short-circuit
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)
@@ -115,7 +115,6 @@ module ActiveScaffold
115
115
  end
116
116
  end
117
117
 
118
- flash[:warning] = parent_record.errors.to_a.join("\n") if parent_record.errors.present?
119
118
  parent_record
120
119
  end
121
120
 
@@ -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.errors.empty? && a.valid?, a.associated_valid?(path)].all? }
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.index(value[:opt]) || value[:opt]
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
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 26
5
+ PATCH = 27
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.26
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-26 00:00:00.000000000 Z
11
+ date: 2015-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: brakeman