active_scaffold 3.5.2 → 3.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGELOG → CHANGELOG.rdoc} +66 -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 +63 -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_footer.html.erb +3 -2
  11. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +6 -6
  12. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
  13. data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -1
  14. data/app/views/active_scaffold_overrides/_list.html.erb +2 -1
  15. data/app/views/active_scaffold_overrides/_list_header.html.erb +5 -7
  16. data/app/views/active_scaffold_overrides/_list_messages.html.erb +1 -0
  17. data/app/views/active_scaffold_overrides/_list_record.html.erb +4 -5
  18. data/app/views/active_scaffold_overrides/_list_with_header.html.erb +1 -1
  19. data/app/views/active_scaffold_overrides/_messages.html.erb +1 -0
  20. data/app/views/active_scaffold_overrides/_refresh_list.js.erb +4 -0
  21. data/app/views/active_scaffold_overrides/_render_field.js.erb +2 -1
  22. data/app/views/active_scaffold_overrides/_show_association_horizontal.html.erb +2 -1
  23. data/app/views/active_scaffold_overrides/_show_columns.html.erb +2 -2
  24. data/app/views/active_scaffold_overrides/_show_horizontal_record.html.erb +4 -4
  25. data/app/views/active_scaffold_overrides/_update_calculations.js.erb +1 -1
  26. data/app/views/active_scaffold_overrides/_update_column.js.erb +2 -2
  27. data/app/views/active_scaffold_overrides/action_confirmation.html.erb +2 -2
  28. data/app/views/active_scaffold_overrides/delete.html.erb +2 -2
  29. data/app/views/active_scaffold_overrides/on_action_update.js.erb +16 -6
  30. data/app/views/active_scaffold_overrides/on_update.js.erb +1 -1
  31. data/app/views/active_scaffold_overrides/row.js.erb +1 -1
  32. data/app/views/active_scaffold_overrides/update_column.js.erb +1 -1
  33. data/config/locales/de.yml +2 -1
  34. data/config/locales/en.yml +1 -0
  35. data/config/locales/es.yml +1 -0
  36. data/config/locales/fr.yml +2 -1
  37. data/config/locales/hu.yml +1 -0
  38. data/config/locales/ja.yml +1 -0
  39. data/config/locales/ru.yml +1 -0
  40. data/lib/active_scaffold.rb +19 -16
  41. data/lib/active_scaffold/actions/common_search.rb +11 -8
  42. data/lib/active_scaffold/actions/core.rb +89 -71
  43. data/lib/active_scaffold/actions/create.rb +28 -28
  44. data/lib/active_scaffold/actions/delete.rb +3 -3
  45. data/lib/active_scaffold/actions/field_search.rb +53 -43
  46. data/lib/active_scaffold/actions/list.rb +111 -27
  47. data/lib/active_scaffold/actions/nested.rb +65 -48
  48. data/lib/active_scaffold/actions/search.rb +1 -1
  49. data/lib/active_scaffold/actions/show.rb +4 -4
  50. data/lib/active_scaffold/actions/subform.rb +12 -17
  51. data/lib/active_scaffold/actions/update.rb +96 -77
  52. data/lib/active_scaffold/active_record_permissions.rb +2 -11
  53. data/lib/active_scaffold/attribute_params.rb +104 -86
  54. data/lib/active_scaffold/bridges.rb +8 -8
  55. data/lib/active_scaffold/bridges/active_storage.rb +6 -0
  56. data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +33 -0
  57. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +54 -0
  58. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +22 -0
  59. data/lib/active_scaffold/bridges/active_storage/list_ui.rb +36 -0
  60. data/lib/active_scaffold/bridges/bitfields.rb +1 -0
  61. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -15
  62. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
  63. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -12
  64. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +1 -1
  65. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -2
  66. data/lib/active_scaffold/bridges/chosen/helpers.rb +11 -9
  67. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -13
  68. data/lib/active_scaffold/bridges/date_picker/helper.rb +49 -44
  69. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +1 -1
  70. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  71. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +3 -3
  72. data/lib/active_scaffold/bridges/file_column/form_ui.rb +3 -3
  73. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +10 -7
  74. data/lib/active_scaffold/bridges/paper_trail.rb +1 -1
  75. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  76. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
  77. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +2 -2
  78. data/lib/active_scaffold/bridges/record_select/helpers.rb +12 -16
  79. data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -19
  80. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
  81. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +21 -4
  82. data/lib/active_scaffold/config/base.rb +133 -41
  83. data/lib/active_scaffold/config/core.rb +146 -18
  84. data/lib/active_scaffold/config/delete.rb +14 -1
  85. data/lib/active_scaffold/config/field_search.rb +7 -1
  86. data/lib/active_scaffold/config/form.rb +10 -1
  87. data/lib/active_scaffold/config/list.rb +39 -13
  88. data/lib/active_scaffold/config/mark.rb +4 -2
  89. data/lib/active_scaffold/config/nested.rb +16 -17
  90. data/lib/active_scaffold/config/search.rb +9 -0
  91. data/lib/active_scaffold/config/show.rb +4 -0
  92. data/lib/active_scaffold/config/update.rb +4 -0
  93. data/lib/active_scaffold/configurable.rb +14 -7
  94. data/lib/active_scaffold/constraints.rb +22 -20
  95. data/lib/active_scaffold/core.rb +68 -29
  96. data/lib/active_scaffold/data_structures/action_columns.rb +50 -59
  97. data/lib/active_scaffold/data_structures/action_link.rb +50 -20
  98. data/lib/active_scaffold/data_structures/action_links.rb +15 -13
  99. data/lib/active_scaffold/data_structures/association/abstract.rb +41 -15
  100. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +2 -6
  101. data/lib/active_scaffold/data_structures/association/active_record.rb +6 -2
  102. data/lib/active_scaffold/data_structures/association/mongoid.rb +0 -3
  103. data/lib/active_scaffold/data_structures/column.rb +75 -66
  104. data/lib/active_scaffold/data_structures/columns.rb +3 -2
  105. data/lib/active_scaffold/data_structures/nested_info.rb +21 -19
  106. data/lib/active_scaffold/data_structures/set.rb +8 -0
  107. data/lib/active_scaffold/data_structures/sorting.rb +10 -2
  108. data/lib/active_scaffold/delayed_setup.rb +16 -5
  109. data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -2
  110. data/lib/active_scaffold/extensions/action_view_rendering.rb +34 -14
  111. data/lib/active_scaffold/extensions/cow_proxy.rb +91 -0
  112. data/lib/active_scaffold/extensions/ice_nine.rb +36 -0
  113. data/lib/active_scaffold/extensions/left_outer_joins.rb +8 -33
  114. data/lib/active_scaffold/extensions/localize.rb +3 -1
  115. data/lib/active_scaffold/extensions/routing_mapper.rb +6 -45
  116. data/lib/active_scaffold/extensions/to_label.rb +3 -2
  117. data/lib/active_scaffold/extensions/unsaved_record.rb +2 -4
  118. data/lib/active_scaffold/finder.rb +104 -73
  119. data/lib/active_scaffold/helpers/action_link_helpers.rb +62 -36
  120. data/lib/active_scaffold/helpers/association_helpers.rb +21 -19
  121. data/lib/active_scaffold/helpers/controller_helpers.rb +23 -10
  122. data/lib/active_scaffold/helpers/form_column_helpers.rb +157 -121
  123. data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
  124. data/lib/active_scaffold/helpers/id_helpers.rb +6 -2
  125. data/lib/active_scaffold/helpers/list_column_helpers.rb +82 -53
  126. data/lib/active_scaffold/helpers/pagination_helpers.rb +2 -2
  127. data/lib/active_scaffold/helpers/search_column_helpers.rb +29 -34
  128. data/lib/active_scaffold/helpers/show_column_helpers.rb +3 -5
  129. data/lib/active_scaffold/helpers/view_helpers.rb +38 -35
  130. data/lib/active_scaffold/marked_model.rb +2 -2
  131. data/lib/active_scaffold/orm_checks.rb +3 -7
  132. data/lib/active_scaffold/paginator.rb +7 -7
  133. data/lib/active_scaffold/registry.rb +33 -0
  134. data/lib/active_scaffold/responds_to_parent.rb +8 -11
  135. data/lib/active_scaffold/tableless.rb +67 -65
  136. data/lib/active_scaffold/version.rb +2 -2
  137. data/lib/generators/active_scaffold/controller_generator.rb +2 -2
  138. data/lib/generators/active_scaffold/install_generator.rb +1 -1
  139. data/lib/generators/active_scaffold/resource_generator.rb +2 -2
  140. data/shoulda_macros/macros.rb +3 -1
  141. data/test/bridges/date_picker_test.rb +1 -2
  142. data/test/bridges/paperclip_test.rb +6 -6
  143. data/test/class_with_finder.rb +2 -2
  144. data/test/company.rb +4 -4
  145. data/test/config/create_test.rb +4 -2
  146. data/test/config/nested_test.rb +1 -1
  147. data/test/config/show_test.rb +1 -1
  148. data/test/config/update_test.rb +7 -6
  149. data/test/data_structures/action_columns_test.rb +2 -2
  150. data/test/data_structures/action_links_test.rb +1 -1
  151. data/test/data_structures/column_test.rb +3 -6
  152. data/test/data_structures/columns_test.rb +2 -2
  153. data/test/data_structures/sorting_test.rb +7 -0
  154. data/test/extensions/active_record_test.rb +4 -4
  155. data/test/extensions/routing_mapper_test.rb +2 -2
  156. data/test/helpers/list_column_helpers_test.rb +3 -1
  157. data/test/misc/active_record_permissions_test.rb +3 -11
  158. data/test/misc/attribute_params_test.rb +12 -8
  159. data/test/misc/calculation_test.rb +1 -1
  160. data/test/misc/configurable_test.rb +10 -10
  161. data/test/misc/constraints_test.rb +2 -2
  162. data/test/misc/convert_numbers_format_test.rb +7 -3
  163. data/test/misc/lang_test.rb +1 -1
  164. data/test/misc/parse_datetime_test.rb +3 -4
  165. data/test/misc/tableless_test.rb +6 -0
  166. data/test/mock_app/Rakefile +1 -1
  167. data/test/mock_app/app/assets/config/manifest.js +0 -0
  168. data/test/mock_app/app/controllers/cars_controller.rb +1 -0
  169. data/test/mock_app/app/controllers/people_controller.rb +3 -1
  170. data/test/mock_app/config/application.rb +2 -1
  171. data/test/mock_app/config/boot.rb +1 -1
  172. data/test/mock_app/config/environment.rb +2 -2
  173. data/test/mock_app/config/routes.rb +4 -1
  174. data/test/mock_app/db/schema.rb +2 -0
  175. data/test/performance/list_cars_performance_test.rb +34 -0
  176. data/test/performance/list_people_performance_test.rb +31 -0
  177. data/test/performance_test_help.rb +3 -0
  178. data/test/test_helper.rb +10 -2
  179. metadata +56 -15
  180. data/app/assets/javascripts/prototype/rico_corner.js +0 -370
  181. 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.2
4
+ version: 3.6.0.rc1
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-07-31 00:00:00.000000000 Z
11
+ date: 2020-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.5
19
+ version: 4.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.5
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
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.3'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: ice_nine
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,20 @@ dependencies:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
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'
41
69
  description: Save time and headaches, and create a more easily maintainable set of
42
70
  pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read,
43
71
  update, delete) user interface needs, leaving you more time to focus on more challenging
@@ -48,7 +76,7 @@ extensions: []
48
76
  extra_rdoc_files:
49
77
  - README.md
50
78
  files:
51
- - CHANGELOG
79
+ - CHANGELOG.rdoc
52
80
  - LICENSE.md
53
81
  - README.md
54
82
  - app/assets/images/active_scaffold/add.png
@@ -88,7 +116,6 @@ files:
88
116
  - app/assets/javascripts/prototype/active_scaffold_chosen.js
89
117
  - app/assets/javascripts/prototype/dhtml_history.js
90
118
  - app/assets/javascripts/prototype/form_enhancements.js
91
- - app/assets/javascripts/prototype/rico_corner.js
92
119
  - app/assets/javascripts/prototype/tiny_mce_bridge.js
93
120
  - app/assets/stylesheets/active_scaffold-ie.scss
94
121
  - app/assets/stylesheets/active_scaffold.scss
@@ -188,6 +215,11 @@ files:
188
215
  - lib/active_scaffold/active_record_permissions.rb
189
216
  - lib/active_scaffold/attribute_params.rb
190
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
191
223
  - lib/active_scaffold/bridges/ancestry.rb
192
224
  - lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb
193
225
  - lib/active_scaffold/bridges/bitfields.rb
@@ -220,7 +252,6 @@ files:
220
252
  - lib/active_scaffold/bridges/file_column/list_ui.rb
221
253
  - lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
222
254
  - lib/active_scaffold/bridges/file_column/test/mock_model.rb
223
- - lib/active_scaffold/bridges/file_column/test/test_helper.rb
224
255
  - lib/active_scaffold/bridges/paper_trail.rb
225
256
  - lib/active_scaffold/bridges/paper_trail/actions.rb
226
257
  - lib/active_scaffold/bridges/paper_trail/config.rb
@@ -277,6 +308,8 @@ files:
277
308
  - lib/active_scaffold/extensions/action_controller_rescueing.rb
278
309
  - lib/active_scaffold/extensions/action_view_rendering.rb
279
310
  - lib/active_scaffold/extensions/connection_adapter.rb
311
+ - lib/active_scaffold/extensions/cow_proxy.rb
312
+ - lib/active_scaffold/extensions/ice_nine.rb
280
313
  - lib/active_scaffold/extensions/left_outer_joins.rb
281
314
  - lib/active_scaffold/extensions/localize.rb
282
315
  - lib/active_scaffold/extensions/name_option_for_datetime.rb
@@ -300,6 +333,7 @@ files:
300
333
  - lib/active_scaffold/marked_model.rb
301
334
  - lib/active_scaffold/orm_checks.rb
302
335
  - lib/active_scaffold/paginator.rb
336
+ - lib/active_scaffold/registry.rb
303
337
  - lib/active_scaffold/responds_to_parent.rb
304
338
  - lib/active_scaffold/tableless.rb
305
339
  - lib/active_scaffold/version.rb
@@ -362,6 +396,7 @@ files:
362
396
  - test/misc/tableless_test.rb
363
397
  - test/mock_app/.gitignore
364
398
  - test/mock_app/Rakefile
399
+ - test/mock_app/app/assets/config/manifest.js
365
400
  - test/mock_app/app/controllers/addresses_controller.rb
366
401
  - test/mock_app/app/controllers/application_controller.rb
367
402
  - test/mock_app/app/controllers/buildings_controller.rb
@@ -397,6 +432,9 @@ files:
397
432
  - test/mock_app/db/schema.rb
398
433
  - test/mock_app/db/test.sqlite3
399
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
400
438
  - test/run_all.rb
401
439
  - test/test_helper.rb
402
440
  - vendor/assets/javascripts/getprototypeof.js
@@ -408,7 +446,7 @@ homepage: https://github.com/activescaffold/active_scaffold
408
446
  licenses:
409
447
  - MIT
410
448
  metadata: {}
411
- post_install_message:
449
+ post_install_message:
412
450
  rdoc_options: []
413
451
  require_paths:
414
452
  - lib
@@ -416,16 +454,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
416
454
  requirements:
417
455
  - - ">="
418
456
  - !ruby/object:Gem::Version
419
- version: '2.0'
457
+ version: '2.3'
420
458
  required_rubygems_version: !ruby/object:Gem::Requirement
421
459
  requirements:
422
- - - ">="
460
+ - - ">"
423
461
  - !ruby/object:Gem::Version
424
- version: '0'
462
+ version: 1.3.1
425
463
  requirements: []
426
- rubyforge_project:
427
- rubygems_version: 2.7.7
428
- signing_key:
464
+ rubygems_version: 3.0.8
465
+ signing_key:
429
466
  specification_version: 4
430
467
  summary: Rails 4.x and 5.x versions of ActiveScaffold supporting prototype and jquery
431
468
  test_files:
@@ -480,6 +517,7 @@ test_files:
480
517
  - test/misc/tableless_test.rb
481
518
  - test/mock_app/.gitignore
482
519
  - test/mock_app/Rakefile
520
+ - test/mock_app/app/assets/config/manifest.js
483
521
  - test/mock_app/app/controllers/addresses_controller.rb
484
522
  - test/mock_app/app/controllers/application_controller.rb
485
523
  - test/mock_app/app/controllers/buildings_controller.rb
@@ -515,5 +553,8 @@ test_files:
515
553
  - test/mock_app/db/schema.rb
516
554
  - test/mock_app/db/test.sqlite3
517
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
518
559
  - test/run_all.rb
519
560
  - test/test_helper.rb