active_scaffold 3.6.20 → 3.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +47 -0
  3. data/README.md +29 -16
  4. data/app/assets/javascripts/jquery/active_scaffold.js +106 -68
  5. data/app/assets/javascripts/jquery/active_scaffold_chosen.js +6 -5
  6. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +18 -4
  7. data/app/assets/stylesheets/active_scaffold_layout.css +13 -2
  8. data/app/views/active_scaffold_overrides/_base_form.html.erb +5 -1
  9. data/app/views/active_scaffold_overrides/_field_search.html.erb +1 -0
  10. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +2 -1
  11. data/app/views/active_scaffold_overrides/_render_field.js.erb +24 -13
  12. data/config/locales/de.yml +6 -3
  13. data/config/locales/en.yml +3 -0
  14. data/config/locales/es.yml +3 -0
  15. data/config/locales/fr.yml +9 -6
  16. data/config/locales/hu.yml +20 -17
  17. data/config/locales/ja.yml +83 -80
  18. data/config/locales/ru.yml +17 -14
  19. data/lib/active_scaffold/actions/common_search.rb +2 -2
  20. data/lib/active_scaffold/actions/core.rb +30 -10
  21. data/lib/active_scaffold/actions/field_search.rb +9 -6
  22. data/lib/active_scaffold/actions/nested.rb +7 -7
  23. data/lib/active_scaffold/actions/update.rb +3 -3
  24. data/lib/active_scaffold/attribute_params.rb +22 -70
  25. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +0 -3
  26. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +6 -6
  27. data/lib/active_scaffold/bridges/active_storage/list_ui.rb +7 -7
  28. data/lib/active_scaffold/bridges/active_storage.rb +3 -0
  29. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +2 -2
  30. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +2 -2
  31. data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +12 -14
  32. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +2 -2
  33. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +1 -1
  34. data/lib/active_scaffold/bridges/chosen/helpers.rb +10 -10
  35. data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +7 -7
  36. data/lib/active_scaffold/bridges/date_picker/ext.rb +20 -9
  37. data/lib/active_scaffold/bridges/date_picker/helper.rb +9 -9
  38. data/lib/active_scaffold/bridges/date_picker.rb +2 -0
  39. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -3
  40. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +5 -5
  41. data/lib/active_scaffold/bridges/file_column/form_ui.rb +1 -1
  42. data/lib/active_scaffold/bridges/file_column/list_ui.rb +3 -3
  43. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +1 -1
  44. data/lib/active_scaffold/bridges/paper_trail/actions.rb +4 -1
  45. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -3
  46. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
  47. data/lib/active_scaffold/bridges/record_select/helpers.rb +17 -17
  48. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +6 -6
  49. data/lib/active_scaffold/bridges/tiny_mce.rb +1 -1
  50. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +6 -11
  51. data/lib/active_scaffold/bridges.rb +0 -3
  52. data/lib/active_scaffold/config/core.rb +1 -1
  53. data/lib/active_scaffold/config/field_search.rb +9 -1
  54. data/lib/active_scaffold/config/form.rb +9 -1
  55. data/lib/active_scaffold/constraints.rb +22 -7
  56. data/lib/active_scaffold/core.rb +6 -10
  57. data/lib/active_scaffold/data_structures/action_columns.rb +0 -25
  58. data/lib/active_scaffold/data_structures/action_links.rb +1 -1
  59. data/lib/active_scaffold/data_structures/association/abstract.rb +8 -0
  60. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +8 -0
  61. data/lib/active_scaffold/data_structures/association/active_record.rb +1 -13
  62. data/lib/active_scaffold/data_structures/association/mongoid.rb +21 -8
  63. data/lib/active_scaffold/data_structures/column.rb +139 -28
  64. data/lib/active_scaffold/data_structures/columns.rb +12 -12
  65. data/lib/active_scaffold/data_structures/nested_info.rb +12 -0
  66. data/lib/active_scaffold/data_structures/sorting.rb +1 -1
  67. data/lib/active_scaffold/engine.rb +15 -1
  68. data/lib/active_scaffold/extensions/action_view_rendering.rb +13 -5
  69. data/lib/active_scaffold/extensions/cow_proxy.rb +1 -1
  70. data/lib/active_scaffold/extensions/routing_mapper.rb +1 -0
  71. data/lib/active_scaffold/extensions/unsaved_record.rb +9 -3
  72. data/lib/active_scaffold/finder.rb +147 -28
  73. data/lib/active_scaffold/helpers/action_link_helpers.rb +1 -1
  74. data/lib/active_scaffold/helpers/controller_helpers.rb +9 -4
  75. data/lib/active_scaffold/helpers/form_column_helpers.rb +153 -107
  76. data/lib/active_scaffold/helpers/human_condition_helpers.rb +48 -14
  77. data/lib/active_scaffold/helpers/list_column_helpers.rb +37 -20
  78. data/lib/active_scaffold/helpers/search_column_helpers.rb +137 -55
  79. data/lib/active_scaffold/helpers/show_column_helpers.rb +6 -6
  80. data/lib/active_scaffold/helpers/view_helpers.rb +1 -1
  81. data/lib/active_scaffold/orm_checks.rb +21 -1
  82. data/lib/active_scaffold/registry.rb +10 -15
  83. data/lib/active_scaffold/tableless.rb +10 -79
  84. data/lib/active_scaffold/version.rb +2 -2
  85. data/lib/active_scaffold.rb +3 -9
  86. data/lib/generators/active_scaffold/install_generator.rb +2 -2
  87. data/test/bridges/bridge_test.rb +1 -1
  88. data/test/bridges/date_picker_test.rb +3 -2
  89. data/test/bridges/paperclip_test.rb +18 -14
  90. data/test/bridges/tiny_mce_test.rb +5 -3
  91. data/test/config/base_test.rb +1 -1
  92. data/test/config/core_test.rb +1 -1
  93. data/test/config/create_test.rb +1 -1
  94. data/test/config/delete_test.rb +1 -1
  95. data/test/config/field_search_test.rb +1 -1
  96. data/test/config/list_test.rb +1 -1
  97. data/test/config/nested_test.rb +1 -1
  98. data/test/config/search_test.rb +1 -1
  99. data/test/config/show_test.rb +1 -1
  100. data/test/config/subform_test.rb +1 -1
  101. data/test/config/update_test.rb +1 -1
  102. data/test/data_structures/action_columns_test.rb +1 -1
  103. data/test/data_structures/action_link_test.rb +1 -1
  104. data/test/data_structures/action_links_test.rb +1 -1
  105. data/test/data_structures/actions_test.rb +1 -1
  106. data/test/data_structures/association_column_test.rb +1 -1
  107. data/test/data_structures/column_test.rb +1 -1
  108. data/test/data_structures/columns_test.rb +1 -1
  109. data/test/data_structures/set_test.rb +1 -1
  110. data/test/data_structures/sorting_test.rb +1 -1
  111. data/test/data_structures/standard_column_test.rb +1 -1
  112. data/test/data_structures/validation_reflection_test.rb +1 -1
  113. data/test/data_structures/virtual_column_test.rb +1 -1
  114. data/test/extensions/active_record_test.rb +1 -1
  115. data/test/helpers/form_column_helpers_test.rb +7 -5
  116. data/test/helpers/pagination_helpers_test.rb +1 -1
  117. data/test/helpers/search_column_helpers_test.rb +2 -1
  118. data/test/misc/active_record_permissions_test.rb +1 -1
  119. data/test/misc/attribute_params_test.rb +1 -1
  120. data/test/misc/calculation_test.rb +1 -1
  121. data/test/misc/configurable_test.rb +1 -1
  122. data/test/misc/constraints_test.rb +2 -1
  123. data/test/misc/convert_numbers_format_test.rb +1 -1
  124. data/test/misc/finder_test.rb +39 -1
  125. data/test/misc/lang_test.rb +1 -1
  126. data/test/misc/parse_datetime_test.rb +1 -1
  127. data/test/misc/tableless_test.rb +1 -1
  128. data/test/test_helper.rb +4 -4
  129. metadata +5 -17
  130. data/config/brakeman.ignore +0 -26
  131. data/config/brakeman.yml +0 -3
  132. data/config/i18n-tasks.yml +0 -121
  133. data/lib/active_scaffold/bridges/shared/date_bridge.rb +0 -221
  134. data/lib/active_scaffold/delayed_setup.rb +0 -41
  135. data/lib/active_scaffold/extensions/left_outer_joins.rb +0 -43
@@ -4,24 +4,6 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
4
4
  def self.scope(association, connection)
5
5
  INSTANCE.scope association, connection
6
6
  end
7
-
8
- if Rails.version < '5.0.0'
9
- def column_for(table_name, column_name, alias_tracker = nil)
10
- klass = alias_tracker ? alias_tracker.connection.klass : self.klass
11
- if table_name == klass.table_name
12
- klass.columns_hash[column_name]
13
- elsif alias_tracker && (klass = alias_tracker.instance_variable_get(:@assoc_klass))
14
- klass.columns_hash[column_name]
15
- else # rails < 4.1
16
- association.klass.columns_hash[column_name]
17
- end
18
- end
19
-
20
- def add_constraints(scope, owner, assoc_klass, refl, tracker)
21
- tracker.instance_variable_set(:@assoc_klass, assoc_klass)
22
- super
23
- end
24
- end
25
7
  end
26
8
 
27
9
  class Connection < ActiveRecord::ConnectionAdapters::AbstractAdapter
@@ -43,33 +25,15 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
43
25
  end
44
26
 
45
27
  class Column < ActiveRecord::ConnectionAdapters::Column
46
- if Rails.version >= '5.0.0'
47
- def initialize(name, default, sql_type = nil, null = true, **)
48
- metadata = ActiveRecord::Base.connection.send :fetch_type_metadata, sql_type
49
- super(name, default, metadata, null)
50
- end
51
- else
52
- def initialize(name, default, sql_type = nil, null = true)
53
- cast_type = ActiveRecord::Base.connection.send :lookup_cast_type, sql_type
54
- super(name, default, cast_type, sql_type, null)
55
- end
28
+ def initialize(name, default, sql_type = nil, null = true, **)
29
+ metadata = ActiveRecord::Base.connection.send :fetch_type_metadata, sql_type
30
+ super(name, default, metadata, null)
56
31
  end
57
32
  end
58
33
 
59
34
  module Tableless
60
- if Rails.version < '5.2.0'
61
- def skip_statement_cache?
62
- klass < ActiveScaffold::Tableless ? true : super
63
- end
64
-
65
- def association_scope
66
- @association_scope ||= AssociationScope.scope(self, klass.connection) if klass < ActiveScaffold::Tableless
67
- super
68
- end
69
- else
70
- def skip_statement_cache?(scope)
71
- klass < ActiveScaffold::Tableless ? true : super
72
- end
35
+ def skip_statement_cache?(scope)
36
+ klass < ActiveScaffold::Tableless ? true : super
73
37
  end
74
38
 
75
39
  def target_scope
@@ -186,18 +150,11 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
186
150
  private
187
151
 
188
152
  def relation
189
- args = [self]
190
- if Rails.version < '5.2.0'
191
- args << arel_table
192
- args << predicate_builder if Rails.version >= '5.0.0'
193
- end
194
- ActiveScaffold::Tableless::Relation.new(*args)
153
+ ActiveScaffold::Tableless::Relation.new(self)
195
154
  end
196
155
 
197
- if Rails.version >= '5.2'
198
- def cached_find_by_statement(key, &block)
199
- StatementCache.new(key, self, &block)
200
- end
156
+ def cached_find_by_statement(key, &block)
157
+ StatementCache.new(key, self, &block)
201
158
  end
202
159
  end
203
160
 
@@ -207,34 +164,8 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
207
164
  @model = model
208
165
  end
209
166
 
210
- if Rails.version < '5.2' # 5.0 and 5.1
211
- def execute(values, model, connection)
212
- model.where(@key => values)
213
- end
214
- else
215
- def execute(values, connection)
216
- @model.where(@key => values)
217
- end
218
- end
219
- end
220
- if Rails.version < '5.0' # 4.2.x
221
- def self.columns_hash
222
- if self < ActiveScaffold::Tableless
223
- @columns_hash ||= Hash[columns.map { |c| [c.name, c] }]
224
- else
225
- super
226
- end
227
- end
228
-
229
- def self.initialize_find_by_cache
230
- self.find_by_statement_cache = Hash.new { |h, k| h[k] = StatementCache.new(k) } # rubocop:disable Rails/DynamicFindBy
231
- end
232
- elsif Rails.version < '5.2' # 5.0 and 5.1
233
- def self.initialize_find_by_cache
234
- @find_by_statement_cache = {
235
- true => Hash.new { |h, k| h[k] = StatementCache.new(k) },
236
- false => Hash.new { |h, k| h[k] = StatementCache.new(k) }
237
- }
167
+ def execute(values, connection)
168
+ @model.where(@key => values)
238
169
  end
239
170
  end
240
171
 
@@ -1,8 +1,8 @@
1
1
  module ActiveScaffold
2
2
  module Version
3
3
  MAJOR = 3
4
- MINOR = 6
5
- PATCH = 20
4
+ MINOR = 7
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -3,9 +3,9 @@ module ActiveScaffold
3
3
  autoload :AttributeParams, 'active_scaffold/attribute_params'
4
4
  autoload :Bridges, 'active_scaffold/bridges'
5
5
  autoload :Configurable, 'active_scaffold/configurable'
6
+ autoload :ConnectionAdapters, 'active_scaffold/extensions/connection_adapter.rb'
6
7
  autoload :Constraints, 'active_scaffold/constraints'
7
8
  autoload :Core, 'active_scaffold/core'
8
- autoload :DelayedSetup, 'active_scaffold/delayed_setup'
9
9
  autoload :Finder, 'active_scaffold/finder'
10
10
  autoload :MarkedModel, 'active_scaffold/marked_model'
11
11
  autoload :OrmChecks, 'active_scaffold/orm_checks'
@@ -45,7 +45,6 @@ module ActiveScaffold
45
45
  class ActionNotAllowed < RuntimeError; end
46
46
  class ReverseAssociationRequired < RuntimeError; end
47
47
 
48
- mattr_accessor :delayed_setup, instance_writer: false
49
48
  mattr_accessor :stylesheets, instance_writer: false
50
49
  self.stylesheets = []
51
50
  mattr_accessor :javascripts, instance_writer: false
@@ -80,15 +79,12 @@ module ActiveScaffold
80
79
  @@exclude_bridges ||= []
81
80
  end
82
81
 
82
+ mattr_accessor :nested_subforms, instance_writer: false
83
+
83
84
  def self.root
84
85
  File.dirname(__FILE__) + '/..'
85
86
  end
86
87
 
87
- def self.set_defaults(&block) # rubocop:disable Naming/AccessorMethodName
88
- ActiveSupport::Deprecation.warn 'use ActiveScaffold.defaults'
89
- defaults(&block)
90
- end
91
-
92
88
  def self.defaults(&block)
93
89
  ActiveScaffold::Config::Core.configure(&block)
94
90
  end
@@ -97,5 +93,3 @@ require 'active_scaffold/engine'
97
93
  require 'ice_nine'
98
94
  require 'ice_nine/core_ext/object'
99
95
  require 'request_store'
100
- # TODO: clean up extensions. some could be organized for autoloading, and others could be removed entirely.
101
- Dir["#{File.dirname __FILE__}/active_scaffold/extensions/*.rb"].each { |file| require file }
@@ -37,7 +37,7 @@ module ActiveScaffold
37
37
  file = 'app/assets/stylesheets/application.css'
38
38
  return unless File.exist?(file)
39
39
  original_css = File.binread(file)
40
- if original_css =~ /require active_scaffold$/
40
+ if original_css.match?(/require active_scaffold$/)
41
41
  say_status('skipped', 'insert into app/assets/stylesheets/application.css', :yellow)
42
42
  else
43
43
  insert_into_file 'app/assets/stylesheets/application.css', before: %r{[ ]*\*/} do
@@ -68,7 +68,7 @@ module ActiveScaffold
68
68
  say_status('create', file)
69
69
  end
70
70
  insert_into_file 'app/views/layouts/application.html.erb', after: /javascript_pack_tag 'application'.*\n/ do
71
- " <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>\n"
71
+ " <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload', 'data-turbo-track': 'reload' %>\n"
72
72
  end
73
73
  append_to_file 'config/initializers/assets.rb' do
74
74
  "Rails.application.config.assets.precompile += %w( application.js )\n"
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class BridgeTest < MiniTest::Test
3
+ class BridgeTest < Minitest::Test
4
4
  def setup
5
5
  @const_store = {}
6
6
  end
@@ -24,7 +24,8 @@ class DatePickerTest < ActionView::TestCase
24
24
  def test_form_ui
25
25
  config = ActiveScaffold::Config::Core.new(:company)
26
26
  @record = Company.new
27
- assert active_scaffold_input_date_picker(config.columns[:date], :name => 'record[date]', :id => 'record_date', :object => @record)
28
- assert active_scaffold_input_date_picker(config.columns[:datetime], :name => 'record[datetime]', :id => 'record_datetime', :object => @record)
27
+ opts = {object: @record}
28
+ assert active_scaffold_input_date_picker(config.columns[:date], opts.merge(id: 'record_date', name: 'record[date]'))
29
+ assert active_scaffold_input_date_picker(config.columns[:datetime], opts.merge(id: 'record_date', name: 'record[datetime]'))
29
30
  end
30
31
  end
@@ -58,24 +58,28 @@ class PaperclipTest < ActionView::TestCase
58
58
  with_js_framework :jquery do
59
59
  config = PaperclipCore.new(:company)
60
60
  @record = Company.new
61
+ opts = {name: 'record[logo]', id: 'record_logo', object: @record}
61
62
 
62
63
  @record.stubs(:logo).returns(stub(:file? => true, :original_filename => 'file', :url => '/system/file', :styles => Company.attachment_definitions[:logo]))
63
- quote = '&#39;'
64
- click_js = "jQuery(this).prev().val(#{quote}true#{quote}); jQuery(this).parent().hide().next().show(); return false;"
65
- change_js = "jQuery(this).parents(#{quote}div.paperclip_controls#{quote}).find(#{quote}input.remove_file#{quote}).val(#{quote}false#{quote}); return false;"
66
- template = [
67
- '<div class="paperclip_controls"><div>',
68
- '<a href="/system/file" target="_blank">file</a> | ',
69
- '<input name="record[delete_logo]" type="hidden" class="remove_file" id="record_delete_logo" value="false" />',
70
- %(<a href="#" onclick="#{click_js}">Remove or Replace file</a>),
71
- '</div><div style="display: none">',
72
- %(<input name="record[logo]" class="text-input" autocomplete="off" type="file" id="record_logo" onchange="#{change_js}" />),
73
- '</div></div>'
74
- ].join
75
- assert_dom_equal template, active_scaffold_input_paperclip(config.columns[:logo], :name => 'record[logo]', :id => 'record_logo', :object => @record)
64
+ click_js = "jQuery(this).prev().val('true'); jQuery(this).parent().hide().next().show(); return false;"
65
+ change_js = "jQuery(this).parents('div.paperclip_controls').find('input.remove_file').val('false'); return false;"
66
+ @document = Nokogiri::HTML::Document.parse(active_scaffold_input_paperclip(config.columns[:logo], opts))
67
+ assert_select 'div.paperclip_controls input[type=file]' do |match|
68
+ assert_equal match[0]['onchange'], change_js
69
+ end
70
+ assert_select 'div.paperclip_controls a[href="#"][onclick]' do |match|
71
+ assert_equal match[0]['onclick'], click_js
72
+ end
73
+ assert_select 'div.paperclip_controls input.remove_file[type=hidden][value=false]'
76
74
 
77
75
  @record.stubs(:logo).returns(stub(:file? => false))
78
- assert_dom_equal '<input name="record[logo]" class="text-input" autocomplete="off" type="file" id="record_logo" />', active_scaffold_input_paperclip(config.columns[:logo], :name => 'record[logo]', :id => 'record_logo', :object => @record)
76
+ assert_dom_equal '<input name="record[logo]" class="text-input" autocomplete="off" type="file" id="record_logo" />', active_scaffold_input_paperclip(config.columns[:logo], opts)
79
77
  end
80
78
  end
79
+
80
+ protected
81
+
82
+ def document_root_element
83
+ @document.root
84
+ end
81
85
  end
@@ -28,23 +28,25 @@ class TinyMceTest < ActionView::TestCase
28
28
  def test_includes
29
29
  ActiveScaffold::Bridges::TinyMce.expects(:install?).returns(true)
30
30
  with_js_framework :jquery do
31
- assert ActiveScaffold::Bridges.all_javascripts.include?('tinymce-jquery')
31
+ assert ActiveScaffold::Bridges.all_javascripts.include?('tinymce')
32
32
  end
33
33
  end
34
34
 
35
35
  def test_form_ui
36
36
  config = ActiveScaffold::Config::Core.new(:company)
37
37
  record = Company.new
38
+ opts = {name: 'record[name]', id: 'record_name', class: 'name-input', object: record}
38
39
 
39
- assert_dom_equal %(<textarea name=\"record[name]\" class=\"name-input mceEditor\" id=\"record_name\" data-tinymce=\"{&quot;theme&quot;:&quot;modern&quot;}\">\n</textarea>), active_scaffold_input_text_editor(config.columns[:name], :name => 'record[name]', :id => 'record_name', :class => 'name-input', :object => record)
40
+ assert_dom_equal %(<textarea name=\"record[name]\" class=\"name-input mceEditor\" id=\"record_name\" data-tinymce=\"{&quot;theme&quot;:&quot;modern&quot;}\">\n</textarea>), active_scaffold_input_text_editor(config.columns[:name], opts)
40
41
  end
41
42
 
42
43
  def test_form_ui_alternate
43
44
  config = ActiveScaffold::Config::Core.new(:company)
44
45
  record = Company.new
45
46
  config.columns[:name].options[:tinymce_config] = :alternate
47
+ opts = {name: 'record[name]', id: 'record_name', class: 'name-input', object: record}
46
48
 
47
- assert_dom_equal %(<textarea name=\"record[name]\" class=\"name-input mceEditor\" id=\"record_name\" data-tinymce=\"{&quot;theme&quot;:&quot;alternate&quot;,&quot;toolbar&quot;:&quot;undo redo | format&quot;}\">\n</textarea>), active_scaffold_input_tinymce(config.columns[:name], :name => 'record[name]', :id => 'record_name', :class => 'name-input', :object => record)
49
+ assert_dom_equal %(<textarea name=\"record[name]\" class=\"name-input mceEditor\" id=\"record_name\" data-tinymce=\"{&quot;theme&quot;:&quot;alternate&quot;,&quot;toolbar&quot;:&quot;undo redo | format&quot;}\">\n</textarea>), active_scaffold_input_tinymce(config.columns[:name], opts)
48
50
  end
49
51
 
50
52
  protected
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class BaseTest < MiniTest::Test
4
+ class BaseTest < Minitest::Test
5
5
  def setup
6
6
  @base = ActiveScaffold::Config::Base.new(ActiveScaffold::Config::Core.new(:model_stub))
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class CoreTest < MiniTest::Test
4
+ class CoreTest < Minitest::Test
5
5
  class ModelStubsController < ActionController::Base
6
6
  include ActiveScaffold::Core
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class CreateTest < MiniTest::Test
4
+ class CreateTest < Minitest::Test
5
5
  include ActiveScaffold::Helpers::ControllerHelpers
6
6
 
7
7
  def setup
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class DeleteTest < MiniTest::Test
4
+ class DeleteTest < Minitest::Test
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.delete.link
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class FieldSearchTest < MiniTest::Test
4
+ class FieldSearchTest < Minitest::Test
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @config.actions.swap :search, :field_search
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class ListTest < MiniTest::Test
4
+ class ListTest < Minitest::Test
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class NestedTest < MiniTest::Test
4
+ class NestedTest < Minitest::Test
5
5
  class ModelStubsController < ActionController::Base
6
6
  include ActiveScaffold::Core
7
7
  active_scaffold
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class SearchTest < MiniTest::Test
4
+ class SearchTest < Minitest::Test
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.search.link
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class ShowTest < MiniTest::Test
4
+ class ShowTest < Minitest::Test
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  @default_link = @config.show.link
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class SubformTest < MiniTest::Test
4
+ class SubformTest < Minitest::Test
5
5
  def setup
6
6
  @config = ActiveScaffold::Config::Core.new :model_stub
7
7
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  module Config
4
- class UpdateTest < MiniTest::Test
4
+ class UpdateTest < Minitest::Test
5
5
  include ActiveScaffold::Helpers::ControllerHelpers
6
6
 
7
7
  def setup
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
  # require 'test/model_stub'
3
3
  # require File.join(File.dirname(__FILE__), '../../lib/active_scaffold/data_structures/set.rb')
4
4
 
5
- class ActionColumnsTest < MiniTest::Test
5
+ class ActionColumnsTest < Minitest::Test
6
6
  def setup
7
7
  @columns = ActiveScaffold::DataStructures::ActionColumns.new(%i[a b])
8
8
  @columns.action = stub(core: stub(model_id: 'model_stub'), user_settings_key: :"model_stub_active_scaffold/config/test")
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActionLinkTest < MiniTest::Test
3
+ class ActionLinkTest < Minitest::Test
4
4
  def setup
5
5
  @link = ActiveScaffold::DataStructures::ActionLink.new('foo')
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActionLinksTest < MiniTest::Test
3
+ class ActionLinksTest < Minitest::Test
4
4
  def setup
5
5
  @links = ActiveScaffold::DataStructures::ActionLinks.new
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActionsTest < MiniTest::Test
3
+ class ActionsTest < Minitest::Test
4
4
  def setup
5
5
  @actions = ActiveScaffold::DataStructures::Actions.new(:a, 'b')
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'model_stub'
3
3
 
4
- class AssociationColumnTest < MiniTest::Test
4
+ class AssociationColumnTest < Minitest::Test
5
5
  def setup
6
6
  @association_column = ActiveScaffold::DataStructures::Column.new('other_model', ModelStub)
7
7
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ColumnTest < MiniTest::Test
3
+ class ColumnTest < Minitest::Test
4
4
  def setup
5
5
  @column = ActiveScaffold::DataStructures::Column.new(:a, ModelStub)
6
6
  @association_col = ActiveScaffold::DataStructures::Column.new(:b, ModelStub)
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ColumnsTest < MiniTest::Test
3
+ class ColumnsTest < Minitest::Test
4
4
  def setup
5
5
  @columns = ActiveScaffold::DataStructures::Columns.new(ModelStub, :a, :b)
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class SetTest < MiniTest::Test
3
+ class SetTest < Minitest::Test
4
4
  def setup
5
5
  @items = ActiveScaffold::DataStructures::Set.new(:a, :b)
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class SortingTest < MiniTest::Test
3
+ class SortingTest < Minitest::Test
4
4
  def setup
5
5
  @columns = ActiveScaffold::DataStructures::Columns.new(ModelStub, :a, :b, :c, :d, :id)
6
6
  @sorting = ActiveScaffold::DataStructures::Sorting.new(@columns, ModelStub)
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class StandardColumnTest < MiniTest::Test
3
+ class StandardColumnTest < Minitest::Test
4
4
  def setup
5
5
  @standard_column = ActiveScaffold::DataStructures::Column.new(ModelStub.columns.first.name, ModelStub)
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ValidationReflectionTest < MiniTest::Test
3
+ class ValidationReflectionTest < Minitest::Test
4
4
  def test_set_required_for_validates_presence_of
5
5
  column = ActiveScaffold::DataStructures::Column.new(:name, Company)
6
6
  refute column.required?
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class VirtualColumnTest < MiniTest::Test
3
+ class VirtualColumnTest < Minitest::Test
4
4
  def setup
5
5
  @virtual_column = ActiveScaffold::DataStructures::Column.new(:fake, ModelStub)
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ActiveRecordTest < MiniTest::Test
3
+ class ActiveRecordTest < Minitest::Test
4
4
  def setup
5
5
  @record = ModelStub.new
6
6
  end
@@ -9,23 +9,25 @@ class FormColumnHelpersTest < ActionView::TestCase
9
9
  end
10
10
 
11
11
  def test_choices_for_select_form_ui_for_simple_column
12
+ opts = {object: @record}
12
13
  @column.options[:options] = %i[value_1 value_2 value_3]
13
- assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">Value 1</option>\n<option value=\"value_2\">Value 2</option>\n<option value=\"value_3\">Value 3</option></select>", active_scaffold_input_select(@column, :object => @record)
14
+ assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">Value 1</option>\n<option value=\"value_2\">Value 2</option>\n<option value=\"value_3\">Value 3</option></select>", active_scaffold_input_select(@column, opts.dup)
14
15
 
15
16
  @column.options[:options] = %w[value_1 value_2 value_3]
16
- assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">value_1</option>\n<option value=\"value_2\">value_2</option>\n<option value=\"value_3\">value_3</option></select>", active_scaffold_input_select(@column, :object => @record)
17
+ assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">value_1</option>\n<option value=\"value_2\">value_2</option>\n<option value=\"value_3\">value_3</option></select>", active_scaffold_input_select(@column, opts.dup)
17
18
 
18
19
  @column.options[:options] = [%w[text_1 value_1], %w[text_2 value_2], %w[text_3 value_3]]
19
- assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">text_1</option>\n<option value=\"value_2\">text_2</option>\n<option value=\"value_3\">text_3</option></select>", active_scaffold_input_select(@column, :object => @record)
20
+ assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">text_1</option>\n<option value=\"value_2\">text_2</option>\n<option value=\"value_3\">text_3</option></select>", active_scaffold_input_select(@column, opts.dup)
20
21
 
21
22
  @column.options[:options] = [%i[text_1 value_1], %i[text_2 value_2], %i[text_3 value_3]]
22
- assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">Text 1</option>\n<option value=\"value_2\">Text 2</option>\n<option value=\"value_3\">Text 3</option></select>", active_scaffold_input_select(@column, :object => @record)
23
+ assert_dom_equal "<select name=\"record[a]\" id=\"record_a\"><option value=\"value_1\">Text 1</option>\n<option value=\"value_2\">Text 2</option>\n<option value=\"value_3\">Text 3</option></select>", active_scaffold_input_select(@column, opts.dup)
23
24
  end
24
25
 
25
26
  def test_options_for_select_form_ui_for_simple_column
27
+ opts = {object: @record}
26
28
  @column.options = {:include_blank => 'None', :selected => 'value_2', :disabled => %w[value_1 value_3]}
27
29
  @column.options[:options] = %w[value_1 value_2 value_3]
28
30
  @column.options[:html_options] = {:class => 'big'}
29
- assert_dom_equal "<select name=\"record[a]\" class=\"big\" id=\"record_a\"><option value=\"\">None</option>\n<option disabled=\"disabled\" value=\"value_1\">value_1</option>\n<option selected=\"selected\" value=\"value_2\">value_2</option>\n<option disabled=\"disabled\" value=\"value_3\">value_3</option></select>", active_scaffold_input_select(@column, :object => @record)
31
+ assert_dom_equal "<select name=\"record[a]\" class=\"big\" id=\"record_a\"><option value=\"\">None</option>\n<option disabled=\"disabled\" value=\"value_1\">value_1</option>\n<option selected=\"selected\" value=\"value_2\">value_2</option>\n<option disabled=\"disabled\" value=\"value_3\">value_3</option></select>", active_scaffold_input_select(@column, opts)
30
32
  end
31
33
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class PaginationHelpersTest < MiniTest::Test
3
+ class PaginationHelpersTest < Minitest::Test
4
4
  include ActiveScaffold::Helpers::PaginationHelpers
5
5
  include ActionView::Helpers::OutputSafetyHelper
6
6
 
@@ -9,6 +9,7 @@ class SearchColumnHelpersTest < ActionView::TestCase
9
9
  end
10
10
 
11
11
  def test_choices_for_boolean_search_ui
12
- assert_dom_equal "<select name=\"search[adult]\"><option value=\"\">- select -</option>\n<option value=\"true\">True</option>\n<option value=\"false\" selected=\"selected\">False</option></select>", active_scaffold_search_boolean(@column, :object => @record, :name => 'search[adult]', :value => '0')
12
+ opts = {object: @record, name: 'search[adult]', value: '0'}
13
+ assert_dom_equal "<select name=\"search[adult]\"><option value=\"\">- select -</option>\n<option value=\"true\">True</option>\n<option value=\"false\" selected=\"selected\">False</option></select>", active_scaffold_search_boolean(@column, opts)
13
14
  end
14
15
  end
@@ -81,7 +81,7 @@ class PermissionModel < ActiveRecord::Base
81
81
  # def c1_authorized_for_update?; end
82
82
  end
83
83
 
84
- class ActiveRecordPermissionsTest < MiniTest::Test
84
+ class ActiveRecordPermissionsTest < Minitest::Test
85
85
  def setup
86
86
  @model = PermissionModel.new
87
87
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class AttributeParamsTest < MiniTest::Test
3
+ class AttributeParamsTest < Minitest::Test
4
4
  def setup
5
5
  @controller = Controller.new
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
  require 'class_with_finder'
3
3
 
4
- class CalculationTest < MiniTest::Test
4
+ class CalculationTest < Minitest::Test
5
5
  def setup
6
6
  @buildings = []
7
7
  @buildings << Building.create { |b| b.build_owner(:first_name => 'foo') }
@@ -15,7 +15,7 @@ class ExtendedClass < ConfigurableClass
15
15
  extend ActiveScaffold::Configurable
16
16
  end
17
17
 
18
- class ConfigurableTest < MiniTest::Test
18
+ class ConfigurableTest < Minitest::Test
19
19
  ##
20
20
  ## constants and methods for tests to check against
21
21
  ##
@@ -17,6 +17,7 @@ module ModelStubs
17
17
  @table_name || to_s.split('::').last.underscore.pluralize
18
18
  end
19
19
  self.store_full_sti_class = false
20
+ def self.load_schema; end
20
21
  end
21
22
 
22
23
  ##
@@ -121,7 +122,7 @@ class ConstraintsTestObject
121
122
  end
122
123
  end
123
124
 
124
- class ConstraintsTest < MiniTest::Test
125
+ class ConstraintsTest < Minitest::Test
125
126
  def setup
126
127
  @test_object = ConstraintsTestObject.new
127
128
  end