active_scaffold 3.4.43 → 3.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +39 -0
- data/{LICENSE → LICENSE.md} +1 -1
- data/README.md +27 -19
- data/app/assets/javascripts/active_scaffold.js.erb +1 -1
- data/app/assets/javascripts/jquery/active_scaffold.js +95 -43
- data/app/assets/javascripts/jquery/tiny_mce_bridge.js +30 -6
- data/app/assets/javascripts/prototype/tiny_mce_bridge.js +11 -1
- data/app/assets/stylesheets/active_scaffold_colors.scss +2 -2
- data/app/assets/stylesheets/active_scaffold_layout.css +36 -28
- data/app/views/active_scaffold_overrides/_base_form.html.erb +2 -3
- data/app/views/active_scaffold_overrides/_field_search.html.erb +8 -7
- data/app/views/active_scaffold_overrides/_form_association.html.erb +9 -9
- data/app/views/active_scaffold_overrides/_form_association_footer.html.erb +6 -6
- data/app/views/active_scaffold_overrides/_form_association_record.html.erb +52 -50
- data/app/views/active_scaffold_overrides/_horizontal_subform.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_horizontal_subform_header.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_human_conditions.html.erb +3 -1
- data/app/views/active_scaffold_overrides/_list_calculations.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_list_column_headings.html.erb +2 -0
- data/app/views/active_scaffold_overrides/_list_messages.html.erb +5 -3
- data/app/views/active_scaffold_overrides/_list_record.html.erb +3 -1
- data/app/views/active_scaffold_overrides/_list_with_header.html.erb +9 -9
- data/app/views/active_scaffold_overrides/_messages.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_refresh_list.js.erb +18 -10
- data/app/views/active_scaffold_overrides/_render_field.js.erb +3 -3
- data/app/views/active_scaffold_overrides/_search.html.erb +7 -6
- data/app/views/active_scaffold_overrides/_show_actions.html.erb +14 -0
- data/app/views/active_scaffold_overrides/_show_association.html.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_actions.html.erb +6 -2
- data/app/views/active_scaffold_overrides/_update_column.js.erb +1 -1
- data/app/views/active_scaffold_overrides/_update_form.html.erb +1 -1
- data/app/views/active_scaffold_overrides/destroy.js.erb +2 -3
- data/app/views/active_scaffold_overrides/edit_associated.js.erb +4 -3
- data/app/views/active_scaffold_overrides/on_action_update.js.erb +5 -3
- data/app/views/active_scaffold_overrides/on_create.js.erb +4 -4
- data/app/views/active_scaffold_overrides/on_update.js.erb +6 -6
- data/app/views/active_scaffold_overrides/show.html.erb +6 -0
- data/app/views/active_scaffold_overrides/update.html.erb +1 -1
- data/app/views/active_scaffold_overrides/update_column.js.erb +1 -1
- data/config/brakeman.ignore +26 -0
- data/config/brakeman.yml +3 -0
- data/config/i18n-tasks.yml +121 -0
- data/config/locales/de.yml +81 -70
- data/config/locales/en.yml +83 -74
- data/config/locales/es.yml +82 -73
- data/config/locales/fr.yml +86 -75
- data/config/locales/hu.yml +81 -70
- data/config/locales/ja.yml +71 -60
- data/config/locales/ru.yml +85 -74
- data/lib/active_scaffold.rb +3 -0
- data/lib/active_scaffold/actions/common_search.rb +11 -7
- data/lib/active_scaffold/actions/core.rb +119 -47
- data/lib/active_scaffold/actions/create.rb +1 -1
- data/lib/active_scaffold/actions/delete.rb +11 -8
- data/lib/active_scaffold/actions/field_search.rb +104 -6
- data/lib/active_scaffold/actions/list.rb +25 -21
- data/lib/active_scaffold/actions/mark.rb +12 -4
- data/lib/active_scaffold/actions/nested.rb +26 -26
- data/lib/active_scaffold/actions/search.rb +2 -2
- data/lib/active_scaffold/actions/show.rb +4 -5
- data/lib/active_scaffold/actions/subform.rb +9 -7
- data/lib/active_scaffold/actions/update.rb +20 -13
- data/lib/active_scaffold/active_record_permissions.rb +24 -5
- data/lib/active_scaffold/attribute_params.rb +68 -49
- data/lib/active_scaffold/bridges.rb +1 -1
- data/lib/active_scaffold/bridges/ancestry/ancestry_bridge.rb +15 -19
- data/lib/active_scaffold/bridges/bitfields.rb +1 -1
- data/lib/active_scaffold/bridges/bitfields/bitfields_bridge.rb +10 -14
- data/lib/active_scaffold/bridges/calendar_date_select.rb +0 -7
- data/lib/active_scaffold/bridges/calendar_date_select/as_cds_bridge.rb +19 -22
- data/lib/active_scaffold/bridges/cancan.rb +4 -3
- data/lib/active_scaffold/bridges/cancan/cancan_bridge.rb +11 -21
- data/lib/active_scaffold/bridges/carrierwave.rb +2 -1
- data/lib/active_scaffold/bridges/carrierwave/carrierwave_bridge.rb +2 -6
- data/lib/active_scaffold/bridges/carrierwave/form_ui.rb +6 -39
- data/lib/active_scaffold/bridges/carrierwave/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/chosen.rb +4 -1
- data/lib/active_scaffold/bridges/chosen/helpers.rb +3 -2
- data/lib/active_scaffold/bridges/country_select/country_select_bridge_helper.rb +2 -2
- data/lib/active_scaffold/bridges/date_picker.rb +3 -0
- data/lib/active_scaffold/bridges/date_picker/ext.rb +43 -38
- data/lib/active_scaffold/bridges/date_picker/helper.rb +24 -23
- data/lib/active_scaffold/bridges/dragonfly.rb +1 -1
- data/lib/active_scaffold/bridges/dragonfly/dragonfly_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/dragonfly/form_ui.rb +3 -25
- data/lib/active_scaffold/bridges/dragonfly/list_ui.rb +2 -2
- data/lib/active_scaffold/bridges/file_column/as_file_column_bridge.rb +6 -8
- data/lib/active_scaffold/bridges/file_column/file_column_helpers.rb +1 -1
- data/lib/active_scaffold/bridges/file_column/form_ui.rb +0 -2
- data/lib/active_scaffold/bridges/file_column/list_ui.rb +2 -1
- data/lib/active_scaffold/bridges/file_column/test/test_helper.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/actions.rb +1 -1
- data/lib/active_scaffold/bridges/paper_trail/helper.rb +1 -2
- data/lib/active_scaffold/bridges/paper_trail/paper_trail_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/paperclip.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/form_ui.rb +3 -28
- data/lib/active_scaffold/bridges/paperclip/list_ui.rb +1 -1
- data/lib/active_scaffold/bridges/paperclip/paperclip_bridge.rb +3 -7
- data/lib/active_scaffold/bridges/record_select.rb +2 -0
- data/lib/active_scaffold/bridges/record_select/helpers.rb +14 -18
- data/lib/active_scaffold/bridges/semantic_attributes/column.rb +4 -8
- data/lib/active_scaffold/bridges/shared/date_bridge.rb +20 -20
- data/lib/active_scaffold/bridges/tiny_mce/helpers.rb +7 -22
- data/lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb +14 -14
- data/lib/active_scaffold/config/base.rb +9 -6
- data/lib/active_scaffold/config/core.rb +30 -21
- data/lib/active_scaffold/config/create.rb +2 -1
- data/lib/active_scaffold/config/delete.rb +2 -2
- data/lib/active_scaffold/config/field_search.rb +9 -3
- data/lib/active_scaffold/config/form.rb +4 -4
- data/lib/active_scaffold/config/list.rb +27 -23
- data/lib/active_scaffold/config/nested.rb +4 -4
- data/lib/active_scaffold/config/search.rb +6 -6
- data/lib/active_scaffold/config/show.rb +11 -1
- data/lib/active_scaffold/config/subform.rb +1 -1
- data/lib/active_scaffold/config/update.rb +4 -2
- data/lib/active_scaffold/constraints.rb +39 -36
- data/lib/active_scaffold/core.rb +36 -15
- data/lib/active_scaffold/data_structures/action_columns.rb +14 -9
- data/lib/active_scaffold/data_structures/action_link.rb +4 -5
- data/lib/active_scaffold/data_structures/action_links.rb +5 -4
- data/lib/active_scaffold/data_structures/actions.rb +2 -2
- data/lib/active_scaffold/data_structures/association.rb +8 -0
- data/lib/active_scaffold/data_structures/association/abstract.rb +147 -0
- data/lib/active_scaffold/data_structures/association/active_mongoid.rb +42 -0
- data/lib/active_scaffold/data_structures/association/active_record.rb +94 -0
- data/lib/active_scaffold/data_structures/association/mongoid.rb +45 -0
- data/lib/active_scaffold/data_structures/bridge.rb +3 -6
- data/lib/active_scaffold/data_structures/column.rb +100 -82
- data/lib/active_scaffold/data_structures/columns.rb +21 -3
- data/lib/active_scaffold/data_structures/nested_info.rb +22 -37
- data/lib/active_scaffold/data_structures/set.rb +4 -4
- data/lib/active_scaffold/data_structures/sorting.rb +29 -15
- data/lib/active_scaffold/engine.rb +3 -1
- data/lib/active_scaffold/extensions/action_controller_rendering.rb +10 -5
- data/lib/active_scaffold/extensions/action_view_rendering.rb +65 -59
- data/lib/active_scaffold/extensions/left_outer_joins.rb +48 -53
- data/lib/active_scaffold/extensions/localize.rb +3 -4
- data/lib/active_scaffold/extensions/name_option_for_datetime.rb +7 -11
- data/lib/active_scaffold/extensions/paginator_extensions.rb +20 -18
- data/lib/active_scaffold/extensions/routing_mapper.rb +104 -40
- data/lib/active_scaffold/extensions/to_label.rb +1 -1
- data/lib/active_scaffold/extensions/unsaved_associated.rb +4 -13
- data/lib/active_scaffold/extensions/unsaved_record.rb +12 -1
- data/lib/active_scaffold/finder.rb +200 -134
- data/lib/active_scaffold/helpers/action_link_helpers.rb +398 -0
- data/lib/active_scaffold/helpers/association_helpers.rb +12 -30
- data/lib/active_scaffold/helpers/controller_helpers.rb +74 -24
- data/lib/active_scaffold/helpers/form_column_helpers.rb +205 -112
- data/lib/active_scaffold/helpers/human_condition_helpers.rb +21 -11
- data/lib/active_scaffold/helpers/id_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/list_column_helpers.rb +117 -39
- data/lib/active_scaffold/helpers/pagination_helpers.rb +11 -14
- data/lib/active_scaffold/helpers/search_column_helpers.rb +69 -32
- data/lib/active_scaffold/helpers/show_column_helpers.rb +9 -3
- data/lib/active_scaffold/helpers/view_helpers.rb +41 -426
- data/lib/active_scaffold/orm_checks.rb +109 -0
- data/lib/active_scaffold/paginator.rb +1 -1
- data/lib/active_scaffold/responds_to_parent.rb +12 -10
- data/lib/active_scaffold/tableless.rb +81 -43
- data/lib/active_scaffold/version.rb +2 -2
- data/lib/generators/active_scaffold/controller_generator.rb +49 -0
- data/lib/generators/active_scaffold/install_generator.rb +45 -0
- data/lib/generators/active_scaffold/resource_generator.rb +56 -0
- data/lib/generators/{active_scaffold_controller/templates → templates}/controller.rb +0 -0
- data/lib/generators/{active_scaffold_controller/templates → templates}/helper.rb +0 -0
- data/shoulda_macros/macros.rb +3 -3
- data/test/active_scaffold_config_mock.rb +33 -0
- data/test/bridges/bridge_test.rb +9 -9
- data/test/bridges/date_picker_test.rb +3 -1
- data/test/bridges/paper_trail_test.rb +2 -3
- data/test/bridges/paperclip_test.rb +21 -10
- data/test/bridges/tiny_mce_test.rb +20 -21
- data/test/class_with_finder.rb +42 -0
- data/test/company.rb +6 -4
- data/test/config/core_test.rb +1 -1
- data/test/config/create_test.rb +1 -1
- data/test/config/list_test.rb +3 -3
- data/test/config/update_test.rb +3 -3
- data/test/data_structures/action_columns_test.rb +3 -3
- data/test/data_structures/association_column_test.rb +5 -5
- data/test/data_structures/column_test.rb +14 -14
- data/test/data_structures/columns_test.rb +2 -2
- data/test/data_structures/set_test.rb +2 -2
- data/test/data_structures/sorting_test.rb +6 -4
- data/test/extensions/active_record_test.rb +1 -1
- data/test/extensions/routing_mapper_test.rb +64 -13
- data/test/helpers/form_column_helpers_test.rb +6 -6
- data/test/helpers/list_column_helpers_test.rb +9 -5
- data/test/helpers/pagination_helpers_test.rb +1 -0
- data/test/misc/active_record_permissions_test.rb +18 -1
- data/test/misc/attribute_params_test.rb +26 -17
- data/test/misc/calculation_test.rb +8 -31
- data/test/misc/configurable_test.rb +3 -2
- data/test/misc/constraints_test.rb +33 -22
- data/test/misc/convert_numbers_format_test.rb +28 -10
- data/test/misc/finder_test.rb +6 -29
- data/test/misc/parse_datetime_test.rb +160 -0
- data/test/misc/render_test.rb +1 -1
- data/test/misc/tableless_test.rb +24 -0
- data/test/mock_app/app/models/building.rb +2 -1
- data/test/mock_app/config.ru +1 -1
- data/test/mock_app/config/environments/test.rb +1 -1
- data/test/mock_app/config/routes.rb +11 -3
- data/test/model_stub.rb +11 -6
- data/test/run_all.rb +1 -1
- data/test/test_helper.rb +19 -4
- metadata +42 -23
- data/lib/active_scaffold/data_structures/error_message.rb +0 -22
- data/lib/active_scaffold/extensions/reverse_associations.rb +0 -119
- data/lib/generators/active_scaffold/USAGE +0 -29
- data/lib/generators/active_scaffold/active_scaffold_generator.rb +0 -21
- data/lib/generators/active_scaffold_controller/USAGE +0 -19
- data/lib/generators/active_scaffold_controller/active_scaffold_controller_generator.rb +0 -29
- data/test/data_structures/error_message_test.rb +0 -25
data/test/misc/render_test.rb
CHANGED
data/test/misc/tableless_test.rb
CHANGED
@@ -5,6 +5,18 @@ class TablelessTest < MiniTest::Test
|
|
5
5
|
assert FileModel.all.to_a.empty?
|
6
6
|
end
|
7
7
|
|
8
|
+
def test_where
|
9
|
+
assert FileModel.where(name: 'file').to_a.empty?
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_where_using_assoc
|
13
|
+
assert FileModel.includes(:person).where(people: {name: 'Name'}).to_a.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_count
|
17
|
+
assert_equal 0, FileModel.count
|
18
|
+
end
|
19
|
+
|
8
20
|
def test_find_by_id
|
9
21
|
assert_raises ActiveRecord::RecordNotFound do
|
10
22
|
FileModel.find('filename')
|
@@ -14,4 +26,16 @@ class TablelessTest < MiniTest::Test
|
|
14
26
|
def test_find_with_association
|
15
27
|
assert Person.new.files.empty?
|
16
28
|
end
|
29
|
+
|
30
|
+
def test_find_with_through_association
|
31
|
+
assert Building.new.files.empty?
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_new
|
35
|
+
assert FileModel.new
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_association
|
39
|
+
assert FileModel.new.person.nil?
|
40
|
+
end
|
17
41
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
class Building < ActiveRecord::Base
|
2
|
-
belongs_to :owner, :class_name => 'Person', :counter_cache => true, :inverse_of => :
|
2
|
+
belongs_to :owner, :class_name => 'Person', :counter_cache => true, :inverse_of => :buildings
|
3
3
|
has_many :floors, :dependent => :destroy, :inverse_of => :building
|
4
4
|
|
5
5
|
has_one :address, :as => :addressable
|
6
6
|
|
7
7
|
has_many :tenants, :through => :floors, :class_name => 'Person'
|
8
|
+
has_many :files, :through => :tenants, :class_name => 'FileModel'
|
8
9
|
end
|
data/test/mock_app/config.ru
CHANGED
@@ -16,7 +16,7 @@ RailsApp::Application.configure do
|
|
16
16
|
config.action_dispatch.show_exceptions = false
|
17
17
|
|
18
18
|
# Disable request forgery protection in test environment
|
19
|
-
config.action_controller.allow_forgery_protection
|
19
|
+
config.action_controller.allow_forgery_protection = false
|
20
20
|
|
21
21
|
# Tell Action Mailer not to deliver emails to the real world.
|
22
22
|
# The :test delivery method accumulates sent emails in the
|
@@ -1,6 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
concern :active_scaffold, ActiveScaffold::Routing::Basic.new(association: true)
|
3
|
+
concern :active_scaffold_association, ActiveScaffold::Routing::Association.new
|
4
|
+
|
5
|
+
resources :addresses, concerns: :active_scaffold
|
6
|
+
resources :buildings, except: :index do
|
7
|
+
concerns :active_scaffold, except: %i[mark add_existing new_existing destroy_existing]
|
4
8
|
end
|
9
|
+
resources :cars, only: %i[edit update] do
|
10
|
+
concerns :active_scaffold, association: false, except: [:mark]
|
11
|
+
end
|
12
|
+
|
5
13
|
match ':controller(/:action(/:id))', :via => :any
|
6
14
|
end
|
data/test/model_stub.rb
CHANGED
@@ -4,16 +4,13 @@ class ModelStub < ActiveRecord::Base
|
|
4
4
|
has_many :other_models, :class_name => 'ModelStub'
|
5
5
|
|
6
6
|
cattr_accessor :stubbed_columns
|
7
|
-
self.stubbed_columns = [
|
8
|
-
attr_accessor
|
7
|
+
self.stubbed_columns = %i[a b c d id created_at]
|
8
|
+
attr_accessor(*stubbed_columns)
|
9
9
|
self.primary_key = :id
|
10
10
|
|
11
11
|
@@nested_scope_calls = []
|
12
12
|
cattr_accessor :nested_scope_calls
|
13
13
|
|
14
|
-
scope :a_is_defined, -> { where.not(:a => nil) }
|
15
|
-
scope :b_like, ->(pattern) { where('b like ?', pattern) }
|
16
|
-
|
17
14
|
def self.a_is_defined
|
18
15
|
@@nested_scope_calls << :a_is_defined
|
19
16
|
self
|
@@ -37,7 +34,7 @@ class ModelStub < ActiveRecord::Base
|
|
37
34
|
def self.columns
|
38
35
|
@columns ||= stubbed_columns.map do |c|
|
39
36
|
column = ColumnMock.new(c.to_s, '', 'varchar(255)')
|
40
|
-
column.primary = true if c.to_s ==
|
37
|
+
column.primary = true if c.to_s == primary_key.to_s && column.respond_to?(:primary=)
|
41
38
|
column
|
42
39
|
end
|
43
40
|
end
|
@@ -46,13 +43,21 @@ class ModelStub < ActiveRecord::Base
|
|
46
43
|
@columns_hash ||= columns.each_with_object({}) { |column, hash| hash[column.name.to_s] = column }
|
47
44
|
end
|
48
45
|
|
46
|
+
if respond_to? :type_for_attribute
|
47
|
+
def self.type_for_attribute(attribute_name)
|
48
|
+
defined?(ActiveModel::Type) ? ActiveModel::Type::String.new : super
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
49
52
|
# column-level security methods, used for testing
|
50
53
|
def self.a_authorized_for_bar?
|
51
54
|
true
|
52
55
|
end
|
56
|
+
|
53
57
|
def self.b_authorized?
|
54
58
|
false
|
55
59
|
end
|
60
|
+
|
56
61
|
def self.c_authorized_for_create?
|
57
62
|
false
|
58
63
|
end
|
data/test/run_all.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'simplecov'
|
1
|
+
require 'simplecov' if RUBY_ENGINE == 'ruby'
|
2
2
|
|
3
3
|
ENV['RAILS_ENV'] = 'test'
|
4
4
|
require 'mock_app/config/environment'
|
@@ -12,30 +12,45 @@ Minitest::Reporters.use!
|
|
12
12
|
def load_schema
|
13
13
|
stdout = $stdout
|
14
14
|
$stdout = StringIO.new # suppress output while building the schema
|
15
|
-
load
|
15
|
+
load Rails.root.join('db', 'schema.rb')
|
16
16
|
$stdout = stdout
|
17
17
|
end
|
18
18
|
load_schema
|
19
19
|
|
20
|
-
%w
|
20
|
+
%w[model_stub const_mocker company].each do |file|
|
21
21
|
require File.join(File.dirname(__FILE__), file)
|
22
22
|
end
|
23
23
|
|
24
24
|
I18n.backend.store_translations :en, YAML.load_file(File.expand_path('../../config/locales/en.yml', __FILE__))['en']
|
25
25
|
|
26
|
+
# rails 4.0
|
26
27
|
unless defined? Minitest::Test
|
27
28
|
class Minitest::Test < MiniTest::Unit::TestCase
|
28
29
|
end
|
30
|
+
|
31
|
+
class MiniTest::Unit::TestCase
|
32
|
+
def with_js_framework(framework)
|
33
|
+
framework, ActiveScaffold.js_framework = ActiveScaffold.js_framework, framework
|
34
|
+
yield
|
35
|
+
ActiveScaffold.js_framework = framework
|
36
|
+
end
|
37
|
+
end
|
29
38
|
end
|
30
39
|
|
31
40
|
class MiniTest::Test
|
32
41
|
protected
|
33
42
|
|
43
|
+
def with_js_framework(framework)
|
44
|
+
framework, ActiveScaffold.js_framework = ActiveScaffold.js_framework, framework
|
45
|
+
yield
|
46
|
+
ActiveScaffold.js_framework = framework
|
47
|
+
end
|
48
|
+
|
34
49
|
def config_for(klass, namespace = nil)
|
35
50
|
ActiveScaffold::Config::Core.new("#{namespace}#{klass.to_s.underscore.downcase}")
|
36
51
|
end
|
37
52
|
end
|
38
53
|
|
39
|
-
Config = RbConfig # HACK needed some comments
|
54
|
+
Config = RbConfig # HACK: needed some comments
|
40
55
|
|
41
56
|
class ColumnMock < ActiveScaffold::Tableless::Column; 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.
|
4
|
+
version: 3.5.0
|
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:
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,20 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '5'
|
19
|
+
version: 4.0.5
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
24
|
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
30
|
-
|
26
|
+
version: 4.0.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ice_nine
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.11'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
31
39
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
40
|
+
version: '0.11'
|
33
41
|
description: Save time and headaches, and create a more easily maintainable set of
|
34
42
|
pages, with ActiveScaffold. ActiveScaffold handles all your CRUD (create, read,
|
35
43
|
update, delete) user interface needs, leaving you more time to focus on more challenging
|
@@ -41,7 +49,7 @@ extra_rdoc_files:
|
|
41
49
|
- README.md
|
42
50
|
files:
|
43
51
|
- CHANGELOG
|
44
|
-
- LICENSE
|
52
|
+
- LICENSE.md
|
45
53
|
- README.md
|
46
54
|
- app/assets/images/active_scaffold/add.png
|
47
55
|
- app/assets/images/active_scaffold/arrow_down.png
|
@@ -120,6 +128,7 @@ files:
|
|
120
128
|
- app/views/active_scaffold_overrides/_row.html.erb
|
121
129
|
- app/views/active_scaffold_overrides/_search.html.erb
|
122
130
|
- app/views/active_scaffold_overrides/_show.html.erb
|
131
|
+
- app/views/active_scaffold_overrides/_show_actions.html.erb
|
123
132
|
- app/views/active_scaffold_overrides/_show_association.html.erb
|
124
133
|
- app/views/active_scaffold_overrides/_show_association_horizontal.html.erb
|
125
134
|
- app/views/active_scaffold_overrides/_show_association_vertical.html.erb
|
@@ -153,6 +162,9 @@ files:
|
|
153
162
|
- app/views/active_scaffold_overrides/update.html.erb
|
154
163
|
- app/views/active_scaffold_overrides/update_column.js.erb
|
155
164
|
- app/views/active_scaffold_overrides/update_row.js.erb
|
165
|
+
- config/brakeman.ignore
|
166
|
+
- config/brakeman.yml
|
167
|
+
- config/i18n-tasks.yml
|
156
168
|
- config/locales/de.yml
|
157
169
|
- config/locales/en.yml
|
158
170
|
- config/locales/es.yml
|
@@ -248,10 +260,14 @@ files:
|
|
248
260
|
- lib/active_scaffold/data_structures/action_link.rb
|
249
261
|
- lib/active_scaffold/data_structures/action_links.rb
|
250
262
|
- lib/active_scaffold/data_structures/actions.rb
|
263
|
+
- lib/active_scaffold/data_structures/association.rb
|
264
|
+
- lib/active_scaffold/data_structures/association/abstract.rb
|
265
|
+
- lib/active_scaffold/data_structures/association/active_mongoid.rb
|
266
|
+
- lib/active_scaffold/data_structures/association/active_record.rb
|
267
|
+
- lib/active_scaffold/data_structures/association/mongoid.rb
|
251
268
|
- lib/active_scaffold/data_structures/bridge.rb
|
252
269
|
- lib/active_scaffold/data_structures/column.rb
|
253
270
|
- lib/active_scaffold/data_structures/columns.rb
|
254
|
-
- lib/active_scaffold/data_structures/error_message.rb
|
255
271
|
- lib/active_scaffold/data_structures/nested_info.rb
|
256
272
|
- lib/active_scaffold/data_structures/set.rb
|
257
273
|
- lib/active_scaffold/data_structures/sorting.rb
|
@@ -265,12 +281,12 @@ files:
|
|
265
281
|
- lib/active_scaffold/extensions/localize.rb
|
266
282
|
- lib/active_scaffold/extensions/name_option_for_datetime.rb
|
267
283
|
- lib/active_scaffold/extensions/paginator_extensions.rb
|
268
|
-
- lib/active_scaffold/extensions/reverse_associations.rb
|
269
284
|
- lib/active_scaffold/extensions/routing_mapper.rb
|
270
285
|
- lib/active_scaffold/extensions/to_label.rb
|
271
286
|
- lib/active_scaffold/extensions/unsaved_associated.rb
|
272
287
|
- lib/active_scaffold/extensions/unsaved_record.rb
|
273
288
|
- lib/active_scaffold/finder.rb
|
289
|
+
- lib/active_scaffold/helpers/action_link_helpers.rb
|
274
290
|
- lib/active_scaffold/helpers/association_helpers.rb
|
275
291
|
- lib/active_scaffold/helpers/controller_helpers.rb
|
276
292
|
- lib/active_scaffold/helpers/form_column_helpers.rb
|
@@ -282,24 +298,26 @@ files:
|
|
282
298
|
- lib/active_scaffold/helpers/show_column_helpers.rb
|
283
299
|
- lib/active_scaffold/helpers/view_helpers.rb
|
284
300
|
- lib/active_scaffold/marked_model.rb
|
301
|
+
- lib/active_scaffold/orm_checks.rb
|
285
302
|
- lib/active_scaffold/paginator.rb
|
286
303
|
- lib/active_scaffold/responds_to_parent.rb
|
287
304
|
- lib/active_scaffold/tableless.rb
|
288
305
|
- lib/active_scaffold/version.rb
|
289
|
-
- lib/generators/active_scaffold/
|
290
|
-
- lib/generators/active_scaffold/
|
291
|
-
- lib/generators/
|
292
|
-
- lib/generators/
|
293
|
-
- lib/generators/
|
294
|
-
- lib/generators/active_scaffold_controller/templates/helper.rb
|
306
|
+
- lib/generators/active_scaffold/controller_generator.rb
|
307
|
+
- lib/generators/active_scaffold/install_generator.rb
|
308
|
+
- lib/generators/active_scaffold/resource_generator.rb
|
309
|
+
- lib/generators/templates/controller.rb
|
310
|
+
- lib/generators/templates/helper.rb
|
295
311
|
- lib/tasks/brakeman.rake
|
296
312
|
- public/blank.html
|
297
313
|
- shoulda_macros/macros.rb
|
314
|
+
- test/active_scaffold_config_mock.rb
|
298
315
|
- test/bridges/bridge_test.rb
|
299
316
|
- test/bridges/date_picker_test.rb
|
300
317
|
- test/bridges/paper_trail_test.rb
|
301
318
|
- test/bridges/paperclip_test.rb
|
302
319
|
- test/bridges/tiny_mce_test.rb
|
320
|
+
- test/class_with_finder.rb
|
303
321
|
- test/company.rb
|
304
322
|
- test/config/base_test.rb
|
305
323
|
- test/config/core_test.rb
|
@@ -320,7 +338,6 @@ files:
|
|
320
338
|
- test/data_structures/association_column_test.rb
|
321
339
|
- test/data_structures/column_test.rb
|
322
340
|
- test/data_structures/columns_test.rb
|
323
|
-
- test/data_structures/error_message_test.rb
|
324
341
|
- test/data_structures/set_test.rb
|
325
342
|
- test/data_structures/sorting_test.rb
|
326
343
|
- test/data_structures/standard_column_test.rb
|
@@ -340,6 +357,7 @@ files:
|
|
340
357
|
- test/misc/convert_numbers_format_test.rb
|
341
358
|
- test/misc/finder_test.rb
|
342
359
|
- test/misc/lang_test.rb
|
360
|
+
- test/misc/parse_datetime_test.rb
|
343
361
|
- test/misc/render_test.rb
|
344
362
|
- test/misc/tableless_test.rb
|
345
363
|
- test/mock_app/.gitignore
|
@@ -398,7 +416,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
398
416
|
requirements:
|
399
417
|
- - ">="
|
400
418
|
- !ruby/object:Gem::Version
|
401
|
-
version: '
|
419
|
+
version: '2.0'
|
402
420
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
403
421
|
requirements:
|
404
422
|
- - ">="
|
@@ -409,14 +427,15 @@ rubyforge_project:
|
|
409
427
|
rubygems_version: 2.6.10
|
410
428
|
signing_key:
|
411
429
|
specification_version: 4
|
412
|
-
summary: Rails
|
413
|
-
and jquery
|
430
|
+
summary: Rails 4.x and 5.x versions of ActiveScaffold supporting prototype and jquery
|
414
431
|
test_files:
|
432
|
+
- test/active_scaffold_config_mock.rb
|
415
433
|
- test/bridges/bridge_test.rb
|
416
434
|
- test/bridges/date_picker_test.rb
|
417
435
|
- test/bridges/paper_trail_test.rb
|
418
436
|
- test/bridges/paperclip_test.rb
|
419
437
|
- test/bridges/tiny_mce_test.rb
|
438
|
+
- test/class_with_finder.rb
|
420
439
|
- test/company.rb
|
421
440
|
- test/config/base_test.rb
|
422
441
|
- test/config/core_test.rb
|
@@ -437,7 +456,6 @@ test_files:
|
|
437
456
|
- test/data_structures/association_column_test.rb
|
438
457
|
- test/data_structures/column_test.rb
|
439
458
|
- test/data_structures/columns_test.rb
|
440
|
-
- test/data_structures/error_message_test.rb
|
441
459
|
- test/data_structures/set_test.rb
|
442
460
|
- test/data_structures/sorting_test.rb
|
443
461
|
- test/data_structures/standard_column_test.rb
|
@@ -457,6 +475,7 @@ test_files:
|
|
457
475
|
- test/misc/convert_numbers_format_test.rb
|
458
476
|
- test/misc/finder_test.rb
|
459
477
|
- test/misc/lang_test.rb
|
478
|
+
- test/misc/parse_datetime_test.rb
|
460
479
|
- test/misc/render_test.rb
|
461
480
|
- test/misc/tableless_test.rb
|
462
481
|
- test/mock_app/.gitignore
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module ActiveScaffold::DataStructures
|
2
|
-
# Wrapper for error strings so that they may be exported using to_xxx
|
3
|
-
class ErrorMessage
|
4
|
-
def initialize(error)
|
5
|
-
@error = error
|
6
|
-
end
|
7
|
-
|
8
|
-
def public_attributes
|
9
|
-
{:error => @error}
|
10
|
-
end
|
11
|
-
|
12
|
-
def to_xml
|
13
|
-
public_attributes.to_xml(:root => 'errors')
|
14
|
-
end
|
15
|
-
|
16
|
-
delegate :to_yaml, :to => :public_attributes
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
@error
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,119 +0,0 @@
|
|
1
|
-
module ActiveScaffold
|
2
|
-
module ReverseAssociation
|
3
|
-
module CommonMethods
|
4
|
-
def self.included(base)
|
5
|
-
base.class_eval { attr_writer :reverse }
|
6
|
-
base.alias_method_chain :inverse_of, :autodetect
|
7
|
-
end
|
8
|
-
|
9
|
-
def inverse_of_with_autodetect
|
10
|
-
inverse_of_without_autodetect || autodetect_inverse
|
11
|
-
end
|
12
|
-
|
13
|
-
def inverse_for?(klass)
|
14
|
-
inverse_class = inverse_of.try(:active_record)
|
15
|
-
inverse_class.present? && (inverse_class == klass || klass < inverse_class)
|
16
|
-
end
|
17
|
-
|
18
|
-
def reverse(klass = nil)
|
19
|
-
unless defined? @reverse # rubocop:disable Style/IfUnlessModifier
|
20
|
-
@reverse ||= inverse_of.try(:name)
|
21
|
-
end
|
22
|
-
@reverse || (autodetect_inverse(klass).try(:name) unless klass.nil?)
|
23
|
-
end
|
24
|
-
|
25
|
-
def autodetect_inverse(klass = nil)
|
26
|
-
return nil if klass.nil? && options[:polymorphic]
|
27
|
-
klass ||= self.klass
|
28
|
-
|
29
|
-
# name-based matching (association name vs self.active_record.to_s)
|
30
|
-
matches = reverse_matches(klass)
|
31
|
-
if matches.length > 1
|
32
|
-
matches.find_all do |assoc|
|
33
|
-
active_record.to_s.underscore.include? assoc.name.to_s.pluralize.singularize
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
matches.first
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
module AssociationReflection
|
42
|
-
def self.included(base)
|
43
|
-
base.send :include, ActiveScaffold::ReverseAssociation::CommonMethods
|
44
|
-
end
|
45
|
-
|
46
|
-
protected
|
47
|
-
|
48
|
-
def reverse_matches(klass)
|
49
|
-
reverse_matches = []
|
50
|
-
|
51
|
-
# collect associations that point back to this model and use the same foreign_key
|
52
|
-
klass.reflect_on_all_associations.each do |assoc|
|
53
|
-
next if assoc == self
|
54
|
-
# skip over has_many :through associations
|
55
|
-
next if assoc.options[:through]
|
56
|
-
next unless assoc.options[:polymorphic] || assoc.class_name == active_record.name
|
57
|
-
|
58
|
-
case [assoc.macro, macro].find_all { |m| m == :has_and_belongs_to_many }.length
|
59
|
-
# if both are a habtm, then match them based on the join table
|
60
|
-
when 2
|
61
|
-
next unless assoc.options[:join_table] == options[:join_table]
|
62
|
-
|
63
|
-
# if only one is a habtm, they do not match
|
64
|
-
when 1
|
65
|
-
next
|
66
|
-
|
67
|
-
# otherwise, match them based on the foreign_key
|
68
|
-
when 0
|
69
|
-
if assoc.foreign_key.is_a? Array
|
70
|
-
next unless assoc.foreign_key == foreign_key
|
71
|
-
else
|
72
|
-
next unless assoc.foreign_key.to_sym == foreign_key.to_sym
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
reverse_matches << assoc
|
77
|
-
end
|
78
|
-
reverse_matches
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
module ThroughReflection
|
83
|
-
def self.included(base)
|
84
|
-
base.send :include, ActiveScaffold::ReverseAssociation::CommonMethods unless base < ActiveScaffold::ReverseAssociation::CommonMethods
|
85
|
-
end
|
86
|
-
|
87
|
-
protected
|
88
|
-
|
89
|
-
def reverse_matches(klass)
|
90
|
-
reverse_matches = []
|
91
|
-
|
92
|
-
# collect associations that point back to this model and use the same foreign_key
|
93
|
-
klass.reflect_on_all_associations.each do |assoc|
|
94
|
-
next if assoc == self
|
95
|
-
# only iterate has_many :through associations
|
96
|
-
next unless assoc.options[:through]
|
97
|
-
next unless assoc.class_name == active_record.name
|
98
|
-
next unless assoc.through_reflection.class_name == through_reflection.class_name
|
99
|
-
|
100
|
-
reverse_matches << assoc
|
101
|
-
end
|
102
|
-
reverse_matches
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
module ThroughAssociation
|
107
|
-
# NOTE - for now, we're only supporting inverse setting back onto has_one associations.
|
108
|
-
# TODO remove when rails fixes this and old versions are not supported
|
109
|
-
def invertible_for?(record)
|
110
|
-
inverse = super
|
111
|
-
inverse && !inverse.collection?
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
ActiveRecord::Reflection::AssociationReflection.send :include, ActiveScaffold::ReverseAssociation::AssociationReflection
|
118
|
-
ActiveRecord::Reflection::ThroughReflection.send :include, ActiveScaffold::ReverseAssociation::ThroughReflection
|
119
|
-
ActiveRecord::Associations::ThroughAssociation.send :include, ActiveScaffold::ReverseAssociation::ThroughAssociation
|