active_scaffold 3.3.2 → 3.3.3
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 +7 -0
- data/CHANGELOG +9 -0
- data/app/assets/javascripts/active_scaffold.js.erb +5 -2
- data/app/assets/javascripts/jquery/active_scaffold.js +4 -6
- data/app/assets/javascripts/jquery/date_picker_bridge.js.erb +16 -14
- data/app/assets/javascripts/prototype/active_scaffold.js +0 -5
- data/app/assets/stylesheets/active_scaffold.css.scss +1 -1
- data/app/assets/stylesheets/active_scaffold_jquery_ui.css.erb +7 -0
- data/lib/active_scaffold.rb +1 -1
- data/lib/active_scaffold/actions/update.rb +2 -1
- data/lib/active_scaffold/attribute_params.rb +2 -2
- data/lib/active_scaffold/bridges/date_picker.rb +1 -1
- data/lib/active_scaffold/config/core.rb +0 -2
- data/lib/active_scaffold/config/nested.rb +6 -3
- data/lib/active_scaffold/constraints.rb +2 -2
- data/lib/active_scaffold/data_structures/action_columns.rb +68 -72
- data/lib/active_scaffold/data_structures/column.rb +7 -3
- data/lib/active_scaffold/data_structures/sorting.rb +2 -1
- data/lib/active_scaffold/finder.rb +2 -14
- data/lib/active_scaffold/helpers/form_column_helpers.rb +1 -0
- data/lib/active_scaffold/helpers/list_column_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/pagination_helpers.rb +1 -1
- data/lib/active_scaffold/helpers/search_column_helpers.rb +2 -2
- data/lib/active_scaffold/helpers/view_helpers.rb +7 -5
- data/lib/active_scaffold/tableless.rb +2 -2
- data/lib/active_scaffold/version.rb +1 -1
- data/test/bridges/bridge_test.rb +22 -33
- data/test/bridges/date_picker_test.rb +29 -0
- data/test/bridges/paperclip_test.rb +10 -11
- data/test/bridges/tiny_mce_test.rb +7 -7
- data/test/{bridges/company.rb → company.rb} +14 -13
- data/test/config/base_test.rb +14 -12
- data/test/config/core_test.rb +59 -53
- data/test/config/create_test.rb +56 -54
- data/test/config/delete_test.rb +31 -29
- data/test/config/field_search_test.rb +45 -43
- data/test/config/list_test.rb +119 -117
- data/test/config/nested_test.rb +50 -58
- data/test/config/search_test.rb +58 -56
- data/test/config/show_test.rb +42 -40
- data/test/config/subform_test.rb +15 -13
- data/test/config/update_test.rb +40 -38
- data/test/const_mocker.rb +14 -18
- data/test/data_structures/action_columns_test.rb +3 -3
- data/test/data_structures/action_link_test.rb +1 -1
- data/test/data_structures/action_links_test.rb +3 -3
- data/test/data_structures/actions_test.rb +2 -2
- data/test/data_structures/association_column_test.rb +5 -6
- data/test/data_structures/column_test.rb +8 -4
- data/test/data_structures/columns_test.rb +2 -3
- data/test/data_structures/error_message_test.rb +2 -2
- data/test/data_structures/set_test.rb +2 -3
- data/test/data_structures/sorting_test.rb +1 -2
- data/test/data_structures/standard_column_test.rb +2 -3
- data/test/data_structures/validation_reflection_test.rb +51 -0
- data/test/data_structures/virtual_column_test.rb +1 -1
- data/test/extensions/active_record_test.rb +2 -3
- data/test/extensions/array_test.rb +2 -2
- data/test/helpers/form_column_helpers_test.rb +6 -6
- data/test/helpers/list_column_helpers_test.rb +4 -1
- data/test/helpers/pagination_helpers_test.rb +7 -3
- data/test/misc/active_record_permissions_test.rb +1 -1
- data/test/misc/attribute_params_test.rb +3 -4
- data/test/misc/configurable_test.rb +2 -2
- data/test/misc/constraints_test.rb +29 -29
- data/test/misc/finder_test.rb +13 -10
- data/test/misc/lang_test.rb +1 -1
- data/test/mock_app/Rakefile +7 -0
- data/test/mock_app/config.ru +4 -0
- data/test/mock_app/config/application.rb +11 -0
- data/test/mock_app/config/boot.rb +6 -109
- data/test/mock_app/config/database.yml +2 -2
- data/test/mock_app/config/environment.rb +4 -42
- data/test/mock_app/config/environments/development.rb +21 -13
- data/test/mock_app/config/environments/production.rb +41 -20
- data/test/mock_app/config/environments/test.rb +27 -22
- data/test/mock_app/config/initializers/backtrace_silencers.rb +2 -2
- data/test/mock_app/config/initializers/inflections.rb +1 -1
- data/test/mock_app/config/initializers/secret_token.rb +7 -0
- data/test/mock_app/config/initializers/session_store.rb +2 -9
- data/test/mock_app/config/initializers/wrap_parameters.rb +14 -0
- data/test/mock_app/config/routes.rb +2 -42
- data/test/model_stub.rb +2 -3
- data/test/test_helper.rb +13 -11
- data/vendor/assets/stylesheets/jquery-ui-theme.css.erb +47 -0
- data/vendor/assets/stylesheets/jquery-ui.css +2 -36
- metadata +92 -103
- data/test/bridges/active_scaffold_dependent_protect_test.rb +0 -34
- data/test/bridges/unobtrusive_date_picker_test.rb +0 -49
- data/test/bridges/validation_reflection_test.rb +0 -57
- data/test/mock_app/config/initializers/new_rails_defaults.rb +0 -19
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require 'test/unit'
|
|
2
|
-
require File.join(File.dirname(__FILE__), 'company')
|
|
3
|
-
|
|
4
|
-
class ActiveScaffoldDependentProtectTest < Test::Unit::TestCase
|
|
5
|
-
def test_destroy_protected_with_companies
|
|
6
|
-
protected_firm = Company.new(:with_companies)
|
|
7
|
-
assert !protected_firm.send(:authorized_for_delete?)
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def test_destroy_protected_with_company
|
|
11
|
-
protected_firm = Company.new(:with_company)
|
|
12
|
-
assert !protected_firm.send(:authorized_for_delete?)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def test_destroy_protected_with_main_company
|
|
16
|
-
protected_firm = Company.new(:with_main_company)
|
|
17
|
-
assert !protected_firm.send(:authorized_for_delete?)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def test_destroy_protected_without_companies
|
|
21
|
-
protected_firm_without_companies = Company.new(:without_companies)
|
|
22
|
-
assert protected_firm_without_companies.send(:authorized_for_delete?)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_destroy_protected_without_company
|
|
26
|
-
protected_firm_without_company = Company.new(:without_company)
|
|
27
|
-
assert protected_firm_without_company.send(:authorized_for_delete?)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_destroy_protected_without_main_company
|
|
31
|
-
protected_firm_without_main_company = Company.new(:without_main_company)
|
|
32
|
-
assert protected_firm_without_main_company.send(:authorized_for_delete?)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
require 'test/unit'
|
|
2
|
-
require File.join(File.dirname(__FILE__), 'company')
|
|
3
|
-
require File.join(File.dirname(__FILE__), '../../lib/bridges/unobtrusive_date_picker/lib/unobtrusive_date_picker_bridge')
|
|
4
|
-
require File.join(File.dirname(__FILE__), '../../lib/bridges/unobtrusive_date_picker/lib/view_helpers')
|
|
5
|
-
require File.join(File.dirname(__FILE__), '../../lib/bridges/unobtrusive_date_picker/lib/form_ui')
|
|
6
|
-
|
|
7
|
-
class UDPCore < ActiveScaffold::Config::Core
|
|
8
|
-
include ActiveScaffold::UnobtrusiveDatePickerBridge
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
class UnobtrusiveDatePickerTest < ActionView::TestCase
|
|
12
|
-
include ActiveScaffold::Helpers::ViewHelpers
|
|
13
|
-
include ActiveScaffold::UnobtrusiveDatePickerHelpers
|
|
14
|
-
|
|
15
|
-
def test_set_form_ui
|
|
16
|
-
config = UDPCore.new(:company)
|
|
17
|
-
assert_equal nil, config.columns[:name].form_ui, 'form_ui for name'
|
|
18
|
-
assert_equal :datepicker, config.columns[:date].form_ui, 'form_ui for date'
|
|
19
|
-
assert_equal :datepicker, config.columns[:datetime].form_ui, 'form_ui for datetime'
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_stylesheets
|
|
23
|
-
assert active_scaffold_stylesheets.include?('datepicker.css')
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def test_javascripts
|
|
27
|
-
assert active_scaffold_javascripts.include?('datepicker.js')
|
|
28
|
-
assert active_scaffold_javascripts.include?('datepicker_lang/es.js')
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_form_ui
|
|
32
|
-
config = UDPCore.new(:company)
|
|
33
|
-
self.expects(:date_select).returns('')
|
|
34
|
-
self.expects(:date_picker).returns('')
|
|
35
|
-
assert active_scaffold_input_datepicker(config.columns[:date], :name => 'record[date]', :id => 'record_date')
|
|
36
|
-
|
|
37
|
-
self.expects(:datetime_select).returns('')
|
|
38
|
-
self.expects(:date_picker).returns('')
|
|
39
|
-
assert active_scaffold_input_datepicker(config.columns[:datetime], :name => 'record[datetime]', :id => 'record_datetime')
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
private
|
|
43
|
-
def unobtrusive_datepicker_stylesheets
|
|
44
|
-
['datepicker.css']
|
|
45
|
-
end
|
|
46
|
-
def unobtrusive_datepicker_javascripts
|
|
47
|
-
['datepicker.js', 'datepicker_lang/es.js']
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require 'test/unit'
|
|
2
|
-
require File.join(File.dirname(__FILE__), 'company')
|
|
3
|
-
require File.join(File.dirname(__FILE__), '../../lib/bridges/validation_reflection/lib/validation_reflection_bridge')
|
|
4
|
-
|
|
5
|
-
class ColumnWithValidationReflection < ActiveScaffold::DataStructures::Column
|
|
6
|
-
include ActiveScaffold::ValidationReflectionBridge
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
class ValidationReflectionTest < Test::Unit::TestCase
|
|
10
|
-
def test_set_required_for_validates_presence_of
|
|
11
|
-
Company.expects(:reflect_on_validations_for).with(:name).returns([stub(:macro => :validates_presence_of)])
|
|
12
|
-
column = ColumnWithValidationReflection.new(:name, Company)
|
|
13
|
-
assert column.required?
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def test_set_required_for_validates_inclusion_of
|
|
17
|
-
Company.expects(:reflect_on_validations_for).with(:name).returns([stub(:macro => :validates_inclusion_of, :options => {})])
|
|
18
|
-
column = ColumnWithValidationReflection.new(:name, Company)
|
|
19
|
-
assert column.required?
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def test_not_set_required_for_validates_inclusion_of_and_allow_nil
|
|
23
|
-
Company.expects(:reflect_on_validations_for).with(:name).returns([stub(:macro => :validates_inclusion_of, :options => {:allow_nil => true})])
|
|
24
|
-
column = ColumnWithValidationReflection.new(:name, Company)
|
|
25
|
-
assert !column.required?
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_not_set_required_for_validates_inclusion_of_and_allow_blank
|
|
29
|
-
Company.expects(:reflect_on_validations_for).with(:name).returns([stub(:macro => :validates_inclusion_of, :options => {:allow_blank => true})])
|
|
30
|
-
column = ColumnWithValidationReflection.new(:name, Company)
|
|
31
|
-
assert !column.required?
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_not_set_required_for_no_validation
|
|
35
|
-
Company.expects(:reflect_on_validations_for).with(:name).returns([])
|
|
36
|
-
column = ColumnWithValidationReflection.new(:name, Company)
|
|
37
|
-
assert !column.required?
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_set_required_for_validates_presence_of_in_association
|
|
41
|
-
Company.stubs(:reflect_on_validations_for).returns([stub(:macro => :validates_presence_of)], [])
|
|
42
|
-
column = ColumnWithValidationReflection.new(:main_company, Company)
|
|
43
|
-
assert column.required?
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def test_set_required_for_validates_presence_of_in_foreign_key
|
|
47
|
-
Company.stubs(:reflect_on_validations_for).returns([], [stub(:macro => :validates_presence_of)])
|
|
48
|
-
column = ColumnWithValidationReflection.new(:main_company, Company)
|
|
49
|
-
assert column.required?
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_not_set_required_for_no_validation_in_association_neither_foreign_key
|
|
53
|
-
Company.stubs(:reflect_on_validations_for).returns([])
|
|
54
|
-
column = ColumnWithValidationReflection.new(:main_company, Company)
|
|
55
|
-
assert !column.required?
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# These settings change the behavior of Rails 2 apps and will be defaults
|
|
4
|
-
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
|
5
|
-
|
|
6
|
-
if defined?(ActiveRecord)
|
|
7
|
-
# Include Active Record class name as root for JSON serialized output.
|
|
8
|
-
ActiveRecord::Base.include_root_in_json = true
|
|
9
|
-
|
|
10
|
-
# Store the full class name (including module namespace) in STI type column.
|
|
11
|
-
ActiveRecord::Base.store_full_sti_class = true
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Use ISO 8601 format for JSON serialized times and dates.
|
|
15
|
-
ActiveSupport.use_standard_json_time_format = true
|
|
16
|
-
|
|
17
|
-
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
|
18
|
-
# if you're including raw json in an HTML page.
|
|
19
|
-
ActiveSupport.escape_html_entities_in_json = false
|