active_scaffold 4.0.13 → 4.1.0

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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +19 -0
  3. data/README.md +11 -5
  4. data/app/assets/javascripts/active_scaffold.js.erb +1 -1
  5. data/app/assets/javascripts/jquery/active_scaffold.js +67 -20
  6. data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +1 -1
  7. data/app/assets/javascripts/jquery/draggable_lists.js +1 -1
  8. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +1 -0
  9. data/app/assets/stylesheets/active_scaffold.scss +415 -6
  10. data/app/assets/stylesheets/active_scaffold_layout.css +11 -1
  11. data/app/views/active_scaffold_overrides/_form.html.erb +1 -1
  12. data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +2 -1
  13. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +1 -1
  14. data/app/views/active_scaffold_overrides/_human_filters.html.erb +1 -0
  15. data/app/views/active_scaffold_overrides/_list_header.html.erb +2 -0
  16. data/app/views/active_scaffold_overrides/_list_messages.html.erb +11 -0
  17. data/app/views/active_scaffold_overrides/_render_field.js.erb +1 -1
  18. data/app/views/active_scaffold_overrides/_show_association.html.erb +1 -0
  19. data/app/views/active_scaffold_overrides/_show_columns.html.erb +17 -2
  20. data/app/views/active_scaffold_overrides/_update_field_on_create.js.erb +20 -0
  21. data/app/views/active_scaffold_overrides/add_tab.js.erb +3 -3
  22. data/app/views/active_scaffold_overrides/edit_associated.js.erb +1 -1
  23. data/app/views/active_scaffold_overrides/on_create.js.erb +21 -17
  24. data/app/views/active_scaffold_overrides/on_update.js.erb +1 -1
  25. data/lib/active_scaffold/actions/core.rb +34 -16
  26. data/lib/active_scaffold/actions/field_search.rb +21 -8
  27. data/lib/active_scaffold/actions/list.rb +40 -5
  28. data/lib/active_scaffold/actions/nested.rb +1 -1
  29. data/lib/active_scaffold/actions/subform.rb +2 -1
  30. data/lib/active_scaffold/attribute_params.rb +12 -2
  31. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +1 -1
  32. data/lib/active_scaffold/bridges/paper_trail/helper.rb +1 -1
  33. data/lib/active_scaffold/bridges/record_select/helpers.rb +1 -1
  34. data/lib/active_scaffold/config/core.rb +5 -1
  35. data/lib/active_scaffold/config/list.rb +35 -1
  36. data/lib/active_scaffold/constraints.rb +4 -2
  37. data/lib/active_scaffold/data_structures/action_columns.rb +2 -2
  38. data/lib/active_scaffold/data_structures/action_link.rb +16 -11
  39. data/lib/active_scaffold/data_structures/action_links.rb +3 -3
  40. data/lib/active_scaffold/data_structures/actions.rb +2 -2
  41. data/lib/active_scaffold/data_structures/column.rb +21 -0
  42. data/lib/active_scaffold/data_structures/columns.rb +2 -2
  43. data/lib/active_scaffold/data_structures/filter.rb +85 -0
  44. data/lib/active_scaffold/data_structures/filter_option.rb +32 -0
  45. data/lib/active_scaffold/data_structures/filters.rb +51 -0
  46. data/lib/active_scaffold/data_structures/set.rb +2 -2
  47. data/lib/active_scaffold/data_structures/sorting.rb +2 -2
  48. data/lib/active_scaffold/extensions/action_controller_rendering.rb +2 -2
  49. data/lib/active_scaffold/extensions/action_view_rendering.rb +3 -3
  50. data/lib/active_scaffold/finder.rb +16 -6
  51. data/lib/active_scaffold/helpers/action_link_helpers.rb +21 -17
  52. data/lib/active_scaffold/helpers/filter_helpers.rb +36 -0
  53. data/lib/active_scaffold/helpers/form_column_helpers.rb +116 -26
  54. data/lib/active_scaffold/helpers/human_condition_helpers.rb +4 -0
  55. data/lib/active_scaffold/helpers/list_column_helpers.rb +26 -12
  56. data/lib/active_scaffold/helpers/search_column_helpers.rb +4 -2
  57. data/lib/active_scaffold/helpers/show_column_helpers.rb +4 -3
  58. data/lib/active_scaffold/helpers/tabs_helpers.rb +4 -3
  59. data/lib/active_scaffold/helpers/view_helpers.rb +7 -1
  60. data/lib/active_scaffold/registry.rb +1 -1
  61. data/lib/active_scaffold/responds_to_parent.rb +3 -3
  62. data/lib/active_scaffold/tableless.rb +2 -2
  63. data/lib/active_scaffold/version.rb +2 -2
  64. data/lib/active_scaffold.rb +3 -7
  65. metadata +22 -17
  66. data/app/assets/stylesheets/active_scaffold_colors.scss +0 -414
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fd3e750e0fb36959f8ac173dbb8f9ef3cffadaa1c4b7c7b66698ae97ae0da4e
4
- data.tar.gz: 73ac2a464d935b187982282547440f450761d580cfd9e202601da5768670940a
3
+ metadata.gz: 62db7d77ad1a708491a2fa940bcfdedddc975805429f79a21a2690a20c358ea0
4
+ data.tar.gz: e4151358418239cd47c699ac0de98bf6456ff54a289311713245f3b55818c9e3
5
5
  SHA512:
6
- metadata.gz: 5587b3cede0b77dfbc0194860fa7116f0f6e79ccc6647aa6e2a7f1a256bd107d19909c3b71d717497f7e0562fc6850ec3b829a7d27bc88ff4d24692125571639
7
- data.tar.gz: a2d8672b60eb934851a1df4b57fb6928d1662e5924d6d78b1e06714db9e15ded2c48287d87382c4af2a1f1db0762b7e7d9b063ecfabc368ab4c66e322d246598
6
+ metadata.gz: bcb79b9cb7b68c2bc2ed427e1a98c387332095c981a63b92a8f43247593a4428cb51d0b18330fe22cb0a88d8237ad437a1906c09df65d46594d3a59a82e149f9
7
+ data.tar.gz: d6b7065e4e5300aceef33757a0973c6517caaf3c0e4d08a1326ec30801a3ca9feed4e75fbbf94dc36561d8866446d7b26da0aa19d38911fa29f85cbd09b93ba7
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,22 @@
1
+ - Replace sassc-rails with dartsass-sprockets, as it's a compatible replacement, to ease migration to dartsass
2
+ - Use lowercase response headers as required by rack 3
3
+ - Add filters to list action
4
+ - Add prompt option to action link
5
+ - Support tabbed_by in show action too
6
+ - Support options hash for :add_new option, with mode: :popup to open create new form in a JS popup, and other options to change link texts
7
+ - Support setup option in tinymce config with function
8
+ - Support multiple values in constraints for columns
9
+ - Improve grouped search supporting to change the columns used with group clause
10
+ - Improve grouped search to support using virtual columns for calculations, defining which DB column use to calculate
11
+ - Improve grouped search supporting other SQL functions for calculate in grouped search, ignoring it in bottom search if rails don't support them in calculate (only sum, count, minimum, maximum average)
12
+ - Improve grouped search supporting using group_by with multiple columns or sql code
13
+ - Add disable_on_update_column setting to column to allow skipping disabling the form when a column changes and a request is sent to refresh other fields
14
+ - Rename active_scaffold_habtm_joins to active_scaffold_joins, active_scaffold_habtm_joins is now deprecated
15
+ - Support sorted_association_options_find with model name prefix
16
+ - Support empty_field_text per column
17
+ - Fix using nested with habtm association, shallow_delete enabled, delete action added but delete link removed
18
+ - Fix for jquery-ui-rails 8.0 (jQuery UI 14)
19
+
1
20
  = 4.0.13
2
21
  - Fix security_methods on destroy_existing
3
22
 
data/README.md CHANGED
@@ -12,10 +12,11 @@ ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, r
12
12
 
13
13
  Branch Details
14
14
  --------------
15
- master supports rails >= 6.1.x and <= 7.2.x, and ruby >= 3.0.0
16
- 3-7-stable supports rails >= 5.2.x and <= 7.1.x, and ruby >= 2.5.0
15
+ master supports rails >= 7.0.x and <= 7.2.x, and ruby >= 3.1.0
16
+ 4-0-stable supports rails >= 6.1.x and <= 7.2.x, and ruby >= 3.0.0
17
17
 
18
18
  These versions are not supported anymore:
19
+ 3-7-stable supports rails >= 5.2.x and <= 7.1.x, and ruby >= 2.5.0
19
20
  3-6-stable supports rails >= 4.2.x and <= 6.1.x, and ruby >= 2.3.0
20
21
  3-5-stable supports rails >= 4.0.x and <= 5.1.x, and ruby >= 2.0.0
21
22
  3-4-stable supports rails >= 3.2.x and <= 4.2.x, and ruby >= 1.9.3
@@ -38,9 +39,9 @@ Add jquery-rails to Gemfile, or handle jquery with other tools like webpack or i
38
39
  gem 'jquery-rails'
39
40
  ```
40
41
 
41
- For rails 7.x, install generator will add active_scaffold to config/importmap.rb, app/javascript/application.js, and active_scaffold/manifest.js to app/assets/config/manifest.js. It will add jquery and jquery_ujs to all the 3 files if jquery-rails gem is available.
42
+ For rails 7.x, install generator will add `active_scaffold` to `config/importmap.rb`, `app/javascript/application.js`, and `active_scaffold/manifest.js` to `app/assets/config/manifest.js`. It will add `jquery` and `jquery_ujs` to all the 3 files if jquery-rails gem is available.
42
43
 
43
- For rails 6.1, install generator will create app/assets/javascripts/application.js, add it, and active_scaffold/manifest.js, to app/assets/config/manifest.js and add javascript_include_tag in layout, as ActiveScaffold doesn't work with webpack. It will add jquery to app/assets/javascripts/application.js too if query-rails gem is available, although Jquery may be loaded by packs too and it will work, it won't add jquery_ujs or @rails/ujs as it's added to app/javascript/packs/application.js by default.
44
+ For rails 6.1, install generator will create `app/assets/javascripts/application.js`, add it, and `active_scaffold/manifest.js`, to `app/assets/config/manifest.js` and add `javascript_include_tag` in the layout, as ActiveScaffold doesn't work with webpack. It will add `jquery` to `app/assets/javascripts/application.js` too if query-rails gem is available, although Jquery may be loaded by packs too and it will work, it won't add `jquery_ujs` or `@rails/ujs` as it's added to `app/javascript/packs/application.js` by default.
44
45
 
45
46
  Run the following commands
46
47
 
@@ -64,6 +65,8 @@ Threadsafe is enabled always since 4.0, and it can't be disabled.
64
65
  Breaking Changes
65
66
  ----------------
66
67
 
68
+ When upgrading from 3.x, add `active_scaffold/manifest.js` to `app/assets/config/manifest.js` to prevent issues with assets.
69
+
67
70
  Changing column settings on a request has changed, it must use `active_scaffold_config.columns.override(:name)` at least the first time. After calling `columns.override(:name)`, calling it again or calling `columns[:name]` will return the overrided column. It also supports a block. See [Per Request Configuration](https://github.com/activescaffold/active_scaffold/wiki/Per-Request-Configuration) for examples and more comprehensive explanation.
68
71
 
69
72
  Changing columns for an action (e.g. add or exclude) on a request must use active_scaffold_config.actions.override_columns, the first time, or use assignment.
@@ -103,10 +106,13 @@ Released under the MIT license (included)
103
106
 
104
107
  A ruby translation project managed on [Locale](http://www.localeapp.com/) that's open to all!
105
108
 
106
- ## Contributing to active_scaffold
109
+ ## Contributing to ActiveScaffold
107
110
 
108
111
  - Edit the translations directly on the [active_scaffold](http://www.localeapp.com/projects/public?search=active_scaffold) project on Locale.
109
112
  - **That's it!**
110
113
  - The maintainer will then pull translations from the Locale project and push to Github.
111
114
 
112
115
  Happy translating!
116
+
117
+ ### Powered by
118
+ [![RubyMine logo](https://resources.jetbrains.com/storage/products/company/brand/logos/RubyMine.png)](https://jb.gg/OpenSource)
@@ -6,7 +6,7 @@
6
6
  elsif Jquery.const_defined? :Ui
7
7
  jquery_ui_prefix = Jquery::Ui::Rails::VERSION < '5.0.0' ? 'jquery.ui.' : 'jquery-ui/'
8
8
  jquery_ui_widgets_prefix = Jquery::Ui::Rails::VERSION >= '6.0.0' ? 'widgets/' : ''
9
- require_asset "#{jquery_ui_prefix}core"
9
+ require_asset "#{jquery_ui_prefix}core" unless Jquery::Ui::Rails::VERSION >= '8.0.0'
10
10
  require_asset "#{jquery_ui_prefix}effect"
11
11
  require_asset "#{jquery_ui_prefix}effects/effect-highlight" if Jquery::Ui::Rails::VERSION >= '6.0.0'
12
12
  require_asset "#{jquery_ui_prefix}#{jquery_ui_widgets_prefix}sortable"
@@ -45,7 +45,7 @@
45
45
  jQuery(document).on('ajax:beforeSend', 'form.as_form', function(event) {
46
46
  var as_form = jQuery(this).closest("form");
47
47
  if (as_form.data('loading') == true) {
48
- ActiveScaffold.disable_form(as_form);
48
+ if (!jQuery(event.target).data('skip-disable-form')) ActiveScaffold.disable_form(as_form);
49
49
  }
50
50
  return true;
51
51
  });
@@ -79,7 +79,7 @@
79
79
  setTimeout(function() { ActiveScaffold.disable_form(form_id); }, 10);
80
80
  if (as_form.attr('target')) {
81
81
  cookie = 'as_dl_' + new Date().getTime();
82
- as_form.append($('<input>', {type: 'hidden', name: '_dl_cookie', value: cookie}));
82
+ as_form.append(jQuery('<input>', {type: 'hidden', name: '_dl_cookie', value: cookie}));
83
83
  iframe = jQuery('iframe[name="' + jQuery(this).attr('target') + '"]')[0];
84
84
  interval = setInterval(function() {
85
85
  doc = iframe.contentDocument || (iframe.contentWindow && iframe.contentWindow.document);
@@ -97,6 +97,18 @@
97
97
  }
98
98
  return true;
99
99
  });
100
+ jQuery(document).on('ajax:before', 'a.as_action[data-prompt]', function(e, xhr, settings){
101
+ var link = jQuery(this), value = prompt(link.data('prompt'));
102
+ if (value) {
103
+ link.data('params', jQuery.param({value: value}));
104
+ } else if (jQuery(this).data('prompt-required')) {
105
+ e.stopImmediatePropagation();
106
+ return false;
107
+ } else {
108
+ link.removeData('params');
109
+ }
110
+ return true;
111
+ });
100
112
  jQuery(document).on('ajax:before', 'a.as_action', function(event) {
101
113
  var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
102
114
  if (action_link) {
@@ -142,6 +154,22 @@
142
154
  }
143
155
  return true;
144
156
  });
157
+ jQuery(document).on({
158
+ 'ajax:before': function () {
159
+ var $this = jQuery(this), indicator_id = $this.data('loading-indicator-id'),
160
+ $indicator = indicator_id ? jQuery('#' + indicator_id) : jQuery();
161
+ if (!$indicator.length) $indicator = $this.parent().find('.loading-indicator');
162
+ if (!$indicator.length) $indicator = $this.closest('.active-scaffold-header').find('.loading-indicator:first');
163
+ $indicator.css('visibility', 'visible');
164
+ $this.data('url', jQuery('option:selected', this).data('url'));
165
+ }, 'ajax:complete': function () {
166
+ var $this = jQuery(this), indicator_id = $this.data('loading-indicator-id'),
167
+ $indicator = indicator_id ? jQuery('#' + indicator_id) : jQuery();
168
+ if (!$indicator.length) $indicator = $this.parent().find('.loading-indicator');
169
+ if (!$indicator.length) $indicator = $this.closest('.active-scaffold-header').find('.loading-indicator');
170
+ $indicator.css('visibility', 'hidden');
171
+ }
172
+ }, ':input[data-remote="url"]:not(data-url)');
145
173
  jQuery(document).on('ajax:before', 'a.as_cancel', function(event) {
146
174
  var as_cancel = jQuery(this);
147
175
  var action_link = ActiveScaffold.find_action_link(as_cancel);
@@ -255,7 +283,7 @@
255
283
  if (element.is(".checkbox-list input:checkbox")) {
256
284
  form_element = element.closest('.checkbox-list');
257
285
  if (form_element.is('.draggable-list')) form_element = form_element.closest('.draggable-lists-container').find('.checkbox-list') // draggable lists will have 2 lists
258
- value = form_element.find(':checked').map(function(item){return $(this).val();}).toArray();
286
+ value = form_element.find(':checked').map(function(item) { return jQuery(this).val(); }).toArray();
259
287
  if (!additional_params) additional_params = (element.is(':checked') ? '_added=' : '_removed=') + element.val();
260
288
  } else {
261
289
  value = element.is("input:checkbox:not(:checked)") ? null : element.val();
@@ -271,7 +299,7 @@
271
299
  var value;
272
300
  if (form_element.is(".field_with_errors")) form_element = form_element.children().last();
273
301
  if (form_element.is(".checkbox-list")) {
274
- value = form_element.find(':checked').map(function(item){return $(this).val();}).toArray();
302
+ value = form_element.find(':checked').map(function(item) { return jQuery(this).val(); }).toArray();
275
303
  form_element = form_element.parent().find("input:checkbox"); // parent is needed for draggable-list, checked list may be empty
276
304
  } else value = form_element.is("input:checkbox:not(:checked)") ? null : form_element.val();
277
305
  ActiveScaffold.update_column(form_element, element.attr('href'), element.data('update_send_form'), form_element.attr('id'), value);
@@ -306,7 +334,7 @@
306
334
 
307
335
  jQuery(document).on('click', '.active-scaffold .sub-form a.destroy', function(event) {
308
336
  event.preventDefault();
309
- ActiveScaffold.delete_subform_record($(this).data('delete-id'));
337
+ ActiveScaffold.delete_subform_record(jQuery(this).data('delete-id'));
310
338
  });
311
339
 
312
340
  jQuery(document).on("click", '.hover_click', function(event) {
@@ -339,7 +367,7 @@
339
367
  });
340
368
 
341
369
  jQuery(document).on('click', '.hide-new-subform, .show-new-subform', function(e) {
342
- var $this = jQuery(this), line = $this.closest('.form-element'),
370
+ var $this = jQuery(this), line = $this.closest('.form-element, td'),
343
371
  subform = line.find('#' + $this.data('subform-id')), radio = false, hide, select;
344
372
  if ($this.is('[type=radio]')) {
345
373
  radio = true;
@@ -380,12 +408,12 @@
380
408
  'input:not([type=button]):not([type=submit]):not([type=reset]):not([type=hidden]),' +
381
409
  'textarea, select:has(option[value=""])'
382
410
  ).val('');
383
- form.find('select.as_search_range_option').each(function() { $(this).val($(this).find('option:first').val()) });
411
+ form.find('select.as_search_range_option').each(function() { jQuery(this).val(jQuery(this).find('option:first').val()) });
384
412
  form.find('select.as_search_date_time_option').val('BETWEEN');
385
413
  });
386
414
 
387
415
  jQuery(document).on('click', '.active-scaffold .tabbed .nav-tabs a', function(e) {
388
- if (typeof $().tab == 'function') return; // bootstrap tab plugin is loaded and will handle tabs
416
+ if (typeof jQuery().tab == 'function') return; // bootstrap tab plugin is loaded and will handle tabs
389
417
  e.preventDefault();
390
418
  var tab_ctrl = jQuery(this), tabbed = tab_ctrl.closest('.tabbed')
391
419
  tabbed.find('.nav-tabs .active').removeClass('active');
@@ -425,20 +453,20 @@
425
453
  setTimeout(ActiveScaffold.update_floating_form_footer); // delay so form is already removed
426
454
  });
427
455
  jQuery(document).on('as:action_success', 'a.as_action', function(e, action_link) {
428
- ActiveScaffold.setup(action_link.adapter);
456
+ if (action_link.adapter) ActiveScaffold.setup(action_link.adapter);
429
457
  });
430
458
  jQuery(document).on('as:element_updated', '.active-scaffold', function(e) {
431
459
  if (e.target != this) return;
432
- var search = $(this).find('form.search');
460
+ var search = jQuery(this).find('form.search');
433
461
  if (search.length) ActiveScaffold.focus_first_element_of_form(search);
434
462
  });
435
463
  jQuery(document).on('click', '.active-scaffold form .check-all', function(e) {
436
464
  e.preventDefault();
437
- ActiveScaffold.update_all_checkboxes($(this), true);
465
+ ActiveScaffold.update_all_checkboxes(jQuery(this), true);
438
466
  });
439
467
  jQuery(document).on('click', '.active-scaffold form .uncheck-all', function(e) {
440
468
  e.preventDefault();
441
- ActiveScaffold.update_all_checkboxes($(this), false);
469
+ ActiveScaffold.update_all_checkboxes(jQuery(this), false);
442
470
  });
443
471
  });
444
472
 
@@ -591,7 +619,7 @@
591
619
  },
592
620
  sliders: function(element) {
593
621
  jQuery('.as-slider', element).each(function() {
594
- var opts = $(this).data('slider');
622
+ var opts = jQuery(this).data('slider');
595
623
  jQuery(this).slider(opts);
596
624
  if (opts.disabled) jQuery(this).find('.ui-slider-handle').hide();
597
625
  });
@@ -604,7 +632,7 @@
604
632
  item.closest('.active-scaffold-component').load(item.attr('href'), function(response, status, xhr) {
605
633
  if (status == 'error') {
606
634
  indicator.css({visibility: 'hidden'});
607
- indicator.after($('<p>').html(item.data('error-msg')).addClass("error-message message server-error"));
635
+ indicator.after(jQuery('<p>').html(item.data('error-msg')).addClass("error-message message server-error"));
608
636
  } else jQuery(this).trigger('as:element_updated');
609
637
  });
610
638
  });
@@ -979,8 +1007,8 @@
979
1007
  // find without entering new subforms
980
1008
  element = container.find(selector + ':not(.sub-form) .' + options.field_class);
981
1009
  if (container.is('.sub-form-record'))
982
- element = element.filter(function() { return $(this).closest('.sub-form-record').get(0) === container.get(0); });
983
- else element = element.filter(function() { return $(this).closest('.sub-form-record').length === 0; });
1010
+ element = element.filter(function() { return jQuery(this).closest('.sub-form-record').get(0) === container.get(0); });
1011
+ else element = element.filter(function() { return jQuery(this).closest('.sub-form-record').length === 0; });
984
1012
  if (element.length)
985
1013
  element = element.first().closest('dl');
986
1014
  else if (options.subform_class)
@@ -1187,7 +1215,7 @@
1187
1215
  update_all_checkboxes: function(button, state) {
1188
1216
  var lists = button.closest('.check-buttons').parent().find('.checkbox-list'),
1189
1217
  checkboxes = lists.find(':checkbox'), key = state ? '_added' : '_removed', params;
1190
- params = checkboxes.filter(state ? ':not(:checked)' : ':checked').map(function() { return key + '[]=' + $(this).val(); }).toArray().join('&');
1218
+ params = checkboxes.filter(state ? ':not(:checked)' : ':checked').map(function() { return key + '[]=' + jQuery(this).val(); }).toArray().join('&');
1191
1219
  checkboxes.prop('checked', state);
1192
1220
  if (lists.filter('.draggable-list').length) {
1193
1221
  var parent = state ? lists.filter('.selected') : lists.filter(':not(.selected)');
@@ -1300,6 +1328,7 @@
1300
1328
  if (typeof(element.data('action_link')) === 'undefined' && !element.hasClass('as_adapter')) {
1301
1329
  var parent = element.parent().closest('.record');
1302
1330
  if (parent.length === 0) parent = element.parent().closest('.actions');
1331
+ if (parent.length === 0) parent = element.parent().closest('form.as_form');
1303
1332
  if (parent.is('.record')) {
1304
1333
  // record action
1305
1334
  var target = parent.find('a.as_action');
@@ -1309,6 +1338,9 @@
1309
1338
  } else if (parent.is('.active-scaffold-header .actions')) {
1310
1339
  //table action
1311
1340
  new ActiveScaffold.Actions.Table(parent.find('a.as_action'), parent.closest('div.active-scaffold').find('tbody.before-header').first(), parent.find('.loading-indicator').first());
1341
+ } else if (parent.is('form.as_form')) {
1342
+ //table action
1343
+ new ActiveScaffold.Actions.Table(parent.find('a.as_action').filter(function() { return !jQuery(this).data('action_link'); }), parent.closest('div.active-scaffold').find('tbody.before-header').first(), parent.find('.form-footer .loading-indicator').first());
1312
1344
  }
1313
1345
  element = jQuery(element);
1314
1346
  }
@@ -1383,23 +1415,38 @@
1383
1415
  },
1384
1416
 
1385
1417
  scaffold_id: function() {
1386
- return '#' + this.tag.closest('div.active-scaffold').attr('id');
1418
+ const div_id = this.scaffold().attr('id');
1419
+ if (div_id) return '#' + div_id;
1387
1420
  },
1388
1421
 
1389
1422
  scaffold: function() {
1390
1423
  return this.tag.closest('div.active-scaffold');
1391
1424
  },
1392
1425
 
1426
+ messages: function() {
1427
+ const re = /-active-scaffold$/, div_id = this.scaffold_id();
1428
+
1429
+ if (re.test(div_id)) {
1430
+ return jQuery(div_id.replace(re, '-messages'));
1431
+ } else {
1432
+ var messages_container = this.scaffold().find('.messages-container'),
1433
+ messages = messages_container.find('.action-messages');
1434
+ if (!messages.length) messages = jQuery('<div class="action-messages"></div>').appendTo(messages_container);
1435
+ return messages;
1436
+ }
1437
+ },
1438
+
1393
1439
  update_flash_messages: function(messages) {
1394
- var message_node = jQuery(this.scaffold_id().replace(/-active-scaffold/, '-messages'));
1395
- if (message_node) message_node.html(messages);
1440
+ this.messages().html(messages);
1396
1441
  },
1442
+
1397
1443
  set_adapter: function(element) {
1398
1444
  this.adapter = element;
1399
1445
  this.adapter.addClass('as_adapter');
1400
1446
  this.adapter.data('action_link', this);
1401
1447
  if (this.refresh_url) jQuery('.as_cancel', this.adapter).attr('href', this.refresh_url);
1402
1448
  },
1449
+
1403
1450
  keep_open: function() {
1404
1451
  return this.tag.data('keep-open');
1405
1452
  }
@@ -43,7 +43,7 @@ jQuery(document).on("focus", "input.datetime_picker", function(){
43
43
  });
44
44
 
45
45
  jQuery(document).on('change', 'input.datetime_picker', function(e) {
46
- var $this = $(this);
46
+ var $this = jQuery(this);
47
47
  if ($this.data('first-event')) $this.removeData('first-event');
48
48
  else {
49
49
  $this.data('first-event', true);
@@ -11,7 +11,7 @@
11
11
  li.children('label').removeAttr('for');
12
12
  if (jQuery(item).is(':checked')) li.appendTo(list_selected);
13
13
  });
14
- check_buttons.find('.check-all, .uncheck-all').attr('title', function() { return $(this).text() });
14
+ check_buttons.find('.check-all, .uncheck-all').attr('title', function() { return jQuery(this).text() });
15
15
  element.after(check_buttons);
16
16
  var options = {
17
17
  hoverClass: 'hover',
@@ -20,6 +20,7 @@
20
20
  var id = jQuery(this).attr('id');
21
21
  if (tinymce && tinymce.majorVersion >= 6) {
22
22
  settings.selector = '#' + id;
23
+ if (settings.setup) settings.setup = eval(settings.setup);
23
24
  tinymce.init(settings);
24
25
  } else { // tinyMCE.majorVersion < 6
25
26
  tinyMCE.settings = settings;