active_scaffold 3.5.5 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/{CHANGELOG → CHANGELOG.rdoc} +75 -0
  3. data/README.md +21 -10
  4. data/app/assets/javascripts/active_scaffold.js.erb +0 -1
  5. data/app/assets/javascripts/jquery/active_scaffold.js +98 -7
  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 +26 -10
  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 +2 -1
  63. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +12 -15
  64. data/lib/active_scaffold/bridges/bitfields/list_ui.rb +19 -0
  65. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +1 -1
  66. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +3 -12
  67. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +1 -1
  68. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -2
  69. data/lib/active_scaffold/bridges/chosen/helpers.rb +7 -6
  70. data/lib/active_scaffold/bridges/date_picker/ext.rb +0 -13
  71. data/lib/active_scaffold/bridges/date_picker/helper.rb +49 -44
  72. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +1 -1
  73. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +1 -1
  74. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +3 -3
  75. data/lib/active_scaffold/bridges/file_column/form_ui.rb +3 -3
  76. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +10 -7
  77. data/lib/active_scaffold/bridges/paper_trail.rb +1 -1
  78. data/lib/active_scaffold/bridges/paper_trail/actions.rb +3 -1
  79. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  80. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +1 -1
  81. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +2 -2
  82. data/lib/active_scaffold/bridges/record_select/helpers.rb +15 -17
  83. data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -19
  84. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
  85. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +21 -4
  86. data/lib/active_scaffold/config/base.rb +133 -41
  87. data/lib/active_scaffold/config/core.rb +146 -18
  88. data/lib/active_scaffold/config/delete.rb +14 -1
  89. data/lib/active_scaffold/config/field_search.rb +7 -1
  90. data/lib/active_scaffold/config/form.rb +10 -1
  91. data/lib/active_scaffold/config/list.rb +39 -13
  92. data/lib/active_scaffold/config/mark.rb +4 -2
  93. data/lib/active_scaffold/config/nested.rb +16 -17
  94. data/lib/active_scaffold/config/search.rb +9 -0
  95. data/lib/active_scaffold/config/show.rb +4 -0
  96. data/lib/active_scaffold/config/update.rb +4 -0
  97. data/lib/active_scaffold/configurable.rb +14 -7
  98. data/lib/active_scaffold/constraints.rb +22 -20
  99. data/lib/active_scaffold/core.rb +67 -28
  100. data/lib/active_scaffold/data_structures/action_columns.rb +50 -59
  101. data/lib/active_scaffold/data_structures/action_link.rb +50 -20
  102. data/lib/active_scaffold/data_structures/action_links.rb +15 -13
  103. data/lib/active_scaffold/data_structures/association/abstract.rb +38 -15
  104. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +2 -6
  105. data/lib/active_scaffold/data_structures/association/active_record.rb +6 -2
  106. data/lib/active_scaffold/data_structures/association/mongoid.rb +0 -3
  107. data/lib/active_scaffold/data_structures/column.rb +75 -66
  108. data/lib/active_scaffold/data_structures/columns.rb +3 -2
  109. data/lib/active_scaffold/data_structures/nested_info.rb +33 -19
  110. data/lib/active_scaffold/data_structures/set.rb +8 -0
  111. data/lib/active_scaffold/data_structures/sorting.rb +10 -2
  112. data/lib/active_scaffold/delayed_setup.rb +16 -5
  113. data/lib/active_scaffold/extensions/action_controller_rendering.rb +3 -2
  114. data/lib/active_scaffold/extensions/action_view_rendering.rb +93 -32
  115. data/lib/active_scaffold/extensions/cow_proxy.rb +95 -0
  116. data/lib/active_scaffold/extensions/ice_nine.rb +36 -0
  117. data/lib/active_scaffold/extensions/left_outer_joins.rb +8 -33
  118. data/lib/active_scaffold/extensions/localize.rb +3 -1
  119. data/lib/active_scaffold/extensions/routing_mapper.rb +6 -45
  120. data/lib/active_scaffold/extensions/to_label.rb +3 -2
  121. data/lib/active_scaffold/extensions/unsaved_record.rb +2 -4
  122. data/lib/active_scaffold/finder.rb +110 -77
  123. data/lib/active_scaffold/helpers/action_link_helpers.rb +62 -36
  124. data/lib/active_scaffold/helpers/association_helpers.rb +18 -16
  125. data/lib/active_scaffold/helpers/controller_helpers.rb +34 -10
  126. data/lib/active_scaffold/helpers/form_column_helpers.rb +196 -124
  127. data/lib/active_scaffold/helpers/human_condition_helpers.rb +1 -1
  128. data/lib/active_scaffold/helpers/id_helpers.rb +6 -2
  129. data/lib/active_scaffold/helpers/list_column_helpers.rb +90 -57
  130. data/lib/active_scaffold/helpers/pagination_helpers.rb +2 -2
  131. data/lib/active_scaffold/helpers/search_column_helpers.rb +43 -41
  132. data/lib/active_scaffold/helpers/show_column_helpers.rb +3 -5
  133. data/lib/active_scaffold/helpers/view_helpers.rb +39 -36
  134. data/lib/active_scaffold/marked_model.rb +2 -2
  135. data/lib/active_scaffold/orm_checks.rb +3 -7
  136. data/lib/active_scaffold/paginator.rb +7 -7
  137. data/lib/active_scaffold/registry.rb +33 -0
  138. data/lib/active_scaffold/responds_to_parent.rb +8 -11
  139. data/lib/active_scaffold/tableless.rb +83 -67
  140. data/lib/active_scaffold/version.rb +2 -2
  141. data/lib/generators/active_scaffold/controller_generator.rb +2 -2
  142. data/lib/generators/active_scaffold/install_generator.rb +52 -4
  143. data/lib/generators/active_scaffold/resource_generator.rb +2 -2
  144. data/shoulda_macros/macros.rb +3 -1
  145. data/test/bridges/date_picker_test.rb +1 -2
  146. data/test/bridges/paperclip_test.rb +6 -6
  147. data/test/class_with_finder.rb +2 -2
  148. data/test/company.rb +4 -4
  149. data/test/config/create_test.rb +4 -2
  150. data/test/config/nested_test.rb +1 -1
  151. data/test/config/show_test.rb +1 -1
  152. data/test/config/update_test.rb +7 -6
  153. data/test/data_structures/action_columns_test.rb +2 -2
  154. data/test/data_structures/action_links_test.rb +1 -1
  155. data/test/data_structures/column_test.rb +3 -6
  156. data/test/data_structures/columns_test.rb +2 -2
  157. data/test/data_structures/sorting_test.rb +7 -0
  158. data/test/extensions/action_view_rendering_test.rb +20 -0
  159. data/test/extensions/active_record_test.rb +4 -4
  160. data/test/extensions/routing_mapper_test.rb +2 -2
  161. data/test/helpers/list_column_helpers_test.rb +3 -1
  162. data/test/misc/active_record_permissions_test.rb +3 -11
  163. data/test/misc/attribute_params_test.rb +12 -8
  164. data/test/misc/calculation_test.rb +1 -1
  165. data/test/misc/configurable_test.rb +10 -10
  166. data/test/misc/constraints_test.rb +3 -3
  167. data/test/misc/convert_numbers_format_test.rb +7 -3
  168. data/test/misc/lang_test.rb +1 -1
  169. data/test/misc/parse_datetime_test.rb +3 -4
  170. data/test/misc/tableless_test.rb +14 -0
  171. data/test/mock_app/Rakefile +1 -1
  172. data/test/mock_app/app/assets/config/manifest.js +0 -0
  173. data/test/mock_app/app/controllers/cars_controller.rb +1 -0
  174. data/test/mock_app/app/controllers/people_controller.rb +5 -1
  175. data/test/mock_app/app/controllers/roles_controller.rb +4 -0
  176. data/test/mock_app/app/views/active_scaffold_overrides/_form.html.erb +2 -0
  177. data/test/mock_app/app/views/active_scaffold_overrides/list.html.erb +2 -0
  178. data/test/mock_app/app/views/people/_first_name_form_column.html.erb +2 -0
  179. data/test/mock_app/app/views/people/_form.html.erb +2 -0
  180. data/test/mock_app/app/views/people/list.html.erb +2 -0
  181. data/test/mock_app/config/application.rb +2 -1
  182. data/test/mock_app/config/boot.rb +1 -1
  183. data/test/mock_app/config/environment.rb +2 -2
  184. data/test/mock_app/config/routes.rb +4 -1
  185. data/test/mock_app/db/schema.rb +2 -0
  186. data/test/performance/list_cars_performance_test.rb +34 -0
  187. data/test/performance/list_people_performance_test.rb +31 -0
  188. data/test/performance_test_help.rb +3 -0
  189. data/test/test_helper.rb +12 -4
  190. metadata +71 -15
  191. data/app/assets/javascripts/prototype/rico_corner.js +0 -370
  192. data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +0 -7
@@ -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'
data/test/test_helper.rb CHANGED
@@ -1,10 +1,11 @@
1
- require 'simplecov' if RUBY_ENGINE == 'ruby'
1
+ require 'simplecov' if ENV['COVERAGE']
2
2
 
3
3
  ENV['RAILS_ENV'] = 'test'
4
4
  require 'mock_app/config/environment'
5
5
  require 'rails/test_help'
6
6
  require 'minitest/autorun'
7
- require 'mocha/setup'
7
+ require 'mocha/minitest'
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.5
4
+ version: 3.6.1
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: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2021-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.5
19
+ version: 4.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 5.2.0
22
+ version: '6.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.0.5
29
+ version: 4.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 5.2.0
32
+ version: '6.2'
33
+ - !ruby/object:Gem::Dependency
34
+ name: cow_proxy
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.3'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.3'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: ice_nine
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +58,20 @@ dependencies:
44
58
  - - "~>"
45
59
  - !ruby/object:Gem::Version
46
60
  version: '0.11'
61
+ - !ruby/object:Gem::Dependency
62
+ name: request_store
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.3'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.3'
47
75
  description: Save time and headaches, and create a more easily maintainable set of
48
76
  pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read,
49
77
  update, delete) user interface needs, leaving you more time to focus on more challenging
@@ -54,7 +82,7 @@ extensions: []
54
82
  extra_rdoc_files:
55
83
  - README.md
56
84
  files:
57
- - CHANGELOG
85
+ - CHANGELOG.rdoc
58
86
  - LICENSE.md
59
87
  - README.md
60
88
  - app/assets/images/active_scaffold/add.png
@@ -94,7 +122,6 @@ files:
94
122
  - app/assets/javascripts/prototype/active_scaffold_chosen.js
95
123
  - app/assets/javascripts/prototype/dhtml_history.js
96
124
  - app/assets/javascripts/prototype/form_enhancements.js
97
- - app/assets/javascripts/prototype/rico_corner.js
98
125
  - app/assets/javascripts/prototype/tiny_mce_bridge.js
99
126
  - app/assets/stylesheets/active_scaffold-ie.scss
100
127
  - app/assets/stylesheets/active_scaffold.scss
@@ -194,10 +221,16 @@ files:
194
221
  - lib/active_scaffold/active_record_permissions.rb
195
222
  - lib/active_scaffold/attribute_params.rb
196
223
  - lib/active_scaffold/bridges.rb
224
+ - lib/active_scaffold/bridges/active_storage.rb
225
+ - lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb
226
+ - lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb
227
+ - lib/active_scaffold/bridges/active_storage/form_ui.rb
228
+ - lib/active_scaffold/bridges/active_storage/list_ui.rb
197
229
  - lib/active_scaffold/bridges/ancestry.rb
198
230
  - lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb
199
231
  - lib/active_scaffold/bridges/bitfields.rb
200
232
  - lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb
233
+ - lib/active_scaffold/bridges/bitfields/list_ui.rb
201
234
  - lib/active_scaffold/bridges/calendar_date_select.rb
202
235
  - lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb
203
236
  - lib/active_scaffold/bridges/cancan.rb
@@ -226,7 +259,6 @@ files:
226
259
  - lib/active_scaffold/bridges/file_column/list_ui.rb
227
260
  - lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
228
261
  - lib/active_scaffold/bridges/file_column/test/mock_model.rb
229
- - lib/active_scaffold/bridges/file_column/test/test_helper.rb
230
262
  - lib/active_scaffold/bridges/paper_trail.rb
231
263
  - lib/active_scaffold/bridges/paper_trail/actions.rb
232
264
  - lib/active_scaffold/bridges/paper_trail/config.rb
@@ -283,6 +315,8 @@ files:
283
315
  - lib/active_scaffold/extensions/action_controller_rescueing.rb
284
316
  - lib/active_scaffold/extensions/action_view_rendering.rb
285
317
  - lib/active_scaffold/extensions/connection_adapter.rb
318
+ - lib/active_scaffold/extensions/cow_proxy.rb
319
+ - lib/active_scaffold/extensions/ice_nine.rb
286
320
  - lib/active_scaffold/extensions/left_outer_joins.rb
287
321
  - lib/active_scaffold/extensions/localize.rb
288
322
  - lib/active_scaffold/extensions/name_option_for_datetime.rb
@@ -306,6 +340,7 @@ files:
306
340
  - lib/active_scaffold/marked_model.rb
307
341
  - lib/active_scaffold/orm_checks.rb
308
342
  - lib/active_scaffold/paginator.rb
343
+ - lib/active_scaffold/registry.rb
309
344
  - lib/active_scaffold/responds_to_parent.rb
310
345
  - lib/active_scaffold/tableless.rb
311
346
  - lib/active_scaffold/version.rb
@@ -349,6 +384,7 @@ files:
349
384
  - test/data_structures/standard_column_test.rb
350
385
  - test/data_structures/validation_reflection_test.rb
351
386
  - test/data_structures/virtual_column_test.rb
387
+ - test/extensions/action_view_rendering_test.rb
352
388
  - test/extensions/active_record_test.rb
353
389
  - test/extensions/routing_mapper_test.rb
354
390
  - test/helpers/form_column_helpers_test.rb
@@ -368,6 +404,7 @@ files:
368
404
  - test/misc/tableless_test.rb
369
405
  - test/mock_app/.gitignore
370
406
  - test/mock_app/Rakefile
407
+ - test/mock_app/app/assets/config/manifest.js
371
408
  - test/mock_app/app/controllers/addresses_controller.rb
372
409
  - test/mock_app/app/controllers/application_controller.rb
373
410
  - test/mock_app/app/controllers/buildings_controller.rb
@@ -375,6 +412,7 @@ files:
375
412
  - test/mock_app/app/controllers/contacts_controller.rb
376
413
  - test/mock_app/app/controllers/floors_controller.rb
377
414
  - test/mock_app/app/controllers/people_controller.rb
415
+ - test/mock_app/app/controllers/roles_controller.rb
378
416
  - test/mock_app/app/helpers/application_helper.rb
379
417
  - test/mock_app/app/models/address.rb
380
418
  - test/mock_app/app/models/building.rb
@@ -384,6 +422,11 @@ files:
384
422
  - test/mock_app/app/models/floor.rb
385
423
  - test/mock_app/app/models/person.rb
386
424
  - test/mock_app/app/models/role.rb
425
+ - test/mock_app/app/views/active_scaffold_overrides/_form.html.erb
426
+ - test/mock_app/app/views/active_scaffold_overrides/list.html.erb
427
+ - test/mock_app/app/views/people/_first_name_form_column.html.erb
428
+ - test/mock_app/app/views/people/_form.html.erb
429
+ - test/mock_app/app/views/people/list.html.erb
387
430
  - test/mock_app/config.ru
388
431
  - test/mock_app/config/application.rb
389
432
  - test/mock_app/config/boot.rb
@@ -403,6 +446,9 @@ files:
403
446
  - test/mock_app/db/schema.rb
404
447
  - test/mock_app/db/test.sqlite3
405
448
  - test/model_stub.rb
449
+ - test/performance/list_cars_performance_test.rb
450
+ - test/performance/list_people_performance_test.rb
451
+ - test/performance_test_help.rb
406
452
  - test/run_all.rb
407
453
  - test/test_helper.rb
408
454
  - vendor/assets/javascripts/getprototypeof.js
@@ -414,7 +460,7 @@ homepage: https://github.com/activescaffold/active_scaffold
414
460
  licenses:
415
461
  - MIT
416
462
  metadata: {}
417
- post_install_message:
463
+ post_install_message:
418
464
  rdoc_options: []
419
465
  require_paths:
420
466
  - lib
@@ -422,16 +468,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
422
468
  requirements:
423
469
  - - ">="
424
470
  - !ruby/object:Gem::Version
425
- version: '2.0'
471
+ version: '2.3'
426
472
  required_rubygems_version: !ruby/object:Gem::Requirement
427
473
  requirements:
428
474
  - - ">="
429
475
  - !ruby/object:Gem::Version
430
476
  version: '0'
431
477
  requirements: []
432
- rubyforge_project:
433
- rubygems_version: 2.7.9
434
- signing_key:
478
+ rubygems_version: 3.0.8
479
+ signing_key:
435
480
  specification_version: 4
436
481
  summary: Rails 4.x and 5.x versions of ActiveScaffold supporting prototype and jquery
437
482
  test_files:
@@ -467,6 +512,7 @@ test_files:
467
512
  - test/data_structures/standard_column_test.rb
468
513
  - test/data_structures/validation_reflection_test.rb
469
514
  - test/data_structures/virtual_column_test.rb
515
+ - test/extensions/action_view_rendering_test.rb
470
516
  - test/extensions/active_record_test.rb
471
517
  - test/extensions/routing_mapper_test.rb
472
518
  - test/helpers/form_column_helpers_test.rb
@@ -486,6 +532,7 @@ test_files:
486
532
  - test/misc/tableless_test.rb
487
533
  - test/mock_app/.gitignore
488
534
  - test/mock_app/Rakefile
535
+ - test/mock_app/app/assets/config/manifest.js
489
536
  - test/mock_app/app/controllers/addresses_controller.rb
490
537
  - test/mock_app/app/controllers/application_controller.rb
491
538
  - test/mock_app/app/controllers/buildings_controller.rb
@@ -493,6 +540,7 @@ test_files:
493
540
  - test/mock_app/app/controllers/contacts_controller.rb
494
541
  - test/mock_app/app/controllers/floors_controller.rb
495
542
  - test/mock_app/app/controllers/people_controller.rb
543
+ - test/mock_app/app/controllers/roles_controller.rb
496
544
  - test/mock_app/app/helpers/application_helper.rb
497
545
  - test/mock_app/app/models/address.rb
498
546
  - test/mock_app/app/models/building.rb
@@ -502,6 +550,11 @@ test_files:
502
550
  - test/mock_app/app/models/floor.rb
503
551
  - test/mock_app/app/models/person.rb
504
552
  - test/mock_app/app/models/role.rb
553
+ - test/mock_app/app/views/active_scaffold_overrides/_form.html.erb
554
+ - test/mock_app/app/views/active_scaffold_overrides/list.html.erb
555
+ - test/mock_app/app/views/people/_first_name_form_column.html.erb
556
+ - test/mock_app/app/views/people/_form.html.erb
557
+ - test/mock_app/app/views/people/list.html.erb
505
558
  - test/mock_app/config.ru
506
559
  - test/mock_app/config/application.rb
507
560
  - test/mock_app/config/boot.rb
@@ -521,5 +574,8 @@ test_files:
521
574
  - test/mock_app/db/schema.rb
522
575
  - test/mock_app/db/test.sqlite3
523
576
  - test/model_stub.rb
577
+ - test/performance/list_cars_performance_test.rb
578
+ - test/performance/list_people_performance_test.rb
579
+ - test/performance_test_help.rb
524
580
  - test/run_all.rb
525
581
  - test/test_helper.rb
@@ -1,370 +0,0 @@
1
- /**
2
- *
3
- * Copyright 2005 Sabre Airline Solutions
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
6
- * file except in compliance with the License. You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software distributed under the
11
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
12
- * either express or implied. See the License for the specific language governing permissions
13
- * and limitations under the License.
14
- **/
15
-
16
-
17
- //-------------------- rico.js
18
- var Rico = {
19
- Version: '1.1.0',
20
- prototypeVersion: parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1])
21
- }
22
-
23
- //-------------------- ricoColor.js
24
- Rico.Color = Class.create();
25
-
26
- Rico.Color.prototype = {
27
-
28
- initialize: function(red, green, blue) {
29
- this.rgb = { r: red, g : green, b : blue };
30
- },
31
-
32
- blend: function(other) {
33
- this.rgb.r = Math.floor((this.rgb.r + other.rgb.r)/2);
34
- this.rgb.g = Math.floor((this.rgb.g + other.rgb.g)/2);
35
- this.rgb.b = Math.floor((this.rgb.b + other.rgb.b)/2);
36
- },
37
-
38
- asRGB: function() {
39
- return "rgb(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ")";
40
- },
41
-
42
- asHex: function() {
43
- return "#" + this.rgb.r.toColorPart() + this.rgb.g.toColorPart() + this.rgb.b.toColorPart();
44
- },
45
-
46
- asHSB: function() {
47
- return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
48
- },
49
-
50
- toString: function() {
51
- return this.asHex();
52
- }
53
-
54
- };
55
-
56
- Rico.Color.createFromHex = function(hexCode) {
57
- if(hexCode.length==4) {
58
- var shortHexCode = hexCode;
59
- var hexCode = '#';
60
- for(var i=1;i<4;i++) hexCode += (shortHexCode.charAt(i) + shortHexCode.charAt(i));
61
- }
62
- if ( hexCode.indexOf('#') == 0 )
63
- hexCode = hexCode.substring(1);
64
- var red = hexCode.substring(0,2);
65
- var green = hexCode.substring(2,4);
66
- var blue = hexCode.substring(4,6);
67
- return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
68
- }
69
-
70
- /**
71
- * Factory method for creating a color from the background of
72
- * an HTML element.
73
- */
74
- Rico.Color.createColorFromBackground = function(elem) {
75
-
76
- //var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color"); // Changed to prototype style
77
- var actualColor = $(elem).getStyle('backgroundColor');
78
-
79
- if ( actualColor == "transparent" && elem.parentNode )
80
- return Rico.Color.createColorFromBackground(elem.parentNode);
81
-
82
- if ( actualColor == null )
83
- return new Rico.Color(255,255,255);
84
-
85
- if ( actualColor.indexOf("rgb(") == 0 ) {
86
- var colors = actualColor.substring(4, actualColor.length - 1 );
87
- var colorArray = colors.split(",");
88
- return new Rico.Color( parseInt( colorArray[0] ),
89
- parseInt( colorArray[1] ),
90
- parseInt( colorArray[2] ) );
91
-
92
- }
93
- else if ( actualColor.indexOf("#") == 0 ) {
94
- return Rico.Color.createFromHex(actualColor);
95
- }
96
- else
97
- return new Rico.Color(255,255,255);
98
- }
99
-
100
- /* next two functions changed to mootools color.js functions */
101
- Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
102
-
103
- var br = Math.round(brightness / 100 * 255);
104
- if (this[1] == 0){
105
- return [br, br, br];
106
- } else {
107
- var hue = this[0] % 360;
108
- var f = hue % 60;
109
- var p = Math.round((brightness * (100 - saturation)) / 10000 * 255);
110
- var q = Math.round((brightness * (6000 - saturation * f)) / 600000 * 255);
111
- var t = Math.round((brightness * (6000 - saturation * (60 - f))) / 600000 * 255);
112
- switch(Math.floor(hue / 60)){
113
- case 0: return { r : br, g : t, b : p };
114
- case 1: return { r : q, g : br, b : p };
115
- case 2: return { r : p, g : br, b : t };
116
- case 3: return { r : p, g : q, b : br };
117
- case 4: return { r : t, g : p, b : br };
118
- case 5: return { r : br, g : p, b : q };
119
- }
120
- }
121
- return false;
122
- }
123
-
124
- Rico.Color.RGBtoHSB = function(red, green, blue) {
125
- var hue, saturation, brightness;
126
- var max = Math.max(red, green, blue), min = Math.min(red, green, blue);
127
- var delta = max - min;
128
- brightness = max / 255;
129
- saturation = (max != 0) ? delta / max : 0;
130
- if (saturation == 0){
131
- hue = 0;
132
- } else {
133
- var rr = (max - red) / delta;
134
- var gr = (max - green) / delta;
135
- var br = (max - blue) / delta;
136
- if (red == max) hue = br - gr;
137
- else if (green == max) hue = 2 + rr - br;
138
- else hue = 4 + gr - rr;
139
- hue /= 6;
140
- if (hue < 0) hue++;
141
- }
142
- return { h : Math.round(hue * 360), s : Math.round(saturation * 100), b : Math.round(brightness * 100)};
143
- }
144
-
145
-
146
- //-------------------- ricoCorner.js
147
- Rico.Corner = {
148
-
149
- round: function(e, options) {
150
- var e = $(e);
151
- this._setOptions(options);
152
-
153
- var color = this.options.color;
154
- if ( this.options.color == "fromElement" )
155
- color = this._background(e);
156
-
157
- var bgColor = this.options.bgColor;
158
- if ( this.options.bgColor == "fromParent" )
159
- bgColor = this._background(e.offsetParent);
160
-
161
- this._roundCornersImpl(e, color, bgColor);
162
- },
163
-
164
- _roundCornersImpl: function(e, color, bgColor) {
165
- if(this.options.border)
166
- this._renderBorder(e,bgColor);
167
- if(this._isTopRounded())
168
- this._roundTopCorners(e,color,bgColor);
169
- if(this._isBottomRounded())
170
- this._roundBottomCorners(e,color,bgColor);
171
- },
172
-
173
- _renderBorder: function(el,bgColor) {
174
- var borderValue = "1px solid " + this._borderColor(bgColor);
175
- var borderL = "border-left: " + borderValue;
176
- var borderR = "border-right: " + borderValue;
177
- var style = "style='" + borderL + ";" + borderR + "'";
178
- el.innerHTML = "<div " + style + ">" + el.innerHTML + "</div>"
179
- },
180
-
181
- _roundTopCorners: function(el, color, bgColor) {
182
- var corner = this._createCorner(bgColor);
183
- for(var i=0 ; i < this.options.numSlices ; i++ )
184
- corner.appendChild(this._createCornerSlice(color,bgColor,i,"top"));
185
- el.style.paddingTop = 0;
186
- el.insertBefore(corner,el.firstChild);
187
- },
188
-
189
- _roundBottomCorners: function(el, color, bgColor) {
190
- var corner = this._createCorner(bgColor);
191
- for(var i=(this.options.numSlices-1) ; i >= 0 ; i-- )
192
- corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));
193
- el.style.paddingBottom = 0;
194
- el.appendChild(corner);
195
- },
196
-
197
- _createCorner: function(bgColor) {
198
- var corner = document.createElement("div");
199
- corner.style.backgroundColor = (this._isTransparent() ? "transparent" : bgColor);
200
- return corner;
201
- },
202
-
203
- _createCornerSlice: function(color,bgColor, n, position) {
204
- var slice = document.createElement("span");
205
-
206
- var inStyle = slice.style;
207
- inStyle.backgroundColor = color;
208
- inStyle.display = "block";
209
- inStyle.height = "1px";
210
- inStyle.overflow = "hidden";
211
- inStyle.fontSize = "1px";
212
-
213
- var borderColor = this._borderColor(color,bgColor);
214
- if ( this.options.border && n == 0 ) {
215
- inStyle.borderTopStyle = "solid";
216
- inStyle.borderTopWidth = "1px";
217
- inStyle.borderLeftWidth = "0px";
218
- inStyle.borderRightWidth = "0px";
219
- inStyle.borderBottomWidth = "0px";
220
- inStyle.height = "0px"; // assumes css compliant box model
221
- inStyle.borderColor = borderColor;
222
- }
223
- else if(borderColor) {
224
- inStyle.borderColor = borderColor;
225
- inStyle.borderStyle = "solid";
226
- inStyle.borderWidth = "0px 1px";
227
- }
228
-
229
- if ( !this.options.compact && (n == (this.options.numSlices-1)) )
230
- inStyle.height = "2px";
231
-
232
- this._setMargin(slice, n, position);
233
- this._setBorder(slice, n, position);
234
- return slice;
235
- },
236
-
237
- _setOptions: function(options) {
238
- this.options = {
239
- corners : "all",
240
- color : "fromElement",
241
- bgColor : "fromParent",
242
- blend : true,
243
- border : false,
244
- compact : false
245
- }
246
- Object.extend(this.options, options || {});
247
-
248
- this.options.numSlices = this.options.compact ? 2 : 4;
249
- if ( this._isTransparent() )
250
- this.options.blend = false;
251
- },
252
-
253
- _whichSideTop: function() {
254
- if ( this._hasString(this.options.corners, "all", "top") )
255
- return "";
256
-
257
- if ( this.options.corners.indexOf("tl") >= 0 && this.options.corners.indexOf("tr") >= 0 )
258
- return "";
259
-
260
- if (this.options.corners.indexOf("tl") >= 0)
261
- return "left";
262
- else if (this.options.corners.indexOf("tr") >= 0)
263
- return "right";
264
- return "";
265
- },
266
-
267
- _whichSideBottom: function() {
268
- if ( this._hasString(this.options.corners, "all", "bottom") )
269
- return "";
270
-
271
- if ( this.options.corners.indexOf("bl")>=0 && this.options.corners.indexOf("br")>=0 )
272
- return "";
273
-
274
- if(this.options.corners.indexOf("bl") >=0)
275
- return "left";
276
- else if(this.options.corners.indexOf("br")>=0)
277
- return "right";
278
- return "";
279
- },
280
-
281
- _borderColor : function(color,bgColor) {
282
- if ( color == "transparent" )
283
- return bgColor;
284
- else if ( this.options.border )
285
- return this.options.border;
286
- else if ( this.options.blend )
287
- return this._blend( bgColor, color );
288
- else
289
- return "";
290
- },
291
-
292
-
293
- _setMargin: function(el, n, corners) {
294
- var marginSize = this._marginSize(n);
295
- var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
296
-
297
- if ( whichSide == "left" ) {
298
- el.style.marginLeft = marginSize + "px"; el.style.marginRight = "0px";
299
- }
300
- else if ( whichSide == "right" ) {
301
- el.style.marginRight = marginSize + "px"; el.style.marginLeft = "0px";
302
- }
303
- else {
304
- el.style.marginLeft = marginSize + "px"; el.style.marginRight = marginSize + "px";
305
- }
306
- },
307
-
308
- _setBorder: function(el,n,corners) {
309
- var borderSize = this._borderSize(n);
310
- var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
311
- if ( whichSide == "left" ) {
312
- el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = "0px";
313
- }
314
- else if ( whichSide == "right" ) {
315
- el.style.borderRightWidth = borderSize + "px"; el.style.borderLeftWidth = "0px";
316
- }
317
- else {
318
- el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px";
319
- }
320
- if (this.options.border != false)
321
- el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px";
322
- },
323
-
324
- _marginSize: function(n) {
325
- if ( this._isTransparent() )
326
- return 0;
327
-
328
- var marginSizes = [ 5, 3, 2, 1 ];
329
- var blendedMarginSizes = [ 3, 2, 1, 0 ];
330
- var compactMarginSizes = [ 2, 1 ];
331
- var smBlendedMarginSizes = [ 1, 0 ];
332
-
333
- if ( this.options.compact && this.options.blend )
334
- return smBlendedMarginSizes[n];
335
- else if ( this.options.compact )
336
- return compactMarginSizes[n];
337
- else if ( this.options.blend )
338
- return blendedMarginSizes[n];
339
- else
340
- return marginSizes[n];
341
- },
342
-
343
- _borderSize: function(n) {
344
- var transparentBorderSizes = [ 5, 3, 2, 1 ];
345
- var blendedBorderSizes = [ 2, 1, 1, 1 ];
346
- var compactBorderSizes = [ 1, 0 ];
347
- var actualBorderSizes = [ 0, 2, 0, 0 ];
348
-
349
- if ( this.options.compact && (this.options.blend || this._isTransparent()) )
350
- return 1;
351
- else if ( this.options.compact )
352
- return compactBorderSizes[n];
353
- else if ( this.options.blend )
354
- return blendedBorderSizes[n];
355
- else if ( this.options.border )
356
- return actualBorderSizes[n];
357
- else if ( this._isTransparent() )
358
- return transparentBorderSizes[n];
359
- return 0;
360
- },
361
-
362
- _hasString: function(str) { for(var i=1 ; i<arguments.length ; i++) if (str.indexOf(arguments[i]) >= 0) return true; return false; },
363
- _blend: function(c1, c2) { var cc1 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; },
364
- _background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
365
- _isTransparent: function() { return this.options.color == "transparent"; },
366
- _isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); },
367
- _isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); },
368
- _hasSingleTextChild: function(el) { return el.childNodes.length == 1 && el.childNodes[0].nodeType == 3; }
369
- }
370
-