active_scaffold 4.1.6 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +32 -0
  3. data/README.md +8 -6
  4. data/app/assets/javascripts/jquery/active_scaffold.js +103 -51
  5. data/app/assets/javascripts/jquery/tiny_mce_bridge.js +35 -2
  6. data/app/assets/stylesheets/active_scaffold_images.scss +6 -0
  7. data/app/assets/stylesheets/{active_scaffold_layout.css → active_scaffold_layout.scss} +104 -4
  8. data/app/assets/stylesheets/tiny_mce_bridge.scss +11 -0
  9. data/app/views/active_scaffold_overrides/_base_form.html.erb +3 -2
  10. data/app/views/active_scaffold_overrides/_field_search.html.erb +2 -2
  11. data/app/views/active_scaffold_overrides/_form.html.erb +14 -4
  12. data/app/views/active_scaffold_overrides/_form_association.html.erb +1 -1
  13. data/app/views/active_scaffold_overrides/_form_association_record.html.erb +5 -11
  14. data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
  15. data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -3
  16. data/app/views/active_scaffold_overrides/_new_record.js.erb +3 -1
  17. data/app/views/active_scaffold_overrides/_refresh_list.js.erb +1 -1
  18. data/app/views/active_scaffold_overrides/_render_field.js.erb +67 -36
  19. data/app/views/active_scaffold_overrides/_update_field_on_create.js.erb +41 -6
  20. data/app/views/active_scaffold_overrides/action_links_menu.js.erb +1 -0
  21. data/config/locales/de.yml +9 -0
  22. data/config/locales/en.yml +11 -0
  23. data/config/locales/es.yml +8 -0
  24. data/config/locales/fr.yml +8 -0
  25. data/config/locales/hu.yml +8 -0
  26. data/config/locales/ja.yml +8 -0
  27. data/config/locales/ru.yml +8 -0
  28. data/lib/active_scaffold/actions/common_search.rb +2 -0
  29. data/lib/active_scaffold/actions/core.rb +47 -23
  30. data/lib/active_scaffold/actions/create.rb +2 -0
  31. data/lib/active_scaffold/actions/delete.rb +6 -0
  32. data/lib/active_scaffold/actions/field_search.rb +36 -11
  33. data/lib/active_scaffold/actions/list.rb +26 -8
  34. data/lib/active_scaffold/actions/mark.rb +6 -0
  35. data/lib/active_scaffold/actions/nested.rb +2 -0
  36. data/lib/active_scaffold/actions/search.rb +7 -0
  37. data/lib/active_scaffold/actions/show.rb +6 -0
  38. data/lib/active_scaffold/actions/subform.rb +2 -0
  39. data/lib/active_scaffold/actions/update.rb +8 -1
  40. data/lib/active_scaffold/active_record_permissions.rb +3 -3
  41. data/lib/active_scaffold/attribute_params.rb +35 -17
  42. data/lib/active_scaffold/bridges/active_storage/active_storage_bridge.rb +2 -0
  43. data/lib/active_scaffold/bridges/active_storage/active_storage_helpers.rb +10 -9
  44. data/lib/active_scaffold/bridges/active_storage/form_ui.rb +10 -3
  45. data/lib/active_scaffold/bridges/active_storage/list_ui.rb +2 -0
  46. data/lib/active_scaffold/bridges/active_storage.rb +2 -0
  47. data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +2 -0
  48. data/lib/active_scaffold/bridges/ancestry.rb +2 -0
  49. data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +2 -0
  50. data/lib/active_scaffold/bridges/bitfields/list_ui.rb +2 -0
  51. data/lib/active_scaffold/bridges/bitfields.rb +2 -0
  52. data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +9 -6
  53. data/lib/active_scaffold/bridges/cancan.rb +2 -0
  54. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +2 -0
  55. data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge_helpers.rb +2 -0
  56. data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +3 -1
  57. data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +2 -0
  58. data/lib/active_scaffold/bridges/carrierwave.rb +2 -0
  59. data/lib/active_scaffold/bridges/chosen/helpers.rb +13 -4
  60. data/lib/active_scaffold/bridges/chosen.rb +2 -0
  61. data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +2 -0
  62. data/lib/active_scaffold/bridges/country_select.rb +2 -0
  63. data/lib/active_scaffold/bridges/date_picker/ext.rb +6 -0
  64. data/lib/active_scaffold/bridges/date_picker/helper.rb +7 -3
  65. data/lib/active_scaffold/bridges/date_picker.rb +2 -0
  66. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +2 -0
  67. data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge_helpers.rb +2 -0
  68. data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -1
  69. data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +2 -0
  70. data/lib/active_scaffold/bridges/dragonfly.rb +2 -0
  71. data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +2 -0
  72. data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +10 -9
  73. data/lib/active_scaffold/bridges/file_column/form_ui.rb +2 -0
  74. data/lib/active_scaffold/bridges/file_column/list_ui.rb +2 -0
  75. data/lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb +2 -0
  76. data/lib/active_scaffold/bridges/file_column/test/mock_model.rb +2 -0
  77. data/lib/active_scaffold/bridges/file_column.rb +2 -0
  78. data/lib/active_scaffold/bridges/logical_query_parser/tokens_grammar.rb +65 -0
  79. data/lib/active_scaffold/bridges/logical_query_parser/tokens_grammar.treetop +31 -0
  80. data/lib/active_scaffold/bridges/logical_query_parser.rb +9 -0
  81. data/lib/active_scaffold/bridges/paper_trail/actions.rb +2 -0
  82. data/lib/active_scaffold/bridges/paper_trail/config.rb +2 -0
  83. data/lib/active_scaffold/bridges/paper_trail/helper.rb +2 -0
  84. data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +2 -0
  85. data/lib/active_scaffold/bridges/paper_trail.rb +2 -0
  86. data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -1
  87. data/lib/active_scaffold/bridges/paperclip/list_ui.rb +2 -0
  88. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +2 -0
  89. data/lib/active_scaffold/bridges/paperclip/paperclip_bridge_helpers.rb +12 -12
  90. data/lib/active_scaffold/bridges/paperclip.rb +2 -0
  91. data/lib/active_scaffold/bridges/record_select/helpers.rb +19 -11
  92. data/lib/active_scaffold/bridges/record_select.rb +2 -0
  93. data/lib/active_scaffold/bridges/semantic_attributes/column.rb +2 -0
  94. data/lib/active_scaffold/bridges/semantic_attributes.rb +2 -0
  95. data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +3 -1
  96. data/lib/active_scaffold/bridges/tiny_mce.rb +6 -0
  97. data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +2 -0
  98. data/lib/active_scaffold/bridges/usa_state_select.rb +2 -0
  99. data/lib/active_scaffold/bridges.rb +2 -0
  100. data/lib/active_scaffold/config/base.rb +12 -7
  101. data/lib/active_scaffold/config/core.rb +26 -23
  102. data/lib/active_scaffold/config/create.rb +2 -0
  103. data/lib/active_scaffold/config/delete.rb +2 -0
  104. data/lib/active_scaffold/config/field_search.rb +2 -0
  105. data/lib/active_scaffold/config/form.rb +11 -1
  106. data/lib/active_scaffold/config/list.rb +7 -7
  107. data/lib/active_scaffold/config/mark.rb +2 -0
  108. data/lib/active_scaffold/config/nested.rb +28 -0
  109. data/lib/active_scaffold/config/search.rb +2 -0
  110. data/lib/active_scaffold/config/show.rb +2 -0
  111. data/lib/active_scaffold/config/subform.rb +2 -0
  112. data/lib/active_scaffold/config/update.rb +3 -1
  113. data/lib/active_scaffold/configurable.rb +4 -2
  114. data/lib/active_scaffold/constraints.rb +2 -0
  115. data/lib/active_scaffold/core.rb +14 -4
  116. data/lib/active_scaffold/data_structures/action_columns.rb +3 -1
  117. data/lib/active_scaffold/data_structures/action_link.rb +10 -0
  118. data/lib/active_scaffold/data_structures/action_link_separator.rb +2 -0
  119. data/lib/active_scaffold/data_structures/action_links.rb +32 -21
  120. data/lib/active_scaffold/data_structures/actions.rb +4 -2
  121. data/lib/active_scaffold/data_structures/association/abstract.rb +4 -2
  122. data/lib/active_scaffold/data_structures/association/active_mongoid.rb +4 -2
  123. data/lib/active_scaffold/data_structures/association/active_record.rb +3 -9
  124. data/lib/active_scaffold/data_structures/association/mongoid.rb +4 -2
  125. data/lib/active_scaffold/data_structures/association.rb +2 -0
  126. data/lib/active_scaffold/data_structures/bridge.rb +3 -1
  127. data/lib/active_scaffold/data_structures/column.rb +37 -3
  128. data/lib/active_scaffold/data_structures/columns.rb +4 -2
  129. data/lib/active_scaffold/data_structures/filter.rb +3 -3
  130. data/lib/active_scaffold/data_structures/filter_option.rb +2 -0
  131. data/lib/active_scaffold/data_structures/filters.rb +3 -3
  132. data/lib/active_scaffold/data_structures/nested_info.rb +4 -2
  133. data/lib/active_scaffold/data_structures/set.rb +8 -10
  134. data/lib/active_scaffold/data_structures/sorting.rb +5 -7
  135. data/lib/active_scaffold/engine.rb +3 -4
  136. data/lib/active_scaffold/extensions/action_controller_rendering.rb +2 -0
  137. data/lib/active_scaffold/extensions/action_controller_rescueing.rb +2 -0
  138. data/lib/active_scaffold/extensions/action_view_rendering.rb +2 -0
  139. data/lib/active_scaffold/extensions/connection_adapter.rb +2 -0
  140. data/lib/active_scaffold/extensions/ice_nine.rb +2 -0
  141. data/lib/active_scaffold/extensions/localize.rb +2 -0
  142. data/lib/active_scaffold/extensions/name_option_for_datetime.rb +2 -0
  143. data/lib/active_scaffold/extensions/paginator_extensions.rb +3 -1
  144. data/lib/active_scaffold/extensions/routing_mapper.rb +2 -0
  145. data/lib/active_scaffold/extensions/to_label.rb +2 -0
  146. data/lib/active_scaffold/extensions/unsaved_associated.rb +10 -8
  147. data/lib/active_scaffold/extensions/unsaved_record.rb +2 -0
  148. data/lib/active_scaffold/finder.rb +57 -18
  149. data/lib/active_scaffold/helpers/action_link_helpers.rb +112 -37
  150. data/lib/active_scaffold/helpers/association_helpers.rb +4 -2
  151. data/lib/active_scaffold/helpers/controller_helpers.rb +2 -0
  152. data/lib/active_scaffold/helpers/filter_helpers.rb +11 -3
  153. data/lib/active_scaffold/helpers/form_column_helpers.rb +145 -110
  154. data/lib/active_scaffold/helpers/human_condition_helpers.rb +2 -0
  155. data/lib/active_scaffold/helpers/id_helpers.rb +2 -0
  156. data/lib/active_scaffold/helpers/list_column_helpers.rb +9 -5
  157. data/lib/active_scaffold/helpers/pagination_helpers.rb +3 -1
  158. data/lib/active_scaffold/helpers/search_column_helpers.rb +19 -9
  159. data/lib/active_scaffold/helpers/show_column_helpers.rb +4 -2
  160. data/lib/active_scaffold/helpers/tabs_helpers.rb +5 -3
  161. data/lib/active_scaffold/helpers/view_helpers.rb +3 -3
  162. data/lib/active_scaffold/marked_model.rb +6 -5
  163. data/lib/active_scaffold/orm_checks.rb +2 -0
  164. data/lib/active_scaffold/paginator.rb +4 -1
  165. data/lib/active_scaffold/registry.rb +2 -0
  166. data/lib/active_scaffold/responds_to_parent.rb +2 -0
  167. data/lib/active_scaffold/tableless.rb +23 -13
  168. data/lib/active_scaffold/version.rb +4 -2
  169. data/lib/active_scaffold.rb +10 -2
  170. data/lib/generators/active_scaffold/controller/USAGE +19 -0
  171. data/lib/generators/active_scaffold/controller/controller_generator.rb +29 -0
  172. data/lib/generators/active_scaffold/install/USAGE +2 -0
  173. data/lib/generators/active_scaffold/{install_generator.rb → install/install_generator.rb} +10 -6
  174. data/lib/generators/active_scaffold/resource/USAGE +29 -0
  175. data/lib/generators/active_scaffold/resource/resource_generator.rb +30 -0
  176. data/lib/tasks/brakeman.rake +2 -0
  177. data/shoulda_macros/macros.rb +2 -0
  178. metadata +19 -11
  179. data/lib/generators/active_scaffold/controller_generator.rb +0 -49
  180. data/lib/generators/active_scaffold/resource_generator.rb +0 -56
  181. /data/lib/generators/{templates → active_scaffold/controller/templates}/controller.rb +0 -0
  182. /data/lib/generators/{templates → active_scaffold/controller/templates}/helper.rb +0 -0
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'forwardable'
2
4
 
3
5
  class Paginator
4
- VERSION = '1.0.9'.freeze
6
+ VERSION = '1.0.9'
5
7
 
6
8
  class ArgumentError < ::ArgumentError; end
7
9
  class MissingCountError < ArgumentError; end
@@ -72,6 +74,7 @@ class Paginator
72
74
  # of the page in the paginator
73
75
  class Page
74
76
  extend Forwardable
77
+
75
78
  def_delegator :@pager, :first, :first
76
79
  def_delegator :@pager, :last, :last
77
80
  def_delegator :items, :each
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveScaffold
2
4
  class Registry
3
5
  thread_mattr_accessor :current_user_proc, :current_ability_proc, :marked_records
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveScaffold
2
4
  # Module containing the methods useful for child IFRAME to parent window communication
3
5
  module RespondsToParent
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
2
4
  class Connection < ActiveRecord::ConnectionAdapters::AbstractAdapter
3
5
  attr_reader :klass
4
6
 
5
- def initialize(klass, *args)
6
- super(nil, *args)
7
+ def initialize(klass, *)
8
+ super(nil, *)
7
9
  @klass = klass
8
10
  end
9
11
 
@@ -21,9 +23,19 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
21
23
  end
22
24
 
23
25
  class Column < ActiveRecord::ConnectionAdapters::Column
24
- def initialize(name, default, sql_type = nil, null = true, **) # rubocop:disable Style/OptionalBooleanParameter
25
- metadata = ActiveRecord::Base.connection.send :fetch_type_metadata, sql_type
26
- super(name, default, metadata, null)
26
+ def initialize(name, default, type, null = true, *, **) # rubocop:disable Style/OptionalBooleanParameter,Metrics/ParameterLists
27
+ if Rails.version >= '8.1'
28
+ if type.is_a?(Symbol)
29
+ cast_type = ActiveRecord::Type.lookup(type)
30
+ else
31
+ metadata = ActiveRecord::Base.connection.send :fetch_type_metadata, type
32
+ cast_type = ActiveRecord::Type.lookup(metadata.type)
33
+ end
34
+ super(name, cast_type, default, metadata, null, *, **)
35
+ else
36
+ metadata = ActiveRecord::Base.connection.send :fetch_type_metadata, type.to_s
37
+ super(name, default, metadata, null, *, **)
38
+ end
27
39
  end
28
40
  end
29
41
 
@@ -121,16 +133,14 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
121
133
  end
122
134
 
123
135
  def find_one(id)
124
- @klass.find_one(id, self) || raise(ActiveRecord::RecordNotFound)
136
+ model.find_one(id, self) || raise(ActiveRecord::RecordNotFound)
125
137
  end
126
138
 
127
139
  def execute_simple_calculation(operation, column_name, distinct)
128
- @klass.execute_simple_calculation(self, operation, column_name, distinct)
140
+ model.execute_simple_calculation(self, operation, column_name, distinct)
129
141
  end
130
142
 
131
- def implicit_order_column
132
- @klass.implicit_order_column
133
- end
143
+ delegate :implicit_order_column, to: :model
134
144
 
135
145
  def exists?
136
146
  size.positive?
@@ -139,7 +149,7 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
139
149
  private
140
150
 
141
151
  def exec_queries
142
- @records = @klass.find_all(self)
152
+ @records = model.find_all(self)
143
153
  @loaded = true
144
154
  @records
145
155
  end
@@ -195,8 +205,8 @@ class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/App
195
205
  @connection ||= Connection.new(self)
196
206
  end
197
207
 
198
- def self.column(name, sql_type = nil, options = {})
199
- column = Column.new(name.to_s, options[:default], sql_type.to_s, options.key?(:null) ? options[:null] : true)
208
+ def self.column(name, sql_type, options = {})
209
+ column = Column.new(name.to_s, options[:default], sql_type, options.key?(:null) ? options[:null] : true)
200
210
  column.tap { columns << column }
201
211
  end
202
212
 
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveScaffold
2
4
  module Version
3
5
  MAJOR = 4
4
- MINOR = 1
5
- PATCH = 6
6
+ MINOR = 2
7
+ PATCH = 1
6
8
  FIX = nil
7
9
 
8
10
  STRING = [MAJOR, MINOR, PATCH, FIX].compact.join('.')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveScaffold
2
4
  autoload :ActiveRecordPermissions, 'active_scaffold/active_record_permissions'
3
5
  autoload :AttributeParams, 'active_scaffold/attribute_params'
@@ -77,7 +79,7 @@ module ActiveScaffold
77
79
  mattr_accessor :nested_subforms, instance_writer: false
78
80
 
79
81
  def self.root
80
- "#{File.dirname(__FILE__)}/.."
82
+ File.expand_path '..', __dir__
81
83
  end
82
84
 
83
85
  def self.defaults(&)
@@ -85,7 +87,13 @@ module ActiveScaffold
85
87
  end
86
88
 
87
89
  def self.deprecator
88
- @deprecator ||= ActiveSupport::Deprecation.new('4.2', 'ActiveScaffold')
90
+ @deprecator ||= ActiveSupport::Deprecation.new('4.3', 'ActiveScaffold')
91
+ end
92
+
93
+ def self.log_exception(exception, message)
94
+ line = exception.backtrace.find { |l| l.start_with? Rails.root.to_s }
95
+ line ||= exception.backtrace.find { |l| l.start_with? ActiveScaffold.root }
96
+ Rails.logger.error "#{exception.class.name}: #{exception.message} -- #{message}\n#{Rails.backtrace_cleaner.clean_frame(line) || line}"
89
97
  end
90
98
  end
91
99
  require 'active_scaffold/engine'
@@ -0,0 +1,19 @@
1
+ Description:
2
+ Stubs out a active_scaffolded controller. Pass the model name,
3
+ either CamelCased or under_scored.
4
+ The controller name is retrieved as a pluralized version of the model
5
+ name.
6
+
7
+ To create a controller within a module, specify the model name as a
8
+ path like 'parent_module/controller_name'.
9
+
10
+ This generates a controller class in app/controllers and invokes helper,
11
+ template engine and test framework generators.
12
+
13
+ Example:
14
+ `rails generate active_scaffold:controller CreditCard`
15
+
16
+ Credit card controller with URLs like /credit_card/debit.
17
+ Controller: app/controllers/credit_cards_controller.rb
18
+ Functional Test: test/functional/credit_cards_controller_test.rb
19
+ Helper: app/helpers/credit_cards_helper.rb
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
4
+
5
+ module ActiveScaffold
6
+ module Generators
7
+ class ControllerGenerator < Rails::Generators::NamedBase
8
+ include Rails::Generators::ResourceHelpers
9
+
10
+ source_root File.expand_path('templates', __dir__)
11
+
12
+ check_class_collision suffix: 'Controller'
13
+
14
+ class_option :orm, banner: 'NAME', type: :string, required: true,
15
+ desc: 'ORM to generate the controller for'
16
+
17
+ def create_controller_files
18
+ template 'controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
19
+ template 'helper.rb', File.join('app/helpers', class_path, "#{controller_file_name}_helper.rb")
20
+ end
21
+
22
+ hook_for :test_framework, as: :scaffold
23
+
24
+ def create_view_root_folder
25
+ empty_directory File.join('app/views', controller_file_path)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,2 @@
1
+ Description:
2
+ Add concerns to routes and require lines to assets manifest files
@@ -1,20 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators/base'
2
4
  # require 'generators/active_scaffold_controller/active_scaffold_controller_generator'
3
5
 
4
6
  module ActiveScaffold
5
7
  module Generators
6
8
  class InstallGenerator < Rails::Generators::Base
7
- desc 'Add concerns to routes and require lines to assets manifest files'
9
+ def self.base_root
10
+ File.expand_path '../..', __dir__
11
+ end
8
12
 
9
13
  def add_concern_routes
10
14
  route 'concern :active_scaffold, ActiveScaffold::Routing::Basic.new(association: true)'
11
15
  route 'concern :active_scaffold_association, ActiveScaffold::Routing::Association.new'
12
16
  end
13
17
 
14
- IMPORTMAP = 'config/importmap.rb'.freeze
15
- JS_ASSET = 'app/assets/javascripts/application.js'.freeze
16
- JS_APP = 'app/javascript/application.js'.freeze
17
- MANIFEST = 'app/assets/config/manifest.js'.freeze
18
+ IMPORTMAP = 'config/importmap.rb'
19
+ JS_ASSET = 'app/assets/javascripts/application.js'
20
+ JS_APP = 'app/javascript/application.js'
21
+ MANIFEST = 'app/assets/config/manifest.js'
18
22
 
19
23
  def add_javascript
20
24
  if File.exist?(IMPORTMAP)
@@ -44,7 +48,7 @@ module ActiveScaffold
44
48
  if original_css.match?(/require active_scaffold$/)
45
49
  say_status('skipped', 'insert into app/assets/stylesheets/application.css', :yellow)
46
50
  else
47
- insert_into_file 'app/assets/stylesheets/application.css', before: %r{[ ]*\*/} do
51
+ insert_into_file 'app/assets/stylesheets/application.css', before: %r{ *\*/} do
48
52
  " *= require active_scaffold\n"
49
53
  end
50
54
  end
@@ -0,0 +1,29 @@
1
+ Description:
2
+ Scaffolds an entire resource, from model and migration to controller,
3
+ along with a full test suite and configured to use active_scaffold.
4
+ The resource is ready to use as a starting point for your RESTful,
5
+ resource-oriented application.
6
+
7
+ Pass the name of the model (in singular form), either CamelCased or
8
+ under_scored, as the first argument, and an optional list of attribute
9
+ pairs.
10
+
11
+ Attribute pairs are field:type arguments specifying the
12
+ model's attributes. Timestamps are added by default, so you don't have to
13
+ specify them by hand as 'created_at:datetime updated_at:datetime'.
14
+
15
+ You don't have to think up every attribute up front, but it helps to
16
+ sketch out a few so you can start working with the resource immediately.
17
+
18
+ For example, 'active_scaffold post title:string body:text published:boolean'
19
+ gives you a model with those three attributes, a controller configured to use active_scaffold,
20
+ as well as a resources :posts with additional active_scaffold routes
21
+ declaration in config/routes.rb.
22
+
23
+ If you want to remove all the generated files, run
24
+ 'rails destroy active_scaffold ModelName'.
25
+
26
+ Examples:
27
+ `rails generate active_scaffold:resource post`
28
+ `rails generate active_scaffold:resource post title:string body:text published:boolean`
29
+ `rails generate active_scaffold:resource purchase order_id:integer amount:decimal`
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/rails/resource/resource_generator'
4
+ # require 'generators/active_scaffold_controller/active_scaffold_controller_generator'
5
+
6
+ module ActiveScaffold
7
+ module Generators
8
+ class ResourceGenerator < Rails::Generators::ResourceGenerator
9
+ def self.base_root
10
+ File.expand_path '../..', __dir__
11
+ end
12
+
13
+ remove_hook_for :resource_controller
14
+ remove_hook_for :resource_route
15
+ remove_class_option :actions
16
+
17
+ def add_resource_route
18
+ routing_code = class_path.collect { |namespace| "namespace :#{namespace} do " }.join(' ')
19
+ routing_code << "resources :#{file_name.pluralize}, concerns: :active_scaffold"
20
+ routing_code << (' end' * class_path.size)
21
+ log :route, routing_code
22
+ in_root do
23
+ inject_into_file 'config/routes.rb', " #{routing_code}\n", after: /^ *concern :active_scaffold,.*\n/, verbose: false, force: true
24
+ end
25
+ end
26
+
27
+ invoke 'active_scaffold:controller'
28
+ end
29
+ end
30
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  namespace :brakeman do
2
4
  desc 'Run Brakeman'
3
5
  task :run, :output_files do |_t, args|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ActiveSupport::TestCase
2
4
  def self.should_have_columns_in(action, *columns)
3
5
  should "have #{columns.to_sentence} columns in #{action}" do
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: 4.1.6
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Many, see README
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-02 00:00:00.000000000 Z
11
+ date: 2026-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dartsass-sprockets
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 7.0.0
47
+ version: 7.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 7.0.0
54
+ version: 7.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: request_store
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -106,8 +106,9 @@ files:
106
106
  - app/assets/stylesheets/active_scaffold_extensions.css.erb
107
107
  - app/assets/stylesheets/active_scaffold_images.scss
108
108
  - app/assets/stylesheets/active_scaffold_jquery_ui.css.erb
109
- - app/assets/stylesheets/active_scaffold_layout.css
109
+ - app/assets/stylesheets/active_scaffold_layout.scss
110
110
  - app/assets/stylesheets/blue-theme.css
111
+ - app/assets/stylesheets/tiny_mce_bridge.scss
111
112
  - app/views/active_scaffold_overrides/_add_existing_form.html.erb
112
113
  - app/views/active_scaffold_overrides/_base_form.html.erb
113
114
  - app/views/active_scaffold_overrides/_create_form.html.erb
@@ -158,6 +159,7 @@ files:
158
159
  - app/views/active_scaffold_overrides/_update_messages.js.erb
159
160
  - app/views/active_scaffold_overrides/_vertical_subform.html.erb
160
161
  - app/views/active_scaffold_overrides/action_confirmation.html.erb
162
+ - app/views/active_scaffold_overrides/action_links_menu.js.erb
161
163
  - app/views/active_scaffold_overrides/add_existing.js.erb
162
164
  - app/views/active_scaffold_overrides/add_existing_form.html.erb
163
165
  - app/views/active_scaffold_overrides/add_tab.js.erb
@@ -239,6 +241,9 @@ files:
239
241
  - lib/active_scaffold/bridges/file_column/list_ui.rb
240
242
  - lib/active_scaffold/bridges/file_column/test/functional/file_column_keep_test.rb
241
243
  - lib/active_scaffold/bridges/file_column/test/mock_model.rb
244
+ - lib/active_scaffold/bridges/logical_query_parser.rb
245
+ - lib/active_scaffold/bridges/logical_query_parser/tokens_grammar.rb
246
+ - lib/active_scaffold/bridges/logical_query_parser/tokens_grammar.treetop
242
247
  - lib/active_scaffold/bridges/paper_trail.rb
243
248
  - lib/active_scaffold/bridges/paper_trail/actions.rb
244
249
  - lib/active_scaffold/bridges/paper_trail/config.rb
@@ -327,11 +332,14 @@ files:
327
332
  - lib/active_scaffold/responds_to_parent.rb
328
333
  - lib/active_scaffold/tableless.rb
329
334
  - lib/active_scaffold/version.rb
330
- - lib/generators/active_scaffold/controller_generator.rb
331
- - lib/generators/active_scaffold/install_generator.rb
332
- - lib/generators/active_scaffold/resource_generator.rb
333
- - lib/generators/templates/controller.rb
334
- - lib/generators/templates/helper.rb
335
+ - lib/generators/active_scaffold/controller/USAGE
336
+ - lib/generators/active_scaffold/controller/controller_generator.rb
337
+ - lib/generators/active_scaffold/controller/templates/controller.rb
338
+ - lib/generators/active_scaffold/controller/templates/helper.rb
339
+ - lib/generators/active_scaffold/install/USAGE
340
+ - lib/generators/active_scaffold/install/install_generator.rb
341
+ - lib/generators/active_scaffold/resource/USAGE
342
+ - lib/generators/active_scaffold/resource/resource_generator.rb
335
343
  - lib/tasks/brakeman.rake
336
344
  - public/blank.html
337
345
  - shoulda_macros/macros.rb
@@ -368,7 +376,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
368
376
  requirements:
369
377
  - - ">="
370
378
  - !ruby/object:Gem::Version
371
- version: '3.1'
379
+ version: '3.2'
372
380
  required_rubygems_version: !ruby/object:Gem::Requirement
373
381
  requirements:
374
382
  - - ">="
@@ -1,49 +0,0 @@
1
- # require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
2
-
3
- module ActiveScaffold
4
- module Generators
5
- class ControllerGenerator < Rails::Generators::NamedBase
6
- include Rails::Generators::ResourceHelpers
7
-
8
- source_root File.expand_path('../templates', __dir__)
9
-
10
- check_class_collision suffix: 'Controller'
11
-
12
- class_option :orm, banner: 'NAME', type: :string, required: true,
13
- desc: 'ORM to generate the controller for'
14
-
15
- desc <<~DESC
16
- Description:
17
- Stubs out a active_scaffolded controller. Pass the model name,
18
- either CamelCased or under_scored.
19
- The controller name is retrieved as a pluralized version of the model
20
- name.
21
-
22
- To create a controller within a module, specify the model name as a
23
- path like 'parent_module/controller_name'.
24
-
25
- This generates a controller class in app/controllers and invokes helper,
26
- template engine and test framework generators.
27
-
28
- Example:
29
- `rails generate active_scaffold:controller CreditCard`
30
-
31
- Credit card controller with URLs like /credit_card/debit.
32
- Controller: app/controllers/credit_cards_controller.rb
33
- Functional Test: test/functional/credit_cards_controller_test.rb
34
- Helper: app/helpers/credit_cards_helper.rb
35
- DESC
36
-
37
- def create_controller_files
38
- template 'controller.rb', File.join('app/controllers', class_path, "#{controller_file_name}_controller.rb")
39
- template 'helper.rb', File.join('app/helpers', class_path, "#{controller_file_name}_helper.rb")
40
- end
41
-
42
- hook_for :test_framework, as: :scaffold
43
-
44
- def create_view_root_folder
45
- empty_directory File.join('app/views', controller_file_path)
46
- end
47
- end
48
- end
49
- end
@@ -1,56 +0,0 @@
1
- require 'rails/generators/rails/resource/resource_generator'
2
- # require 'generators/active_scaffold_controller/active_scaffold_controller_generator'
3
-
4
- module ActiveScaffold
5
- module Generators
6
- class ResourceGenerator < Rails::Generators::ResourceGenerator
7
- remove_hook_for :resource_controller
8
- remove_hook_for :resource_route
9
- remove_class_option :actions
10
-
11
- desc <<~DESC
12
- Description:
13
- Scaffolds an entire resource, from model and migration to controller,
14
- along with a full test suite and configured to use active_scaffold.
15
- The resource is ready to use as a starting point for your RESTful,
16
- resource-oriented application.
17
-
18
- Pass the name of the model (in singular form), either CamelCased or
19
- under_scored, as the first argument, and an optional list of attribute
20
- pairs.
21
-
22
- Attribute pairs are field:type arguments specifying the
23
- model's attributes. Timestamps are added by default, so you don't have to
24
- specify them by hand as 'created_at:datetime updated_at:datetime'.
25
-
26
- You don't have to think up every attribute up front, but it helps to
27
- sketch out a few so you can start working with the resource immediately.
28
-
29
- For example, 'active_scaffold post title:string body:text published:boolean'
30
- gives you a model with those three attributes, a controller configured to use active_scaffold,
31
- as well as a resources :posts with additional active_scaffold routes
32
- declaration in config/routes.rb.
33
-
34
- If you want to remove all the generated files, run
35
- 'rails destroy active_scaffold ModelName'.
36
-
37
- Examples:
38
- `rails generate active_scaffold:resource post`
39
- `rails generate active_scaffold:resource post title:string body:text published:boolean`
40
- `rails generate active_scaffold:resource purchase order_id:integer amount:decimal`
41
- DESC
42
-
43
- def add_resource_route
44
- routing_code = class_path.collect { |namespace| "namespace :#{namespace} do " }.join(' ')
45
- routing_code << "resources :#{file_name.pluralize}, concerns: :active_scaffold"
46
- routing_code << (' end' * class_path.size)
47
- log :route, routing_code
48
- in_root do
49
- inject_into_file 'config/routes.rb', " #{routing_code}\n", after: /^[ ]*concern :active_scaffold,.*\n/, verbose: false, force: true
50
- end
51
- end
52
-
53
- invoke 'active_scaffold:controller'
54
- end
55
- end
56
- end