active_scaffold 4.0.2 → 4.0.3

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
  SHA256:
3
- metadata.gz: 1411d7317097c53427854d287da2fe123d38498ab8bbff98308798c6da5ffc9b
4
- data.tar.gz: 46a02c5b035126602809edc855e0b6edb71f532c5bd66e91a5347a596895743e
3
+ metadata.gz: ce387b6ca519e9e9d6dc988524ffff98d3bdeaf6e142311381834421b2bcda20
4
+ data.tar.gz: 5634748e0efd3adac51276052ca840c582e1693593e03e1e3db364043c686f79
5
5
  SHA512:
6
- metadata.gz: 250738344e423f2a7509c299f7fcc813a7d36b557d245b3f983ff6bcf6c122729482f2b469625e78d2d9d4252a6d74976ebce6b8cd532ff7ca3633f391171cc3
7
- data.tar.gz: 3bda9ffc65eeda39907a9a216ea7f6f8af6ddc799182f7a4d867a2790f9c53d5ba7ec0297326eb1bb19974734e49926bc09ac5561114030c226b986d87cd41f6
6
+ metadata.gz: 99c906010233a6cc88ad91b9921c6b4ecfb64a123a191f74253a73cc5571b744e7b1fa3f8f0cd41ac2d5ce4c46f4438d2eafbfd01d5b2df23689589a70439f6f
7
+ data.tar.gz: cd7afd2d8123f8a33c36b5e36575c3f1642f358d2b67ff29d071f8e2ed26a5c0a508c80934a92e920c653e79d20b94b754428113cfaa988a642fad6def9a20f7
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ = 4.0.3
2
+ - Fix for jQuery 3
3
+ - Fix position popup for collection action links
4
+ - Fix recordselect in form open with position popup
5
+ - Fix class of subform on optional subform using add_new option with layout option
6
+ - Fix constraints with mulitple ids for belongs_to associations with primary_key setting
7
+ - Fix render_field when a column changes, and a column to refresh exists in a subform with the same name too
8
+
1
9
  = 4.0.2
2
10
  - Fix using update_columns in field search with search UI submitting a hash, such as date fields
3
11
  - Support disabling update_columsns on field_search
data/README.md CHANGED
@@ -70,7 +70,7 @@ Changing columns for an action (e.g. add or exclude) on a request must use activ
70
70
 
71
71
  If you have a `_form_association_record` partial view overrided, use `record` local variable instead of `form_association_record`.
72
72
 
73
- If you have code rendering `form_association_record` partial, the pass `record` local variable, or use `as: :record` if using render with collection key.
73
+ If you have code rendering `form_association_record` partial, then pass `record` local variable, or use `as: :record` if using render with collection key.
74
74
 
75
75
  Configuration
76
76
  -------------
@@ -356,7 +356,7 @@
356
356
  }
357
357
  if ($this.data('select-id')) {
358
358
  select = line.find('#' + $this.data('select-id'));
359
- if (select.hasClass('recordselect') || select.is('.no-options')) select = select.next(':hidden').andSelf();
359
+ if (select.hasClass('recordselect') || select.is('.no-options')) select = select.next(':hidden').addBack();
360
360
  }
361
361
  if (hide) {
362
362
  subform.hide().find("input:enabled,select:enabled,textarea:enabled").prop('disabled', true);
@@ -589,7 +589,7 @@
589
589
  if (toggle.is('[type=radio]')) toggle.prop('disabled', true);
590
590
  else if (toggle.data('select-id')) {
591
591
  var select = line.find('#' + toggle.data('select-id'));
592
- if (select.hasClass('recordselect') || select.is('.no-options')) select = select.next(':hidden').andSelf();
592
+ if (select.hasClass('recordselect') || select.is('.no-options')) select = select.next(':hidden').addBack();
593
593
  select.hide().prop('disabled', true);
594
594
  }
595
595
  } else $this.find("input:enabled,select:enabled,textarea:enabled").prop('disabled', true);
@@ -978,14 +978,17 @@
978
978
  if (typeof(source) == 'string') source = '#' + source;
979
979
  var source = jQuery(source);
980
980
  var element, container = source.closest('.sub-form-record'), selector = '';
981
- if (container.length == 0) {
981
+ if (container.length === 0) {
982
982
  container = source.closest('form > ol.form');
983
983
  selector = 'li';
984
984
  }
985
985
  // find without entering new subforms
986
- element = container.find(selector + ':not(.sub-form) .' + options.field_class).first();
986
+ element = container.find(selector + ':not(.sub-form) .' + options.field_class);
987
+ if (container.is('.sub-form-record'))
988
+ element = element.filter(function() { return $(this).closest('.sub-form-record').get(0) === container.get(0); });
989
+ else element = element.filter(function() { return $(this).closest('.sub-form-record').length === 0; });
987
990
  if (element.length)
988
- element = element.closest('dl');
991
+ element = element.first().closest('dl');
989
992
  else if (options.subform_class)
990
993
  element = container.find(selector + '.' + options.subform_class).first();
991
994
 
@@ -1235,7 +1238,7 @@
1235
1238
  },
1236
1239
 
1237
1240
  open_popup: function(content, link) {
1238
- var element = jQuery(content).dialog({
1241
+ var element = jQuery(content).filter(function(){ return this.tagName; }).dialog({
1239
1242
  modal: true,
1240
1243
  close: function() { link.close(); },
1241
1244
  width: ActiveScaffold.config.popup_width || '80%'
@@ -1245,7 +1248,7 @@
1245
1248
 
1246
1249
  close_popup: function(link, callback) {
1247
1250
  link.adapter.dialog('close');
1248
- if (callback) callback();
1251
+ ActiveScaffold.remove(link.adapter, callback);
1249
1252
  }
1250
1253
  }
1251
1254
 
@@ -1518,7 +1521,7 @@
1518
1521
  instantiate_link: function(link) {
1519
1522
  var l = new ActiveScaffold.ActionLink.Table(link, this.target, this.loading_indicator);
1520
1523
  if (l.position) {
1521
- l.url = l.url.append_params({adapter: '_list_inline_adapter'});
1524
+ l.url = l.url.append_params({adapter: l.position == 'popup' ? '_popup_adapter' : '_list_inline_adapter'});
1522
1525
  l.tag.attr('href', l.url);
1523
1526
  }
1524
1527
  return l;
@@ -217,7 +217,7 @@ $.extend(InlineEditor.prototype, {
217
217
  if ( ! this.settings.cancel)
218
218
  return false;
219
219
 
220
- var eventTargetAndParents = $(eventTarget).parents().andSelf();
220
+ var eventTargetAndParents = $(eventTarget).parents().addBack();
221
221
  var elementsMatchingCancelSelector = eventTargetAndParents.filter(this.settings.cancel);
222
222
  return 0 !== elementsMatchingCancelSelector.length;
223
223
  },
@@ -10,3 +10,4 @@
10
10
  <% end %>
11
11
  <% end %>
12
12
  <% require_asset 'jquery-ui-theme' if ActiveScaffold.jquery_ui_included? %>
13
+ .ui-front { z-index: 98; }
@@ -78,7 +78,7 @@ class ActiveScaffold::Bridges::RecordSelect
78
78
  column.association.klass.find(value.to_i)
79
79
  end
80
80
  rescue StandardError => e
81
- logger.error "#{e.class.name}: #{e.message} -- Sorry, we are not that smart yet. Attempted to restore search values to search fields :#{column.name} in #{controller.class}"
81
+ Rails.logger.error "#{e.class.name}: #{e.message} -- Sorry, we are not that smart yet. Attempted to restore search values to search fields :#{column.name} in #{controller.class}"
82
82
  raise e
83
83
  end
84
84
  end
@@ -128,7 +128,7 @@ module ActiveScaffold
128
128
  end
129
129
 
130
130
  table = association.belongs_to? ? active_scaffold_config.model.table_name : association.table_name
131
- value = association.klass.find(value).send(association.primary_key) if association.primary_key
131
+ value = Array(association.klass.find(value)).map(&association.primary_key.to_sym) if association.primary_key
132
132
 
133
133
  if association.polymorphic?
134
134
  unless value.is_a?(Array) && value.size >= 2
@@ -47,7 +47,7 @@ module ActiveScaffold
47
47
  text_field(:record, column.name, options.merge(column.options).except(:format))
48
48
  end
49
49
  rescue StandardError => e
50
- logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
50
+ Rails.logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
51
51
  raise e
52
52
  end
53
53
 
@@ -70,9 +70,9 @@ module ActiveScaffold
70
70
  end
71
71
  end
72
72
 
73
- def active_scaffold_subform_attributes(column, column_css_class = nil, klass = nil, tab_id: nil)
73
+ def active_scaffold_subform_attributes(column, column_css_class = nil, klass = nil, tab_id: nil, ui_options: column.options)
74
74
  {
75
- class: "sub-form #{active_scaffold_config_for(klass || column.association.klass).subform.layout}-sub-form #{column_css_class} #{column.name}-sub-form",
75
+ class: "sub-form #{ui_options[:layout] || active_scaffold_config_for(klass || column.association.klass).subform.layout}-sub-form #{column_css_class} #{column.name}-sub-form",
76
76
  id: sub_form_id(association: column.name, tab_id: tab_id)
77
77
  }
78
78
  end
@@ -364,7 +364,7 @@ module ActiveScaffold
364
364
  end
365
365
  return content_tag(:div, '') unless klass
366
366
 
367
- subform_attrs = active_scaffold_subform_attributes(column, nil, klass)
367
+ subform_attrs = active_scaffold_subform_attributes(column, nil, klass, ui_options: ui_options)
368
368
  if record.send(column.name)&.new_record?
369
369
  new_record = record.send(column.name)
370
370
  else
@@ -568,7 +568,7 @@ module ActiveScaffold
568
568
  if options.present?
569
569
  if ui_options[:add_new]
570
570
  html_options[:data] ||= {}
571
- html_options[:data][:subform_id] = active_scaffold_subform_attributes(column)[:id]
571
+ html_options[:data][:subform_id] = active_scaffold_subform_attributes(column, ui_options: ui_options)[:id]
572
572
  radio_html_options = html_options.merge(class: "#{html_options[:class]} hide-new-subform")
573
573
  else
574
574
  radio_html_options = html_options
@@ -22,7 +22,7 @@ module ActiveScaffold
22
22
  value = '&nbsp;'.html_safe if value.nil? || value.blank? # fix for IE 6
23
23
  value
24
24
  rescue StandardError => e
25
- logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}, record: #{record.inspect}"
25
+ Rails.logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}, record: #{record.inspect}"
26
26
  raise e
27
27
  end
28
28
 
@@ -62,7 +62,7 @@ module ActiveScaffold
62
62
  text
63
63
  end
64
64
  rescue StandardError => e
65
- logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
65
+ Rails.logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
66
66
  raise e
67
67
  end
68
68
 
@@ -43,7 +43,7 @@ module ActiveScaffold
43
43
  text_field(:record, column.name, options.merge(column.options))
44
44
  end
45
45
  rescue StandardError => e
46
- logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
46
+ Rails.logger.error "#{e.class.name}: #{e.message} -- on the ActiveScaffold column = :#{column.name} in #{controller.class}"
47
47
  raise e
48
48
  end
49
49
 
@@ -2,7 +2,7 @@ module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 4
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
  FIX = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, FIX].compact.join('.')
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.2
4
+ version: 4.0.3
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-26 00:00:00.000000000 Z
11
+ date: 2025-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails