active_scaffold 3.5.5 → 3.6.0.pre

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 (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +18 -2
  3. data/README.md +17 -7
  4. data/app/assets/javascripts/jquery/active_scaffold.js +28 -2
  5. data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -2
  6. data/app/views/active_scaffold_overrides/_form.html.erb +1 -1
  7. data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +3 -2
  8. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +6 -6
  9. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
  10. data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -1
  11. data/app/views/active_scaffold_overrides/_list.html.erb +2 -1
  12. data/app/views/active_scaffold_overrides/_list_messages.html.erb +1 -0
  13. data/app/views/active_scaffold_overrides/_messages.html.erb +1 -0
  14. data/app/views/active_scaffold_overrides/_render_field.js.erb +2 -1
  15. data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +2 -1
  16. data/app/views/active_scaffold_overrides/_show_columns.html.erb +2 -2
  17. data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +4 -4
  18. data/app/views/active_scaffold_overrides/_update_calculations.js.erb +1 -1
  19. data/app/views/active_scaffold_overrides/_update_column.js.erb +2 -2
  20. data/app/views/active_scaffold_overrides/action_confirmation.html.erb +2 -2
  21. data/app/views/active_scaffold_overrides/delete.html.erb +2 -2
  22. data/app/views/active_scaffold_overrides/on_action_update.js.erb +16 -6
  23. data/app/views/active_scaffold_overrides/on_update.js.erb +1 -1
  24. data/app/views/active_scaffold_overrides/row.js.erb +1 -1
  25. data/app/views/active_scaffold_overrides/update_column.js.erb +1 -1
  26. data/lib/active_scaffold.rb +11 -13
  27. data/lib/active_scaffold/actions/core.rb +25 -35
  28. data/lib/active_scaffold/actions/create.rb +1 -1
  29. data/lib/active_scaffold/actions/delete.rb +2 -2
  30. data/lib/active_scaffold/actions/field_search.rb +2 -2
  31. data/lib/active_scaffold/actions/list.rb +8 -7
  32. data/lib/active_scaffold/actions/nested.rb +9 -9
  33. data/lib/active_scaffold/actions/search.rb +1 -1
  34. data/lib/active_scaffold/actions/show.rb +1 -1
  35. data/lib/active_scaffold/actions/subform.rb +3 -1
  36. data/lib/active_scaffold/actions/update.rb +5 -4
  37. data/lib/active_scaffold/active_record_permissions.rb +2 -11
  38. data/lib/active_scaffold/attribute_params.rb +16 -23
  39. data/lib/active_scaffold/bridges.rb +8 -8
  40. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +1 -1
  41. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
  42. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +3 -18
  43. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +1 -1
  44. data/lib/active_scaffold/bridges/chosen/helpers.rb +7 -6
  45. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -13
  46. data/lib/active_scaffold/bridges/date_picker/helper.rb +3 -3
  47. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  48. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +3 -3
  49. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +8 -7
  50. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +2 -4
  51. data/lib/active_scaffold/bridges/paper_trail.rb +1 -1
  52. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  53. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
  54. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +2 -2
  55. data/lib/active_scaffold/bridges/record_select/helpers.rb +9 -9
  56. data/lib/active_scaffold/bridges/shared/date_bridge.rb +3 -3
  57. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +1 -1
  58. data/lib/active_scaffold/config/base.rb +89 -21
  59. data/lib/active_scaffold/config/core.rb +127 -18
  60. data/lib/active_scaffold/config/delete.rb +2 -0
  61. data/lib/active_scaffold/config/field_search.rb +7 -1
  62. data/lib/active_scaffold/config/form.rb +10 -1
  63. data/lib/active_scaffold/config/list.rb +27 -11
  64. data/lib/active_scaffold/config/mark.rb +3 -1
  65. data/lib/active_scaffold/config/nested.rb +16 -17
  66. data/lib/active_scaffold/config/search.rb +9 -0
  67. data/lib/active_scaffold/config/show.rb +4 -0
  68. data/lib/active_scaffold/config/update.rb +4 -0
  69. data/lib/active_scaffold/configurable.rb +11 -6
  70. data/lib/active_scaffold/constraints.rb +1 -1
  71. data/lib/active_scaffold/core.rb +46 -16
  72. data/lib/active_scaffold/data_structures/action_columns.rb +50 -59
  73. data/lib/active_scaffold/data_structures/action_link.rb +20 -8
  74. data/lib/active_scaffold/data_structures/action_links.rb +6 -2
  75. data/lib/active_scaffold/data_structures/association/abstract.rb +9 -5
  76. data/lib/active_scaffold/data_structures/association/active_record.rb +1 -1
  77. data/lib/active_scaffold/data_structures/column.rb +51 -33
  78. data/lib/active_scaffold/data_structures/nested_info.rb +1 -1
  79. data/lib/active_scaffold/data_structures/set.rb +8 -0
  80. data/lib/active_scaffold/data_structures/sorting.rb +5 -2
  81. data/lib/active_scaffold/delayed_setup.rb +2 -1
  82. data/lib/active_scaffold/extensions/action_controller_rendering.rb +2 -1
  83. data/lib/active_scaffold/extensions/action_view_rendering.rb +1 -1
  84. data/lib/active_scaffold/extensions/cow_proxy.rb +43 -0
  85. data/lib/active_scaffold/extensions/ice_nine.rb +36 -0
  86. data/lib/active_scaffold/extensions/left_outer_joins.rb +8 -33
  87. data/lib/active_scaffold/extensions/routing_mapper.rb +4 -43
  88. data/lib/active_scaffold/extensions/unsaved_record.rb +2 -4
  89. data/lib/active_scaffold/finder.rb +26 -30
  90. data/lib/active_scaffold/helpers/action_link_helpers.rb +16 -16
  91. data/lib/active_scaffold/helpers/association_helpers.rb +5 -5
  92. data/lib/active_scaffold/helpers/controller_helpers.rb +11 -1
  93. data/lib/active_scaffold/helpers/form_column_helpers.rb +25 -24
  94. data/lib/active_scaffold/helpers/id_helpers.rb +2 -2
  95. data/lib/active_scaffold/helpers/list_column_helpers.rb +8 -6
  96. data/lib/active_scaffold/helpers/search_column_helpers.rb +4 -4
  97. data/lib/active_scaffold/helpers/view_helpers.rb +7 -13
  98. data/lib/active_scaffold/marked_model.rb +2 -2
  99. data/lib/active_scaffold/orm_checks.rb +1 -5
  100. data/lib/active_scaffold/paginator.rb +6 -4
  101. data/lib/active_scaffold/registry.rb +22 -0
  102. data/lib/active_scaffold/responds_to_parent.rb +2 -6
  103. data/lib/active_scaffold/tableless.rb +63 -59
  104. data/lib/active_scaffold/version.rb +2 -2
  105. data/lib/generators/active_scaffold/controller_generator.rb +2 -2
  106. data/lib/generators/active_scaffold/install_generator.rb +1 -1
  107. data/lib/generators/active_scaffold/resource_generator.rb +2 -2
  108. data/test/bridges/date_picker_test.rb +1 -2
  109. data/test/bridges/paperclip_test.rb +5 -5
  110. data/test/class_with_finder.rb +2 -2
  111. data/test/company.rb +2 -2
  112. data/test/config/create_test.rb +4 -2
  113. data/test/config/nested_test.rb +1 -1
  114. data/test/config/show_test.rb +1 -1
  115. data/test/config/update_test.rb +7 -6
  116. data/test/data_structures/action_links_test.rb +1 -1
  117. data/test/data_structures/sorting_test.rb +7 -0
  118. data/test/misc/active_record_permissions_test.rb +1 -9
  119. data/test/misc/attribute_params_test.rb +8 -8
  120. data/test/misc/calculation_test.rb +1 -1
  121. data/test/misc/constraints_test.rb +2 -2
  122. data/test/misc/convert_numbers_format_test.rb +3 -3
  123. data/test/misc/lang_test.rb +1 -1
  124. data/test/misc/parse_datetime_test.rb +3 -4
  125. data/test/misc/tableless_test.rb +6 -0
  126. data/test/mock_app/Rakefile +1 -1
  127. data/test/mock_app/config/application.rb +1 -1
  128. data/test/mock_app/config/boot.rb +1 -1
  129. data/test/mock_app/config/environment.rb +2 -2
  130. data/test/test_helper.rb +8 -1
  131. metadata +38 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55227fba8c77ac9fa4c3c93fb5b482cc92dd767d07f57611863a98f8e8488e54
4
- data.tar.gz: ac8a1a22b165658cacb056d56bf3646ce94d93765059f1f113ad3bd68ee37997
3
+ metadata.gz: 089ef264fed67a42513f1317c4db56ccd736fdf9f57aeffcc469e9c672987c10
4
+ data.tar.gz: 7c2a738e0396d7644e873424e529543df14ea8336fbb26c6297670232dfa6903
5
5
  SHA512:
6
- metadata.gz: 49048946d6223c2f8d15ff44d990856ca3c4bb24660abf45170ecd66f0a4f95687f94e0a13f393914d08d4220556da7ff598210a8570dfd70840e68f325e8793
7
- data.tar.gz: 91ebe94b8625eae16f22dc705e14fbfaf58723845ba1f3264a89ebfa30d6cc4eb121203d659e226f55d6747c8812318c59ba535629beb3f9c6cafcc896f7b38a
6
+ metadata.gz: a23bf85f720e929a7da5ad87a92c6140ec584346f24a9d2a94db1a0bf82033cd556ec971ec2dfe50346cdb9d248e1b34c0675003c224a6a0ab29185008f4bb92
7
+ data.tar.gz: a72a0ad55518d03a44ae9f98cca0f9236369c55e5e2924673597712b0cadbddf9bea7a4424d9248215b32e51366845962469dce775ec7db7a903d6e73790037b
data/CHANGELOG CHANGED
@@ -1,5 +1,20 @@
1
- = 3.5.5
2
- - Fix creating new records, when using cancan and allowing access based on id (fixes #617)
1
+ = 3.6.0.pre
2
+ - Added threadsafety as tech preview, enabled with ActiveScaffold.threadsafe! in initializer.
3
+ - Added active_scaffold_config.build_action_columns method to easily create action columns for custom form actions.
4
+ - Replaced each(options) with each_column(options) in ActionColumns
5
+ - Replaced collect_visible(options, &proc) with visible_columns(options).map(&proc) in ActionColumns
6
+ - Replaced names with visible_columns_names in ActionColumns
7
+ - Replaced names_without_auth_check with to_a in ActionColumns
8
+ - Support rails 5.2, drop support for 4.0 and 4.1
9
+ - Require ruby 2.3.1, drop support for 2.0, 2.1 and 2.2.
10
+ - Fix has_one/belongs_to nested for polymorphic associations, leave rails to build conditions from {assoc_name: record} hash
11
+ - Cast blank into nil for null string columns in conditions_from_params
12
+ - Support multipart with iframe in process_action_link_action default response
13
+ - Fix hidding and showing columns based on permissions with update_columns on subforms
14
+ - Fix subform crud in subform subgroup, when form is on nested scaffold
15
+ - Fix JS when rails-ujs is used instead of jquery_ujs (rails >= 5.1)
16
+ - Display flash messages only inside create form, when conf.list.always_show_create is enabled, instead of displaying twice (in form and above list).
17
+ - Fix default autocomplete value for password form_ui, new-password has to be used because off is ignored by browsers in password fields now
3
18
 
4
19
  = 3.5.4
5
20
  - Fix chosen form_ui for plural associations
@@ -57,6 +72,7 @@
57
72
  - fix display of association in list when association_limit is nil
58
73
  - fix conversion of i18n date and datetime value, some abbr day and month may be equal in some languages
59
74
  - fix hidden form_ui for collection associations (has_many, habtm)
75
+ - Drop rails 3.2.x and ruby 1.9 support
60
76
 
61
77
  = 3.4.43
62
78
  - Fix human conditions for date and datetime columns, not using date picker
data/README.md CHANGED
@@ -8,10 +8,11 @@ Overview
8
8
  [![Inline docs](https://inch-ci.org/github/activescaffold/active_scaffold.svg?branch=master)](https://inch-ci.org/github/activescaffold/active_scaffold)
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
10
10
 
11
- ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails >= 4.0.5 and < 5.2 is supported, ruby >= 2.1 supported, although it should work with ruby >= 2.0.0, it's too old and not tested. Ruby < 2.0.0 won't work.
11
+ ActiveScaffold provides a quick and powerful user interfaces for CRUD (create, read, update, delete) operations for Rails applications. It offers additonal features including searching, pagination & layout control. Rails >= 4.2.0 is supported, ruby >= 2.3 required.
12
12
 
13
13
  Branch Details
14
14
  --------------
15
+ 3-5-stable supports rails >= 4.0.x and ruby >= 2.0.0
15
16
  3-4-stable supports rails >= 3.2.x and ruby >= 1.9.3
16
17
  3-3-stable supports rails >= 3.2.x and ruby >= 1.8
17
18
  rails-3.2 supports Rails 3.1 & 3.2, and is the current source of the 3.2.x line of gems.
@@ -24,28 +25,37 @@ Added to Gemfile
24
25
 
25
26
  gem 'active_scaffold'
26
27
 
27
- For rails >= 5.1, add
28
+ For rails >= 5.1, add jquery to application.js before rails-ujs (with jquery-rails), or load jquery in your layout before application.js using CDN (e.g. jquery-rails-cdn). You can replace rails-ujs with jquery_ujs, although rails-ujs should work (never load both).
29
+
30
+ //= require jquery
28
31
 
29
32
  gem 'jquery-rails'
30
33
 
31
- Run the following commands
34
+ Run the following commands, for rails 4.2
32
35
 
33
36
  bundle install
34
37
  rails g active_scaffold:install
35
38
  bundle exec rake db:create
36
- rails g active_scaffold:resource User name:string
39
+ rails g active_scaffold:resource Model [attrs]
37
40
  bundle exec rake db:migrate
38
41
 
39
- Commands for Rails 5
42
+ Or run the following commands, for rails 5
40
43
 
41
44
  bundle install
42
45
  rails g active_scaffold:install
43
46
  rails db:create
44
- rails g active_scaffold:resource User name:string
47
+ rails g active_scaffold:resource Model [attrs]
45
48
  rails db:migrate
46
49
 
47
50
 
48
- Run the app and visit localhost:3000/users
51
+ Run the app and visit localhost:3000/<plural_model>
52
+
53
+ Threadsafe
54
+ ----------
55
+
56
+ Threadsafe can be enabled calling ActiveScaffold.threadsafe! in an initializer.
57
+ It should be enabled on app start and it can't be disabled. Threadsafety is a
58
+ new feature and not well tested yet.
49
59
 
50
60
  Configuration
51
61
  -------------
@@ -61,6 +61,11 @@ jQuery(document).ready(function($) {
61
61
  if (e.keyCode == 13) e.preventDefault();
62
62
  });
63
63
  jQuery(document).on('ajax:error', 'form.as_form', function(event, xhr, status, error) {
64
+ if (event.detail && !xhr) {
65
+ error = event.detail[0];
66
+ status = event.detail[1];
67
+ xhr = event.detail[2];
68
+ }
64
69
  var as_div = jQuery(this).closest("div.active-scaffold");
65
70
  if (as_div.length) {
66
71
  ActiveScaffold.report_500_response(as_div, xhr);
@@ -86,6 +91,7 @@ jQuery(document).ready(function($) {
86
91
  return true;
87
92
  });
88
93
  jQuery(document).on('ajax:success', 'a.as_action', function(event, response) {
94
+ if (event.detail && !response) response = event.detail[0];
89
95
  var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
90
96
  if (action_link) {
91
97
  if (action_link.position) {
@@ -105,6 +111,11 @@ jQuery(document).ready(function($) {
105
111
  return true;
106
112
  });
107
113
  jQuery(document).on('ajax:error', 'a.as_action', function(event, xhr, status, error) {
114
+ if (event.detail && !xhr) {
115
+ error = event.detail[0];
116
+ status = event.detail[1];
117
+ xhr = event.detail[2];
118
+ }
108
119
  var action_link = ActiveScaffold.ActionLink.get(jQuery(this));
109
120
  if (action_link) {
110
121
  ActiveScaffold.report_500_response(action_link.scaffold_id(), xhr);
@@ -139,6 +150,11 @@ jQuery(document).ready(function($) {
139
150
  return true;
140
151
  });
141
152
  jQuery(document).on('ajax:error', 'a.as_cancel', function(event, xhr, status, error) {
153
+ if (event.detail && !xhr) {
154
+ error = event.detail[0];
155
+ status = event.detail[1];
156
+ xhr = event.detail[2];
157
+ }
142
158
  var action_link = ActiveScaffold.find_action_link(jQuery(this));
143
159
  if (action_link) {
144
160
  ActiveScaffold.report_500_response(action_link.scaffold_id(), xhr);
@@ -151,6 +167,11 @@ jQuery(document).ready(function($) {
151
167
  return true;
152
168
  });
153
169
  jQuery(document).on('ajax:error', 'a.as_sort', function(event, xhr, status, error) {
170
+ if (event.detail && !xhr) {
171
+ error = event.detail[0];
172
+ status = event.detail[1];
173
+ xhr = event.detail[2];
174
+ }
154
175
  var as_scaffold = jQuery(this).closest('.active-scaffold');
155
176
  ActiveScaffold.report_500_response(as_scaffold, xhr);
156
177
  jQuery(this).closest('th').removeClass('loading');
@@ -179,6 +200,11 @@ jQuery(document).ready(function($) {
179
200
  return true;
180
201
  });
181
202
  jQuery(document).on('ajax:error', 'a.as_paginate', function(event, xhr, status, error) {
203
+ if (event.detail && !xhr) {
204
+ error = event.detail[0];
205
+ status = event.detail[1];
206
+ xhr = event.detail[2];
207
+ }
182
208
  var as_scaffold = jQuery(this).closest('.active-scaffold');
183
209
  ActiveScaffold.report_500_response(as_scaffold, xhr);
184
210
  return true;
@@ -1311,8 +1337,8 @@ ActiveScaffold.ActionLink.Record = ActiveScaffold.ActionLink.Abstract.extend({
1311
1337
  ActiveScaffold.update_row(this.target, refreshed_content_or_reload);
1312
1338
  } else if (this.refresh_url) {
1313
1339
  var target = this.target;
1314
- jQuery.get(this.refresh_url, function(e, status, response) {
1315
- ActiveScaffold.update_row(target, response.responseText);
1340
+ jQuery.get(this.refresh_url, function(e, status, xhr) {
1341
+ ActiveScaffold.update_row(target, xhr.responseText);
1316
1342
  });
1317
1343
  }
1318
1344
  }
@@ -17,7 +17,7 @@
17
17
  submit_text ||= form_action
18
18
  apply_text ||= :"#{form_action}_apply"
19
19
  body_partial ||= 'form'
20
- form_id = element_form_id(:action => form_action, :id => @record.try(:id))
20
+ form_id = element_form_id(action: form_action, id: @record&.id)
21
21
  %>
22
22
  <%=
23
23
  options = {:id => form_id,
@@ -54,7 +54,7 @@ end
54
54
  <%= submit_tag as_(submit_text), :class => "submit" if !persistent || persistent == :optional %>
55
55
  <%= submit_tag as_(apply_text), :class => "submit", :name => 'dont_close' if persistent %>
56
56
  <%= link_to(as_(:cancel), main_path_to_return, cancel_options) if cancel_link %>
57
- <%= loading_indicator_tag(:action => form_action, :id => @record.try(:id)) %>
57
+ <%= loading_indicator_tag(action: form_action, id: @record&.id) %>
58
58
  <%= render :partial => footer_extension, :locals => { :form_action => form_action } if footer_extension %>
59
59
  </p>
60
60
 
@@ -4,7 +4,7 @@
4
4
  show_unauthorized_columns = active_scaffold_config.send(form_action).show_unauthorized_columns if active_scaffold_config.actions.include? form_action
5
5
  %>
6
6
  <ol class="form" <%= "id=#{subsection_id}" unless subsection_id.nil? %> <%= "style=\"display: none;\"".html_safe if columns.collapsed %>>
7
- <% columns.each :for => @record, :crud_type => (:read if show_unauthorized_columns) do |column| %>
7
+ <% columns.each_column(for: @record, crud_type: (:read if show_unauthorized_columns)) do |column| %>
8
8
  <% column_css_class = column.css_class unless column.css_class.nil? || column.css_class.is_a?(Proc) %>
9
9
  <% renders_as = column_renders_as(column) %>
10
10
  <% authorized = show_unauthorized_columns || renders_as == :subsection ? @record.authorized_for?(:crud_type => form_action, :column => column.name) : true %>
@@ -13,8 +13,9 @@ return unless show_add_new or show_add_existing
13
13
  temporary_id = generated_id(parent_record) if parent_record.new_record?
14
14
  controller_path = active_scaffold_controller_for(parent_record.class).controller_path
15
15
  parent_controller = (main_form_controller || controller).controller_path
16
- edit_associated_url = params_for(:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :associated_id => '--ID--', :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller) if show_add_existing
17
- add_new_url = params_for(:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller) if show_add_new
16
+ url_options = {:controller => controller_path, :action => 'edit_associated', :child_association => column.name, :scope => scope, :id => parent_record.to_param, :generated_id => temporary_id, :parent_controller => parent_controller}
17
+ edit_associated_url = params_for(url_options.merge(:associated_id => '--ID--')) if show_add_existing
18
+ add_new_url = params_for(url_options) if show_add_new
18
19
 
19
20
  -%>
20
21
  <div class="footer-wrapper">
@@ -40,9 +40,9 @@
40
40
  <% end %>
41
41
  <% end %>
42
42
  <%= content_tag row_tag, :id => tr_id, :class => "association-record#{' association-record-new' if record.new_record?}#{' locked' if locked}" do %>
43
- <% config.subform.columns.each :for => record.class, :crud_type => :read, :flatten => flatten do |column| %>
43
+ <% config.subform.columns.each_column(for: record.class, crud_type: :read, flatten: flatten) do |column| %>
44
44
  <%
45
- if column.respond_to? :each
45
+ if column.respond_to? :each_column
46
46
  columns_groups << column
47
47
  next
48
48
  end
@@ -51,8 +51,8 @@
51
51
  columns_length += 1
52
52
  show_actions = true
53
53
  if column.association && column.form_ui.nil?
54
- column = column.clone
55
- column.form_ui ||= :select
54
+ column = column.dup unless ActiveScaffold.threadsafe
55
+ column.form_ui = :select
56
56
  end
57
57
 
58
58
  col_class = default_col_class.clone
@@ -80,10 +80,10 @@
80
80
  <% end -%>
81
81
  <% end %>
82
82
 
83
- <% columns_groups.each do |column| %>
83
+ <% columns_groups.each do |columns_group| %>
84
84
  <%= content_tag row_tag, :class => 'associated-record' do %>
85
85
  <%= content_tag column_tag, :colspan => (columns_length if column_tag == :td) do %>
86
- <% column.each :for => record.class, :crud_type => :read, :flatten => true do |col| %>
86
+ <% columns_group.each_column(for: record.class, crud_type: :read, flatten: true) do |col| %>
87
87
  <%= active_scaffold_render_subform_column(col, scope, crud_type, readonly, true, record) %>
88
88
  <% end %>
89
89
  <% end %>
@@ -1,4 +1,4 @@
1
- <table id="<%= sub_form_list_id(:association => column.name, :id => parent_record.try(:id) || generated_id(parent_record) || 99999999999) %>">
1
+ <table id="<%= sub_form_list_id(association: column.name, id: parent_record&.id || generated_id(parent_record) || 99999999999) %>">
2
2
  <%
3
3
  header_record_class = (show_blank_record && show_blank_record.class) || column.association.klass
4
4
  -%>
@@ -1,7 +1,7 @@
1
1
  <thead>
2
2
  <tr>
3
3
  <%
4
- active_scaffold_config_for(record_class).subform.columns.each :for => record_class, :crud_type => :read do |column|
4
+ active_scaffold_config_for(record_class).subform.columns.each_column(for: record_class, crud_type: :read) do |column|
5
5
  next unless column.is_a? ActiveScaffold::DataStructures::Column
6
6
  next unless in_subform?(column, parent_record, parent_column)
7
7
  hidden = column_renders_as(column) == :hidden
@@ -4,7 +4,8 @@
4
4
  <tr>
5
5
  <td class="messages-container">
6
6
  <p class="error-message message server-error" style="display:none;">
7
- <%= as_(:internal_error).html_safe %><span class="error-500"><%= as_(:error_500).html_safe %></span>
7
+ <%= as_(:internal_error).html_safe %>
8
+ <span class="error-500"><%= as_(:error_500).html_safe %></span>
8
9
  <a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
9
10
  </p>
10
11
  <div id="<%= active_scaffold_messages_id -%>" class="action-messages">
@@ -5,6 +5,7 @@
5
5
  <% unless active_scaffold_config.list.messages_above_header %>
6
6
  <p class="error-message message server-error" style="display:none;">
7
7
  <%= as_(:internal_error).html_safe %>
8
+ <span class="error-500"><%= as_(:error_500).html_safe %></span>
8
9
  <a href="#" class="close" title="<%= as_(:close).html_safe %>"><%= as_(:close).html_safe %></a>
9
10
  </p>
10
11
  <div id="<%= active_scaffold_messages_id -%>" class="action-messages">
@@ -2,6 +2,7 @@
2
2
  <% if flash[name].present? %>
3
3
  <div class="<%= "#{name}-message message" %>">
4
4
  <%= display_message flash[name] %>
5
+ <% flash.delete name %>
5
6
  <% if request.xhr? %>
6
7
  <a href="#" class="close" title="<%= as_(:close) %>"><%= as_(:close) %></a>
7
8
  <% end %>
@@ -17,7 +17,8 @@
17
17
  html = if scope
18
18
  readonly = @record.readonly? || !@record.authorized_for?(:crud_type => :update)
19
19
  crud_type = @record.new_record? ? :create : (readonly ? :read : :update)
20
- active_scaffold_render_subform_column(column, scope, crud_type, readonly, !active_scaffold_config.subform.columns.names_without_auth_check.include?(column.name), @record)
20
+ # subform.columns.to_a.include? so it doesn't check inside subgroups
21
+ active_scaffold_render_subform_column(column, scope, crud_type, readonly, !active_scaffold_config.subform.columns.to_a.include?(column.name), @record)
21
22
  else
22
23
  render_column(column, @record, renders_as, scope)
23
24
  end
@@ -1,10 +1,11 @@
1
1
  <%
2
2
  columns_hash = {}
3
+ heading_columns = show_columns_for(associated.first, column, columns_hash)
3
4
  %>
4
5
  <table>
5
6
  <thead>
6
7
  <tr>
7
- <% show_columns_for(associated.first, column, columns_hash).each(:skip_groups => true) do |column| -%>
8
+ <% heading_columns.each_column(skip_groups: true) do |column| -%>
8
9
  <th><%= show_label(column) %></th>
9
10
  <% end -%>
10
11
  </tr>
@@ -1,7 +1,7 @@
1
1
  <dl>
2
- <% columns.each :for => record do |column| %>
2
+ <% columns.each_column(for: record) do |column| %>
3
3
  <dt><%= show_label(column) -%></dt>
4
- <% if column.respond_to? :each -%>
4
+ <% if column.respond_to? :each_column -%>
5
5
  <dd>
6
6
  <%= render :partial => 'show_columns', :locals => {:columns => column, :record => record} %>
7
7
  <% else -%>
@@ -3,9 +3,9 @@
3
3
  columns_groups = []
4
4
  %>
5
5
  <tr>
6
- <% columns.each :for => record do |column| -%>
6
+ <% columns.each_column(for: record) do |column| -%>
7
7
  <%
8
- if column.respond_to? :each
8
+ if column.respond_to? :each_column
9
9
  columns_groups << column
10
10
  next
11
11
  end
@@ -14,10 +14,10 @@
14
14
  <%= content_tag :td, content_tag(:span, show_column_value(record, column)), :class => "#{column.name}-column #{:numeric if column.number?}" %>
15
15
  <% end -%>
16
16
  </tr>
17
- <% columns_groups.each do |columns| %>
17
+ <% columns_groups.each do |columns_group| %>
18
18
  <tr>
19
19
  <td colspan="<%= columns_length %>">
20
- <% columns.each do |column| %>
20
+ <% columns_group.each_column do |column| %>
21
21
  <%= show_column_value(record, column) %>
22
22
  <% end %>
23
23
  </td>
@@ -1,5 +1,5 @@
1
1
  <% calculations_id ||= active_scaffold_calculations_id -%>
2
- <% if active_scaffold_config.actions.include?(:list) && active_scaffold_config.list.columns.any? {|c| c.calculation?} %>
2
+ <% if active_scaffold_config.actions.include?(:list) && list_columns.any? {|c| c.calculation?} %>
3
3
  <% params.delete(:id) %>
4
4
  ActiveScaffold.replace('<%= calculations_id %>', '<%= escape_javascript(render(:partial => 'list_calculations')) %>');
5
5
  <% end %>
@@ -11,6 +11,6 @@
11
11
  <% if @record.authorized_for?(:crud_type => :read, :column => column.name) -%>
12
12
  ActiveScaffold.replace_html('<%= row_id %> .<%= column.name %>-column','<%= escape_javascript(render_list_column(get_column_value(@record, column), column, @record)) %>');
13
13
  <% end -%>
14
- <% if column.update_columns && !column.update_columns.empty? %>
15
- <%= render(:partial => 'update_column', :collection => column.update_columns & active_scaffold_config.list.columns.names, :locals => {:row_id => row_id})%>
14
+ <% if column.update_columns&.present? %>
15
+ <%= render(:partial => 'update_column', :collection => column.update_columns & active_scaffold_config.list.columns.visible_columns_names, :locals => {:row_id => row_id})%>
16
16
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <div class="active-scaffold">
2
2
  <div class="delete-view view">
3
3
  <%= form_tag params_for(:action => link.action, :id => params[:id]), { :method => link.method } %>
4
- <h4><%= link.confirm(h(record.try(:to_label))) -%></h4>
4
+ <h4><%= link.confirm(h(record&.to_label)) -%></h4>
5
5
 
6
6
  <p class="form-footer">
7
7
  <%= submit_tag as_(link.label), :class => 'submit' %>
@@ -10,4 +10,4 @@
10
10
 
11
11
  </form>
12
12
  </div>
13
- </div>
13
+ </div>
@@ -1,7 +1,7 @@
1
1
  <div class="active-scaffold">
2
2
  <div class="delete-view view">
3
3
  <%= form_tag params_for(:action => :destroy, :id => params[:id]), { :method => :delete } %>
4
- <h4><%= as_(:are_you_sure_to_delete, :label => h(@record.try(:to_label))) -%></h4>
4
+ <h4><%= as_(:are_you_sure_to_delete, :label => h(@record&.to_label)) -%></h4>
5
5
 
6
6
  <p class="form-footer">
7
7
  <%= submit_tag as_(:delete), :class => 'submit' %>
@@ -10,4 +10,4 @@
10
10
 
11
11
  </form>
12
12
  </div>
13
- </div>
13
+ </div>
@@ -1,9 +1,12 @@
1
+ var link;
2
+ <% if @action_link&.position %>
3
+ link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
4
+ <% end %>
1
5
  <% if successful? %>
2
6
  <% if @record %>
3
7
  <%= render :partial => 'update_messages' %>
4
8
  <% row = escape_javascript(render(:partial => 'list_record', :locals => {:record => @record})) -%>
5
- <% if @action_link.try(:position) %>
6
- var link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
9
+ <% if @action_link&.position %>
7
10
  if (link) link.close('<%= row %>');
8
11
  <% else %>
9
12
  ActiveScaffold.update_row('<%= element_row_id(:action => :list, :id => @record.id) %>', '<%= row %>');
@@ -11,14 +14,21 @@ if (link) link.close('<%= row %>');
11
14
  <% end %>
12
15
  <%= render :partial => 'update_calculations', :formats => [:js] %>
13
16
  <% else %>
14
- <% if @action_link.try(:position) %>
15
- var link = ActiveScaffold.find_action_link('<%= element_form_id(:action => action_name) %>');
17
+ <% if @action_link&.position %>
16
18
  if (link) link.close();
17
19
  <% end %>
18
20
  <%= render 'refresh_list', no_history: true %>
19
21
  <% end %>
20
22
  <% else %>
21
- <% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) if @record.try(:errors).present? %>
22
- ActiveScaffold.replace_html('<%= active_scaffold_messages_id %>','<%= escape_javascript(render(:partial => 'messages')) %>');
23
+ <% flash[:error] = active_scaffold_error_messages_for(@record, :object_name => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :header_message => '', :message => "#{@record.class.model_name.human.downcase}#{@record.new_record? ? '' : ": #{@record.to_label}"}", :container_tag => nil, :list_type => :br) if @record&.errors.present? %>
24
+ <% messages = escape_javascript(render(:partial => 'messages')) %>
25
+ <% if @action_link&.position %>
26
+ if (link) {
27
+ link.update_flash_messages('<%= messages %>');
28
+ ActiveScaffold.enable_form(link.adapter.find('form'));
29
+ }
30
+ <% else %>
31
+ ActiveScaffold.replace_html('<%= active_scaffold_messages_id %>', '<%= messages %>');
23
32
  ActiveScaffold.scroll_to('<%= active_scaffold_messages_id %>', true);
33
+ <% end %>
24
34
  <% end %>