active_scaffold 3.5.3 → 3.6.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGELOG → CHANGELOG.rdoc} +73 -0
  3. data/README.md +17 -7
  4. data/app/assets/javascripts/active_scaffold.js.erb +0 -1
  5. data/app/assets/javascripts/jquery/active_scaffold.js +97 -6
  6. data/app/assets/stylesheets/active_scaffold_colors.scss +1 -1
  7. data/app/assets/stylesheets/active_scaffold_layout.css +52 -29
  8. data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -2
  9. data/app/views/active_scaffold_overrides/_form.html.erb +1 -1
  10. data/app/views/active_scaffold_overrides/_form_association.html.erb +2 -1
  11. data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +3 -2
  12. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +9 -7
  13. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +4 -4
  14. data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +2 -1
  15. data/app/views/active_scaffold_overrides/_list.html.erb +2 -1
  16. data/app/views/active_scaffold_overrides/_list_header.html.erb +5 -7
  17. data/app/views/active_scaffold_overrides/_list_messages.html.erb +1 -0
  18. data/app/views/active_scaffold_overrides/_list_record.html.erb +4 -5
  19. data/app/views/active_scaffold_overrides/_list_with_header.html.erb +1 -1
  20. data/app/views/active_scaffold_overrides/_messages.html.erb +1 -0
  21. data/app/views/active_scaffold_overrides/_refresh_list.js.erb +4 -0
  22. data/app/views/active_scaffold_overrides/_render_field.js.erb +2 -1
  23. data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +2 -1
  24. data/app/views/active_scaffold_overrides/_show_columns.html.erb +2 -2
  25. data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +4 -4
  26. data/app/views/active_scaffold_overrides/_update_calculations.js.erb +1 -1
  27. data/app/views/active_scaffold_overrides/_update_column.js.erb +2 -2
  28. data/app/views/active_scaffold_overrides/_vertical_subform.html.erb +2 -2
  29. data/app/views/active_scaffold_overrides/action_confirmation.html.erb +2 -2
  30. data/app/views/active_scaffold_overrides/delete.html.erb +2 -2
  31. data/app/views/active_scaffold_overrides/on_action_update.js.erb +16 -6
  32. data/app/views/active_scaffold_overrides/on_update.js.erb +1 -1
  33. data/app/views/active_scaffold_overrides/row.js.erb +1 -1
  34. data/app/views/active_scaffold_overrides/update_column.js.erb +2 -2
  35. data/config/locales/de.yml +2 -1
  36. data/config/locales/en.yml +1 -0
  37. data/config/locales/es.yml +1 -0
  38. data/config/locales/fr.yml +2 -1
  39. data/config/locales/hu.yml +1 -0
  40. data/config/locales/ja.yml +1 -0
  41. data/config/locales/ru.yml +1 -0
  42. data/lib/active_scaffold.rb +19 -16
  43. data/lib/active_scaffold/actions/common_search.rb +11 -8
  44. data/lib/active_scaffold/actions/core.rb +91 -70
  45. data/lib/active_scaffold/actions/create.rb +28 -28
  46. data/lib/active_scaffold/actions/delete.rb +3 -3
  47. data/lib/active_scaffold/actions/field_search.rb +53 -43
  48. data/lib/active_scaffold/actions/list.rb +111 -27
  49. data/lib/active_scaffold/actions/nested.rb +65 -48
  50. data/lib/active_scaffold/actions/search.rb +1 -1
  51. data/lib/active_scaffold/actions/show.rb +4 -4
  52. data/lib/active_scaffold/actions/subform.rb +23 -22
  53. data/lib/active_scaffold/actions/update.rb +96 -77
  54. data/lib/active_scaffold/active_record_permissions.rb +2 -11
  55. data/lib/active_scaffold/attribute_params.rb +102 -94
  56. data/lib/active_scaffold/bridges.rb +8 -8
  57. data/lib/active_scaffold/bridges/active_storage.rb +6 -0
  58. data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +34 -0
  59. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +54 -0
  60. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +22 -0
  61. data/lib/active_scaffold/bridges/active_storage/list_ui.rb +36 -0
  62. data/lib/active_scaffold/bridges/bitfields.rb +1 -0
  63. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -15
  64. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
  65. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -12
  66. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +1 -1
  67. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -2
  68. data/lib/active_scaffold/bridges/chosen/helpers.rb +11 -9
  69. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -13
  70. data/lib/active_scaffold/bridges/date_picker/helper.rb +49 -44
  71. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +1 -1
  72. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  73. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +3 -3
  74. data/lib/active_scaffold/bridges/file_column/form_ui.rb +3 -3
  75. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +10 -7
  76. data/lib/active_scaffold/bridges/paper_trail.rb +1 -1
  77. data/lib/active_scaffold/bridges/paper_trail/actions.rb +3 -1
  78. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  79. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
  80. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +2 -2
  81. data/lib/active_scaffold/bridges/record_select/helpers.rb +15 -17
  82. data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -19
  83. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
  84. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +21 -4
  85. data/lib/active_scaffold/config/base.rb +133 -41
  86. data/lib/active_scaffold/config/core.rb +146 -18
  87. data/lib/active_scaffold/config/delete.rb +14 -1
  88. data/lib/active_scaffold/config/field_search.rb +7 -1
  89. data/lib/active_scaffold/config/form.rb +10 -1
  90. data/lib/active_scaffold/config/list.rb +39 -13
  91. data/lib/active_scaffold/config/mark.rb +4 -2
  92. data/lib/active_scaffold/config/nested.rb +16 -17
  93. data/lib/active_scaffold/config/search.rb +9 -0
  94. data/lib/active_scaffold/config/show.rb +4 -0
  95. data/lib/active_scaffold/config/update.rb +4 -0
  96. data/lib/active_scaffold/configurable.rb +14 -7
  97. data/lib/active_scaffold/constraints.rb +22 -20
  98. data/lib/active_scaffold/core.rb +67 -28
  99. data/lib/active_scaffold/data_structures/action_columns.rb +50 -59
  100. data/lib/active_scaffold/data_structures/action_link.rb +50 -20
  101. data/lib/active_scaffold/data_structures/action_links.rb +15 -13
  102. data/lib/active_scaffold/data_structures/association/abstract.rb +38 -15
  103. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +2 -6
  104. data/lib/active_scaffold/data_structures/association/active_record.rb +6 -2
  105. data/lib/active_scaffold/data_structures/association/mongoid.rb +0 -3
  106. data/lib/active_scaffold/data_structures/column.rb +75 -66
  107. data/lib/active_scaffold/data_structures/columns.rb +3 -2
  108. data/lib/active_scaffold/data_structures/nested_info.rb +33 -19
  109. data/lib/active_scaffold/data_structures/set.rb +8 -0
  110. data/lib/active_scaffold/data_structures/sorting.rb +10 -2
  111. data/lib/active_scaffold/delayed_setup.rb +16 -5
  112. data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -2
  113. data/lib/active_scaffold/extensions/action_view_rendering.rb +34 -14
  114. data/lib/active_scaffold/extensions/cow_proxy.rb +95 -0
  115. data/lib/active_scaffold/extensions/ice_nine.rb +36 -0
  116. data/lib/active_scaffold/extensions/left_outer_joins.rb +8 -33
  117. data/lib/active_scaffold/extensions/localize.rb +3 -1
  118. data/lib/active_scaffold/extensions/routing_mapper.rb +6 -45
  119. data/lib/active_scaffold/extensions/to_label.rb +3 -2
  120. data/lib/active_scaffold/extensions/unsaved_record.rb +2 -4
  121. data/lib/active_scaffold/finder.rb +110 -77
  122. data/lib/active_scaffold/helpers/action_link_helpers.rb +62 -36
  123. data/lib/active_scaffold/helpers/association_helpers.rb +21 -19
  124. data/lib/active_scaffold/helpers/controller_helpers.rb +34 -10
  125. data/lib/active_scaffold/helpers/form_column_helpers.rb +196 -124
  126. data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
  127. data/lib/active_scaffold/helpers/id_helpers.rb +6 -2
  128. data/lib/active_scaffold/helpers/list_column_helpers.rb +86 -57
  129. data/lib/active_scaffold/helpers/pagination_helpers.rb +2 -2
  130. data/lib/active_scaffold/helpers/search_column_helpers.rb +29 -34
  131. data/lib/active_scaffold/helpers/show_column_helpers.rb +3 -5
  132. data/lib/active_scaffold/helpers/view_helpers.rb +38 -35
  133. data/lib/active_scaffold/marked_model.rb +2 -2
  134. data/lib/active_scaffold/orm_checks.rb +3 -7
  135. data/lib/active_scaffold/paginator.rb +7 -7
  136. data/lib/active_scaffold/registry.rb +33 -0
  137. data/lib/active_scaffold/responds_to_parent.rb +8 -11
  138. data/lib/active_scaffold/tableless.rb +67 -65
  139. data/lib/active_scaffold/version.rb +2 -2
  140. data/lib/generators/active_scaffold/controller_generator.rb +2 -2
  141. data/lib/generators/active_scaffold/install_generator.rb +1 -1
  142. data/lib/generators/active_scaffold/resource_generator.rb +2 -2
  143. data/shoulda_macros/macros.rb +3 -1
  144. data/test/bridges/date_picker_test.rb +1 -2
  145. data/test/bridges/paperclip_test.rb +6 -6
  146. data/test/class_with_finder.rb +2 -2
  147. data/test/company.rb +4 -4
  148. data/test/config/create_test.rb +4 -2
  149. data/test/config/nested_test.rb +1 -1
  150. data/test/config/show_test.rb +1 -1
  151. data/test/config/update_test.rb +7 -6
  152. data/test/data_structures/action_columns_test.rb +2 -2
  153. data/test/data_structures/action_links_test.rb +1 -1
  154. data/test/data_structures/column_test.rb +3 -6
  155. data/test/data_structures/columns_test.rb +2 -2
  156. data/test/data_structures/sorting_test.rb +7 -0
  157. data/test/extensions/active_record_test.rb +4 -4
  158. data/test/extensions/routing_mapper_test.rb +2 -2
  159. data/test/helpers/list_column_helpers_test.rb +3 -1
  160. data/test/misc/active_record_permissions_test.rb +3 -11
  161. data/test/misc/attribute_params_test.rb +12 -8
  162. data/test/misc/calculation_test.rb +1 -1
  163. data/test/misc/configurable_test.rb +10 -10
  164. data/test/misc/constraints_test.rb +2 -2
  165. data/test/misc/convert_numbers_format_test.rb +7 -3
  166. data/test/misc/lang_test.rb +1 -1
  167. data/test/misc/parse_datetime_test.rb +3 -4
  168. data/test/misc/tableless_test.rb +6 -0
  169. data/test/mock_app/Rakefile +1 -1
  170. data/test/mock_app/app/assets/config/manifest.js +0 -0
  171. data/test/mock_app/app/controllers/cars_controller.rb +1 -0
  172. data/test/mock_app/app/controllers/people_controller.rb +3 -1
  173. data/test/mock_app/config/application.rb +2 -1
  174. data/test/mock_app/config/boot.rb +1 -1
  175. data/test/mock_app/config/environment.rb +2 -2
  176. data/test/mock_app/config/routes.rb +4 -1
  177. data/test/mock_app/db/schema.rb +2 -0
  178. data/test/performance/list_cars_performance_test.rb +34 -0
  179. data/test/performance/list_people_performance_test.rb +31 -0
  180. data/test/performance_test_help.rb +3 -0
  181. data/test/test_helper.rb +10 -2
  182. metadata +55 -20
  183. data/app/assets/javascripts/prototype/rico_corner.js +0 -370
  184. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -7
@@ -4,7 +4,7 @@ require 'class_with_finder'
4
4
  class CalculationTest < MiniTest::Test
5
5
  def setup
6
6
  @buildings = []
7
- @buildings << Building.create { |b| b.create_owner(:first_name => 'foo') }
7
+ @buildings << Building.create { |b| b.build_owner(:first_name => 'foo') }
8
8
  @buildings << Building.create(:name => 'foo bar')
9
9
  @buildings << Building.create
10
10
 
@@ -41,17 +41,17 @@ class ConfigurableTest < MiniTest::Test
41
41
  ## test normal block behaviors
42
42
  ##
43
43
  # functions
44
- assert_equal hello, configurable_class.configure { hello }
44
+ assert_equal hello, (configurable_class.configure { hello })
45
45
  # variables
46
- assert_equal configurable_class, configurable_class.configure { configurable_class }
46
+ assert_equal configurable_class, (configurable_class.configure { configurable_class })
47
47
  # constants
48
- assert_equal ConfigurableTest::HELLO, configurable_class.configure { ConfigurableTest::HELLO }
48
+ assert_equal ConfigurableTest::HELLO, (configurable_class.configure { ConfigurableTest::HELLO })
49
49
 
50
50
  ##
51
51
  ## test extra "localized" block behavior
52
52
  ##
53
53
  # functions
54
- assert_equal configurable_class.foo, configurable_class.configure { foo }
54
+ assert_equal configurable_class.foo, (configurable_class.configure { foo })
55
55
  # constants - not working
56
56
  # assert_equal configurable_class.FOO, configurable_class.configure {FOO}
57
57
  end
@@ -73,25 +73,25 @@ class ConfigurableTest < MiniTest::Test
73
73
  ## test normal block behaviors
74
74
  ##
75
75
  # functions
76
- assert_equal hello, ExtendedClass.configure { hello }
76
+ assert_equal hello, (ExtendedClass.configure { hello })
77
77
  # variables
78
- assert_equal ExtendedClass, ExtendedClass.configure { ExtendedClass }
78
+ assert_equal ExtendedClass, (ExtendedClass.configure { ExtendedClass })
79
79
  # constants
80
- assert_equal ConfigurableTest::HELLO, ExtendedClass.configure { ConfigurableTest::HELLO }
80
+ assert_equal ConfigurableTest::HELLO, (ExtendedClass.configure { ConfigurableTest::HELLO })
81
81
 
82
82
  ##
83
83
  ## test extra "localized" block behavior
84
84
  ##
85
85
  # functions
86
- assert_equal ExtendedClass.foo, ExtendedClass.configure { foo }
86
+ assert_equal ExtendedClass.foo, (ExtendedClass.configure { foo })
87
87
  # constants - not working
88
88
  # assert_equal ExtendedClass.FOO, ExtendedClass.configure {FOO}
89
89
  end
90
90
 
91
91
  def test_arity
92
92
  # this is the main style
93
- assert_equal 'foo', ExtendedClass.configure { 'foo' }
93
+ assert_equal 'foo', (ExtendedClass.configure { 'foo' })
94
94
  # but we want to let people accept the configurable class as the first argument, too
95
- assert_equal 'bar', ExtendedClass.configure { |a| a.foo } # rubocop:disable Style/SymbolProc
95
+ assert_equal 'bar', (ExtendedClass.configure { |a| a.foo }) # rubocop:disable Style/SymbolProc
96
96
  end
97
97
  end
@@ -116,8 +116,8 @@ class ConstraintsTestObject
116
116
  @params = {}
117
117
  end
118
118
 
119
- def params_hash?(v)
120
- v.is_a? Hash
119
+ def params_hash?(value)
120
+ value.is_a? Hash
121
121
  end
122
122
  end
123
123
 
@@ -26,6 +26,7 @@ class ConvertNumbersFormatTest < MiniTest::Test
26
26
  include ActiveScaffoldConfigMock
27
27
  include ActiveScaffold::AttributeParams
28
28
  include ActiveScaffold::Finder
29
+ include ActiveScaffold::Helpers::ControllerHelpers
29
30
 
30
31
  def setup
31
32
  NumberModel.load_schema! if Rails.version >= '5.0'
@@ -46,7 +47,6 @@ class ConvertNumbersFormatTest < MiniTest::Test
46
47
 
47
48
  @config = config_for('number_model')
48
49
  @config.columns[:number].form_ui = nil
49
- @config.create.columns.set_columns @config.columns
50
50
  end
51
51
 
52
52
  def teardown
@@ -161,7 +161,11 @@ class ConvertNumbersFormatTest < MiniTest::Test
161
161
  record.number
162
162
  end
163
163
 
164
- def params_hash?(v)
165
- v.is_a? Hash
164
+ def params_hash?(value)
165
+ value.is_a? Hash
166
+ end
167
+
168
+ def params_hash(value)
169
+ value
166
170
  end
167
171
  end
@@ -4,7 +4,7 @@ class LocalizationTest < MiniTest::Test
4
4
  def test_localization
5
5
  assert_equal 'Dutch', as_(:dutch)
6
6
  assert_equal 'dutch', as_('dutch')
7
- I18n.backend.store_translations :en, :active_scaffold => {:create_model => 'Create %{model}'}
7
+ I18n.backend.store_translations :en, :active_scaffold => {:create_model => 'Create %<model>s'}
8
8
  assert_equal 'Create Test', as_(:create_model, :model => 'Test')
9
9
  end
10
10
  end
@@ -44,7 +44,6 @@ class ParseDatetimeTest < MiniTest::Test
44
44
  I18n.backend.store_translations :es, spanish
45
45
 
46
46
  @config = config_for('date_time_model')
47
- @config.create.columns.set_columns @config.columns
48
47
  end
49
48
 
50
49
  def teardown
@@ -125,7 +124,7 @@ class ParseDatetimeTest < MiniTest::Test
125
124
  end
126
125
 
127
126
  def test_condition_for_datetime_with_zone
128
- assert_equal DateTime.new(2017, 4, 8, 16, 30, 0, '+0300'), condition_value('2017-04-08 16:30 +0300')
127
+ assert_equal ActiveSupport::TimeZone[3].local(2017, 4, 8, 16, 30, 0), condition_value('2017-04-08 16:30 +0300')
129
128
  end
130
129
 
131
130
  def test_condition_for_spanish_date
@@ -154,7 +153,7 @@ class ParseDatetimeTest < MiniTest::Test
154
153
  self.class.condition_value_for_datetime(@config.columns[:run_at], value, conversion || :to_time)
155
154
  end
156
155
 
157
- def params_hash?(v)
158
- v.is_a? Hash
156
+ def params_hash?(value)
157
+ value.is_a? Hash
159
158
  end
160
159
  end
@@ -27,6 +27,12 @@ class TablelessTest < MiniTest::Test
27
27
  assert Person.new.files.empty?
28
28
  end
29
29
 
30
+ def test_tableless_assoc_with_dependent
31
+ @person = Person.new
32
+ @person.save(validate: false)
33
+ assert @person.destroy
34
+ end
35
+
30
36
  def test_find_with_through_association
31
37
  assert Building.new.files.empty?
32
38
  end
@@ -1,7 +1,7 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require File.expand_path('config/application', __dir__)
5
5
  require 'rake'
6
6
 
7
7
  RailsApp::Application.load_tasks
@@ -1,4 +1,5 @@
1
1
  class CarsController < ApplicationController
2
2
  active_scaffold do
3
+ columns[:model].inplace_edit = true
3
4
  end
4
5
  end
@@ -1,4 +1,6 @@
1
1
  class PeopleController < ApplicationController
2
- active_scaffold do
2
+ active_scaffold do |conf|
3
+ conf.columns[:buildings].includes = nil
4
+ conf.columns[:buildings].associated_limit = 0
3
5
  end
4
6
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require File.expand_path('boot', __dir__)
2
2
 
3
3
  require 'rails/all'
4
4
  require 'rails/test_unit/railtie'
@@ -9,5 +9,6 @@ module RailsApp
9
9
  config.filter_parameters << :password
10
10
  config.action_mailer.default_url_options = {:host => 'localhost:3000'}
11
11
  config.i18n.enforce_available_locales = false if config.i18n.respond_to? :enforce_available_locales
12
+ config.active_record.sqlite3.represent_boolean_as_integer = true if config.active_record.sqlite3.respond_to? :represent_boolean_as_integer
12
13
  end
13
14
  end
@@ -1,5 +1,5 @@
1
1
  begin
2
- require File.expand_path('../../../../.bundle/environment', __FILE__)
2
+ require File.expand_path('../../../.bundle/environment', __dir__)
3
3
  rescue LoadError
4
4
  require 'rubygems'
5
5
  require 'bundler'
@@ -1,6 +1,6 @@
1
1
  # Load the rails application
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path('application', __dir__)
3
3
 
4
4
  # Initialize the rails application
5
- RailsApp::Application.config.root = File.expand_path('../..', __FILE__)
5
+ RailsApp::Application.config.root = File.expand_path('..', __dir__)
6
6
  RailsApp::Application.initialize!
@@ -6,9 +6,12 @@ Rails.application.routes.draw do
6
6
  resources :buildings, except: :index do
7
7
  concerns :active_scaffold, except: %i[mark add_existing new_existing destroy_existing]
8
8
  end
9
- resources :cars, only: %i[edit update] do
9
+ resources :cars, only: %i[index edit update] do
10
10
  concerns :active_scaffold, association: false, except: [:mark]
11
11
  end
12
+ resources :people do
13
+ concerns :active_scaffold, except: %i[mark]
14
+ end
12
15
 
13
16
  match ':controller(/:action(/:id))', :via => :any
14
17
  end
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Metrics/BlockLength
1
2
  ActiveRecord::Schema.define do
2
3
  create_table 'addresses' do |t|
3
4
  t.integer 'addressable_id'
@@ -64,3 +65,4 @@ ActiveRecord::Schema.define do
64
65
  t.integer 'role_id'
65
66
  end
66
67
  end
68
+ # rubocop:enable Metrics/BlockLength
@@ -0,0 +1,34 @@
1
+ require 'test_helper'
2
+ require 'performance_test_help'
3
+
4
+ class ListCarsPerformanceTest < ActionDispatch::PerformanceTest
5
+ self.profile_options =
6
+ if ENV['BENCHMARK_TESTS']
7
+ {metrics: [:wall_time]}
8
+ else
9
+ {metrics: %i[process_time], formats: %i[flat graph_html call_stack]}
10
+ end
11
+ def setup
12
+ owners = Array.new(4) { |i| Person.create first_name: "Name#{i}" } << nil
13
+ 500.times { |i| Car.create(brand: 'Skoda', model: 'Fabia', person: owners[i % 5]) }
14
+ CarsController.class_eval do
15
+ before_action :setup
16
+
17
+ def setup
18
+ active_scaffold_config.list.pagination = false
19
+ end
20
+ end
21
+ end
22
+
23
+ def test_list
24
+ get '/cars'
25
+ end
26
+
27
+ # def test_list2
28
+ # get '/cars?t=2'
29
+ # end
30
+ #
31
+ # def test_list3
32
+ # get '/cars?t=3'
33
+ # end
34
+ end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+ require 'performance_test_help'
3
+
4
+ class ListPeoplePerformanceTest < ActionDispatch::PerformanceTest
5
+ self.profile_options =
6
+ if ENV['BENCHMARK_TESTS']
7
+ {metrics: [:wall_time]}
8
+ else
9
+ {metrics: %i[process_time], formats: %i[flat graph_html call_stack]}
10
+ end
11
+ def setup
12
+ 200.times do |i|
13
+ p = Person.create(first_name: "Name#{i}", last_name: 'Last')
14
+ p.buildings = Array.new(4) { |j| Building.create name: "B#{j} of #{p.first_name}" } unless (i % 4).zero?
15
+ end
16
+ PeopleController.class_eval do
17
+ before_action :setup
18
+ def list_columns
19
+ active_scaffold_config.columns.select { |col| %i[first_name last_name buildings].include?(col.name) }
20
+ end
21
+
22
+ def setup
23
+ active_scaffold_config.list.pagination = false
24
+ end
25
+ end
26
+ end
27
+
28
+ def test_list
29
+ get '/people'
30
+ end
31
+ end
@@ -0,0 +1,3 @@
1
+ require 'rails/performance_test_help'
2
+ require 'rails/perftest/action_dispatch'
3
+ require 'rails/perftest/action_controller'
@@ -5,6 +5,7 @@ require 'mock_app/config/environment'
5
5
  require 'rails/test_help'
6
6
  require 'minitest/autorun'
7
7
  require 'mocha/setup'
8
+ require 'cow_proxy'
8
9
 
9
10
  require 'minitest/reporters'
10
11
  Minitest::Reporters.use!
@@ -17,11 +18,17 @@ def load_schema
17
18
  end
18
19
  load_schema
19
20
 
21
+ ActiveScaffold.threadsafe!
22
+ # avoid freezing defaults so we can stubs in tests for testing with different defaults
23
+ class << ActiveScaffold::Config::Core
24
+ def freeze; end
25
+ end
26
+
20
27
  %w[model_stub const_mocker company].each do |file|
21
28
  require File.join(File.dirname(__FILE__), file)
22
29
  end
23
30
 
24
- I18n.backend.store_translations :en, YAML.load_file(File.expand_path('../../config/locales/en.yml', __FILE__))['en']
31
+ I18n.backend.store_translations :en, YAML.load_file(File.expand_path('../config/locales/en.yml', __dir__))['en']
25
32
 
26
33
  # rails 4.0
27
34
  unless defined? Minitest::Test
@@ -53,4 +60,5 @@ end
53
60
 
54
61
  Config = RbConfig # HACK: needed some comments
55
62
 
56
- class ColumnMock < ActiveScaffold::Tableless::Column; end
63
+ class ColumnMock < ActiveScaffold::Tableless::Column
64
+ 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.5.3
4
+ version: 3.6.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.5
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: 5.2.0
19
+ version: 4.2.0
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
- version: 4.0.5
30
- - - "<"
26
+ version: 4.2.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: cow_proxy
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
31
39
  - !ruby/object:Gem::Version
32
- version: 5.2.0
40
+ version: '0.3'
33
41
  - !ruby/object:Gem::Dependency
34
42
  name: ice_nine
35
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +52,20 @@ dependencies:
44
52
  - - "~>"
45
53
  - !ruby/object:Gem::Version
46
54
  version: '0.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: request_store
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
47
69
  description: Save time and headaches, and create a more easily maintainable set of
48
70
  pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read,
49
71
  update, delete) user interface needs, leaving you more time to focus on more challenging
@@ -54,7 +76,7 @@ extensions: []
54
76
  extra_rdoc_files:
55
77
  - README.md
56
78
  files:
57
- - CHANGELOG
79
+ - CHANGELOG.rdoc
58
80
  - LICENSE.md
59
81
  - README.md
60
82
  - app/assets/images/active_scaffold/add.png
@@ -94,7 +116,6 @@ files:
94
116
  - app/assets/javascripts/prototype/active_scaffold_chosen.js
95
117
  - app/assets/javascripts/prototype/dhtml_history.js
96
118
  - app/assets/javascripts/prototype/form_enhancements.js
97
- - app/assets/javascripts/prototype/rico_corner.js
98
119
  - app/assets/javascripts/prototype/tiny_mce_bridge.js
99
120
  - app/assets/stylesheets/active_scaffold-ie.scss
100
121
  - app/assets/stylesheets/active_scaffold.scss
@@ -194,6 +215,11 @@ files:
194
215
  - lib/active_scaffold/active_record_permissions.rb
195
216
  - lib/active_scaffold/attribute_params.rb
196
217
  - lib/active_scaffold/bridges.rb
218
+ - lib/active_scaffold/bridges/active_storage.rb
219
+ - lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb
220
+ - lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb
221
+ - lib/active_scaffold/bridges/active_storage/form_ui.rb
222
+ - lib/active_scaffold/bridges/active_storage/list_ui.rb
197
223
  - lib/active_scaffold/bridges/ancestry.rb
198
224
  - lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb
199
225
  - lib/active_scaffold/bridges/bitfields.rb
@@ -226,7 +252,6 @@ files:
226
252
  - lib/active_scaffold/bridges/file_column/list_ui.rb
227
253
  - lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
228
254
  - lib/active_scaffold/bridges/file_column/test/mock_model.rb
229
- - lib/active_scaffold/bridges/file_column/test/test_helper.rb
230
255
  - lib/active_scaffold/bridges/paper_trail.rb
231
256
  - lib/active_scaffold/bridges/paper_trail/actions.rb
232
257
  - lib/active_scaffold/bridges/paper_trail/config.rb
@@ -283,6 +308,8 @@ files:
283
308
  - lib/active_scaffold/extensions/action_controller_rescueing.rb
284
309
  - lib/active_scaffold/extensions/action_view_rendering.rb
285
310
  - lib/active_scaffold/extensions/connection_adapter.rb
311
+ - lib/active_scaffold/extensions/cow_proxy.rb
312
+ - lib/active_scaffold/extensions/ice_nine.rb
286
313
  - lib/active_scaffold/extensions/left_outer_joins.rb
287
314
  - lib/active_scaffold/extensions/localize.rb
288
315
  - lib/active_scaffold/extensions/name_option_for_datetime.rb
@@ -306,6 +333,7 @@ files:
306
333
  - lib/active_scaffold/marked_model.rb
307
334
  - lib/active_scaffold/orm_checks.rb
308
335
  - lib/active_scaffold/paginator.rb
336
+ - lib/active_scaffold/registry.rb
309
337
  - lib/active_scaffold/responds_to_parent.rb
310
338
  - lib/active_scaffold/tableless.rb
311
339
  - lib/active_scaffold/version.rb
@@ -368,6 +396,7 @@ files:
368
396
  - test/misc/tableless_test.rb
369
397
  - test/mock_app/.gitignore
370
398
  - test/mock_app/Rakefile
399
+ - test/mock_app/app/assets/config/manifest.js
371
400
  - test/mock_app/app/controllers/addresses_controller.rb
372
401
  - test/mock_app/app/controllers/application_controller.rb
373
402
  - test/mock_app/app/controllers/buildings_controller.rb
@@ -403,6 +432,9 @@ files:
403
432
  - test/mock_app/db/schema.rb
404
433
  - test/mock_app/db/test.sqlite3
405
434
  - test/model_stub.rb
435
+ - test/performance/list_cars_performance_test.rb
436
+ - test/performance/list_people_performance_test.rb
437
+ - test/performance_test_help.rb
406
438
  - test/run_all.rb
407
439
  - test/test_helper.rb
408
440
  - vendor/assets/javascripts/getprototypeof.js
@@ -414,7 +446,7 @@ homepage: https://github.com/activescaffold/active_scaffold
414
446
  licenses:
415
447
  - MIT
416
448
  metadata: {}
417
- post_install_message:
449
+ post_install_message:
418
450
  rdoc_options: []
419
451
  require_paths:
420
452
  - lib
@@ -422,16 +454,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
422
454
  requirements:
423
455
  - - ">="
424
456
  - !ruby/object:Gem::Version
425
- version: '2.0'
457
+ version: '2.3'
426
458
  required_rubygems_version: !ruby/object:Gem::Requirement
427
459
  requirements:
428
- - - ">="
460
+ - - ">"
429
461
  - !ruby/object:Gem::Version
430
- version: '0'
462
+ version: 1.3.1
431
463
  requirements: []
432
- rubyforge_project:
433
- rubygems_version: 2.7.7
434
- signing_key:
464
+ rubygems_version: 3.0.8
465
+ signing_key:
435
466
  specification_version: 4
436
467
  summary: Rails 4.x and 5.x versions of ActiveScaffold supporting prototype and jquery
437
468
  test_files:
@@ -486,6 +517,7 @@ test_files:
486
517
  - test/misc/tableless_test.rb
487
518
  - test/mock_app/.gitignore
488
519
  - test/mock_app/Rakefile
520
+ - test/mock_app/app/assets/config/manifest.js
489
521
  - test/mock_app/app/controllers/addresses_controller.rb
490
522
  - test/mock_app/app/controllers/application_controller.rb
491
523
  - test/mock_app/app/controllers/buildings_controller.rb
@@ -521,5 +553,8 @@ test_files:
521
553
  - test/mock_app/db/schema.rb
522
554
  - test/mock_app/db/test.sqlite3
523
555
  - test/model_stub.rb
556
+ - test/performance/list_cars_performance_test.rb
557
+ - test/performance/list_people_performance_test.rb
558
+ - test/performance_test_help.rb
524
559
  - test/run_all.rb
525
560
  - test/test_helper.rb