dynamic_fieldsets 0.0.16 → 0.1.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.
Files changed (97) hide show
  1. data/.rdebugrc +3 -0
  2. data/.rspec +1 -0
  3. data/CHANGELOG +7 -0
  4. data/Gemfile +17 -8
  5. data/Gemfile.lock +77 -60
  6. data/README.rdoc +1 -1
  7. data/VERSION +1 -1
  8. data/app/controllers/dynamic_fieldsets/fields_controller.rb +5 -4
  9. data/app/helpers/dynamic_fieldsets_helper.rb +48 -131
  10. data/app/models/dynamic_fieldsets.rb +2 -0
  11. data/app/models/dynamic_fieldsets/checkbox_field.rb +29 -0
  12. data/app/models/dynamic_fieldsets/date_field.rb +37 -0
  13. data/app/models/dynamic_fieldsets/datetime_field.rb +36 -0
  14. data/app/models/dynamic_fieldsets/dependency.rb +1 -1
  15. data/app/models/dynamic_fieldsets/dependency_clause.rb +1 -1
  16. data/app/models/dynamic_fieldsets/dependency_group.rb +1 -1
  17. data/app/models/dynamic_fieldsets/field.rb +170 -42
  18. data/app/models/dynamic_fieldsets/field_default.rb +3 -3
  19. data/app/models/dynamic_fieldsets/field_html_attribute.rb +1 -1
  20. data/app/models/dynamic_fieldsets/field_option.rb +1 -1
  21. data/app/models/dynamic_fieldsets/field_record.rb +1 -1
  22. data/app/models/dynamic_fieldsets/fieldset.rb +36 -1
  23. data/app/models/dynamic_fieldsets/fieldset_associator.rb +9 -34
  24. data/app/models/dynamic_fieldsets/fieldset_child.rb +43 -24
  25. data/app/models/dynamic_fieldsets/instruction_field.rb +35 -0
  26. data/app/models/dynamic_fieldsets/multiple_select_field.rb +43 -0
  27. data/app/models/dynamic_fieldsets/radio_field.rb +27 -0
  28. data/app/models/dynamic_fieldsets/select_field.rb +16 -0
  29. data/app/models/dynamic_fieldsets/text_field.rb +14 -0
  30. data/app/models/dynamic_fieldsets/textarea_field.rb +40 -0
  31. data/app/views/dynamic_fieldsets/fields/_form.html.erb +50 -52
  32. data/app/views/dynamic_fieldsets/fields/edit.html.erb +5 -2
  33. data/app/views/dynamic_fieldsets/fields/index.html.erb +1 -1
  34. data/app/views/dynamic_fieldsets/fields/new.html.erb +3 -1
  35. data/app/views/dynamic_fieldsets/fields/show.html.erb +1 -1
  36. data/app/views/dynamic_fieldsets/fieldsets/_child.html.erb +1 -1
  37. data/app/views/dynamic_fieldsets/form_partials/_checkbox_field.html.erb +8 -0
  38. data/app/views/dynamic_fieldsets/form_partials/_date_field.html.erb +1 -0
  39. data/app/views/dynamic_fieldsets/form_partials/_datetime_field.html.erb +1 -0
  40. data/app/views/dynamic_fieldsets/form_partials/_input_footer.html.erb +1 -0
  41. data/app/views/dynamic_fieldsets/form_partials/_input_header.html.erb +7 -0
  42. data/app/views/dynamic_fieldsets/form_partials/_instruction_field.html.erb +1 -0
  43. data/app/views/dynamic_fieldsets/form_partials/_multiple_select_field.html.erb +1 -0
  44. data/app/views/dynamic_fieldsets/form_partials/_radio_field.html.erb +8 -0
  45. data/app/views/dynamic_fieldsets/form_partials/_select_field.html.erb +1 -0
  46. data/app/views/dynamic_fieldsets/form_partials/_text_field.html.erb +1 -0
  47. data/app/views/dynamic_fieldsets/form_partials/_textarea_field.html.erb +1 -0
  48. data/app/views/dynamic_fieldsets/shared/_javascript_watcher.html.erb +8 -8
  49. data/app/views/dynamic_fieldsets/show_partials/_show_incomplete.html.erb +1 -0
  50. data/app/views/dynamic_fieldsets/show_partials/_show_incomplete_footer.html.erb +2 -0
  51. data/app/views/dynamic_fieldsets/show_partials/_show_incomplete_header.html.erb +1 -0
  52. data/app/views/dynamic_fieldsets/show_partials/_show_instruction.html.erb +1 -0
  53. data/app/views/dynamic_fieldsets/show_partials/_show_multiple_answers.html.erb +13 -0
  54. data/app/views/dynamic_fieldsets/show_partials/_show_single_answer.html.erb +8 -0
  55. data/autotest/discover.rb +2 -0
  56. data/dynamic_fieldsets.gemspec +74 -20
  57. data/lib/dynamic_fieldsets/config.rb +45 -0
  58. data/lib/dynamic_fieldsets/dynamic_fieldsets_in_model.rb +38 -63
  59. data/lib/dynamic_fieldsets/field_with_field_options.rb +58 -0
  60. data/lib/dynamic_fieldsets/field_with_multiple_answers.rb +89 -0
  61. data/lib/dynamic_fieldsets/field_with_single_answer.rb +84 -0
  62. data/lib/dynamic_fieldsets/railtie.rb +6 -1
  63. data/lib/generators/dynamic_fieldsets/install_generator.rb +3 -3
  64. data/lib/generators/dynamic_fieldsets/templates/config.rb +15 -0
  65. data/lib/generators/dynamic_fieldsets/templates/migrations/install_migration.rb +1 -1
  66. data/spec/dummy/config/initializers/dynamic_fieldsets.rb +15 -0
  67. data/spec/dummy/db/migrate/20120213211033_create_dynamic_fieldsets_tables.rb +1 -1
  68. data/spec/dummy/db/schema.rb +1 -1
  69. data/spec/dummy/features/step_definitions/field_steps.rb +4 -4
  70. data/spec/dummy/features/step_definitions/fieldset_children_steps.rb +2 -2
  71. data/spec/dummy/features/step_definitions/javascript_steps.rb +7 -7
  72. data/spec/dynamic_fieldsets_helper_spec.rb +278 -312
  73. data/spec/dynamic_fieldsets_in_model_spec.rb +2 -2
  74. data/spec/field_with_field_options_spec.rb +49 -0
  75. data/spec/field_with_multiple_answers_spec.rb +50 -0
  76. data/spec/field_with_single_answer_spec.rb +51 -0
  77. data/spec/models/checkbox_field_spec.rb +19 -0
  78. data/spec/models/date_field_spec.rb +24 -0
  79. data/spec/models/datetime_field_spec.rb +24 -0
  80. data/spec/models/dependency_clause_spec.rb +7 -8
  81. data/spec/models/dependency_group_spec.rb +27 -30
  82. data/spec/models/dependency_spec.rb +8 -9
  83. data/spec/models/field_default_spec.rb +19 -14
  84. data/spec/models/field_html_attribute_spec.rb +3 -4
  85. data/spec/models/field_option_spec.rb +8 -9
  86. data/spec/models/field_record_spec.rb +8 -9
  87. data/spec/models/field_spec.rb +195 -94
  88. data/spec/models/fieldset_associator_spec.rb +39 -41
  89. data/spec/models/fieldset_child_spec.rb +99 -47
  90. data/spec/models/fieldset_spec.rb +25 -29
  91. data/spec/models/instruction_field_spec.rb +38 -0
  92. data/spec/models/multiple_select_field_spec.rb +31 -0
  93. data/spec/models/radio_field_spec.rb +21 -0
  94. data/spec/models/text_field_spec.rb +19 -0
  95. data/spec/models/textarea_field_spec.rb +39 -0
  96. data/spec/support/field_helper.rb +1 -1
  97. metadata +106 -28
@@ -0,0 +1,58 @@
1
+ module DynamicFieldsets
2
+ # Adds methods to a model extending DynamicFieldsets::Field so that it works with field options
3
+ # when saving and accessing data
4
+ module FieldWithFieldOptions
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ end
8
+
9
+ module ClassMethods
10
+ def acts_as_field_with_field_options(args = {})
11
+ validate :at_least_one_field_option
12
+ include DynamicFieldsets::FieldWithFieldOptions::InstanceMethods
13
+ end
14
+ end
15
+
16
+ module InstanceMethods
17
+
18
+ # Collects the field records for the field so they can be used on the front end
19
+ # These are only the currently saved values in the database, don't worry
20
+ # about defaults here
21
+ #
22
+ # Converts the ids into field option names for :name part of the return hash
23
+ #
24
+ # @return [Array] An array of field record values
25
+ def collect_field_records_by_fsa_and_fsc(fsa, fsc)
26
+ records = DynamicFieldsets::FieldRecord.where(:fieldset_associator_id => fsa.id, :fieldset_child_id => fsc.id)
27
+ return records.collect do |r|
28
+ {
29
+ :value => r.value,
30
+ :name => DynamicFieldsets::FieldOption.find(r.value.to_i).name
31
+ }
32
+ end
33
+ end
34
+
35
+ # given a value hash for a field, return the part that needs to be shown on the show page
36
+ def get_value_for_show(value)
37
+ value[:name]
38
+ end
39
+
40
+ def uses_field_options?
41
+ true
42
+ end
43
+
44
+ # validation for field options
45
+ def at_least_one_field_option
46
+ if self.field_options.empty?
47
+ self.errors.add(:field_options, "This field must have options")
48
+ end
49
+ end
50
+
51
+ # @return [FieldOptions] Returns all field options that are enabled
52
+ def options
53
+ return self.field_options.reject{ |option| !option.enabled }
54
+ end
55
+ end
56
+ end
57
+ end
58
+
@@ -0,0 +1,89 @@
1
+ module DynamicFieldsets
2
+ module FieldWithMultipleAnswers
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ def acts_as_field_with_multiple_answers(args = {})
9
+ include DynamicFieldsets::FieldWithMultipleAnswers::InstanceMethods
10
+ end
11
+ end
12
+
13
+ module InstanceMethods
14
+
15
+ def show_partial_locals(args)
16
+ output = super(args)
17
+ output[:values] = args[:values].collect { |value| get_value_for_show(value) }
18
+ return output
19
+ end
20
+
21
+ # Updates the field records for the field based on the given values
22
+ #
23
+ # Manages multiple records
24
+ #
25
+ # @param [DynamicFieldsets::FieldsetAssociator] fsa The associator the value is attached to
26
+ # @param [DynamicFieldsets::FieldsetChild] fieldset_child The fieldset child for the value
27
+ # @param [Array or String] value The new values inputted by the user from the form
28
+ def update_field_records(fsa, fieldset_child, values)
29
+ # make sure values is an array in case the input from the form is bad
30
+ throw "Form value type mismatch error: The value from the form must be Array for #{self.inspect}." unless values.is_a?(Array)
31
+
32
+ # create new records if the values are not in the db
33
+ values.each do |value|
34
+ if fieldset_child.field_records.select{ |record| record.value == value }.empty?
35
+ DynamicFieldsets::FieldRecord.create!( :fieldset_associator_id => fsa.id,
36
+ :fieldset_child_id => fieldset_child.id,
37
+ :value => value)
38
+ end
39
+ end
40
+
41
+ # remove records in the db that are not in the input values
42
+ # note that if a record is updated, it is treated as a creation and deletion instead of a single update
43
+ fieldset_child.field_records.each do |record|
44
+ if !values.include?(record.value)
45
+ record.destroy
46
+ end
47
+ end
48
+ end
49
+
50
+ # Gets the first field record matching the parameters
51
+ #
52
+ # @param [DynamicFieldsets::FieldsetAssociator] fsa The associator
53
+ # @param [DynamicFieldsets::FieldsetChild] fsc The fieldset child
54
+ # @return [Array] An array of field records
55
+ def get_values_using_fsa_and_fsc(fsa, fsc)
56
+ collect_field_records_by_fsa_and_fsc(fsa, fsc)
57
+ end
58
+
59
+ # @return [String] Default multiple answer partial filename
60
+ def show_partial
61
+ "/dynamic_fieldsets/show_partials/show_multiple_answers"
62
+ end
63
+
64
+ # Returns a list of values for the form
65
+ #
66
+ # Only returns the :value part of the input
67
+ #
68
+ # @param [Array] values A list of values for the field already saved to the database
69
+ # @return [Array] An array of field option values saved in the db, or the defaults if none are in the db
70
+ def values_or_defaults_for_form(values)
71
+ if values.nil? || values.empty?
72
+ if field_defaults.length == 0
73
+ return []
74
+ else
75
+ return collect_default_values
76
+ end
77
+ else
78
+ return values.collect { |v| v[:value] }
79
+ end
80
+ end
81
+
82
+ # @return [Array] Alias for field_defaults
83
+ def defaults
84
+ return self.field_defaults if options?
85
+ return nil
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,84 @@
1
+ module DynamicFieldsets
2
+ module FieldWithSingleAnswer
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ def acts_as_field_with_single_answer(args = {})
9
+ include DynamicFieldsets::FieldWithSingleAnswer::InstanceMethods
10
+ end
11
+ end
12
+
13
+ module InstanceMethods
14
+
15
+ def show_partial_locals(args)
16
+ output = super(args)
17
+ output[:value] = get_value_for_show(args[:value])
18
+ return output
19
+ end
20
+
21
+ # Updates the field records for the field based on the given values
22
+ #
23
+ # Saves or updates a single field record
24
+ #
25
+ # @param [DynamicFieldsets::FieldsetAssociator] fsa The associator the value is attached to
26
+ # @param [DynamicFieldsets::FieldsetChild] fieldset_child The fieldset child for the value
27
+ # @param [Array or String] value The new values inputted by the user from the form
28
+ def update_field_records(fsa, fieldset_child, value)
29
+ # make sure the value is a string in case the input from the form is bad
30
+ throw "Form value type mismatch error: The value from the form must be String for #{self.inspect}." unless value.is_a?(String)
31
+
32
+ # retrieve record
33
+ field_record = DynamicFieldsets::FieldRecord.where(:fieldset_associator_id => fsa.id, :fieldset_child_id => fieldset_child.id).first
34
+ if field_record.nil?
35
+ # create record
36
+ DynamicFieldsets::FieldRecord.create!(
37
+ :fieldset_associator_id => fsa.id,
38
+ :fieldset_child_id => fieldset_child.id,
39
+ :value => value)
40
+ else
41
+ # update record
42
+ field_record.value = value
43
+ field_record.save
44
+ end
45
+ end
46
+
47
+ # Gets the first field record matching the parameters
48
+ #
49
+ # @param [DynamicFieldsets::FieldsetAssociator] fsa The associator
50
+ # @param [DynamicFieldsets::FieldsetChild] fsc The fieldset child
51
+ # @return [String] The first field record
52
+ def get_values_using_fsa_and_fsc(fsa, fsc)
53
+ collect_field_records_by_fsa_and_fsc(fsa, fsc).first
54
+ end
55
+
56
+ # @return [String] Default single answer partial filename
57
+ def show_partial
58
+ "/dynamic_fieldsets/show_partials/show_single_answer"
59
+ end
60
+
61
+ # @return [String] Alias for field_defaults.first
62
+ def default
63
+ return self.field_defaults.first
64
+ end
65
+
66
+ # Returns a list of values for the form
67
+ #
68
+ # @param [String] value A value for the field already saved to the database
69
+ # @return [String] A field option saved in the db, or the default if value is blank
70
+ def value_or_default_for_form(value)
71
+ if value.nil? || value[:value].nil?
72
+ if field_defaults.length == 0
73
+ return ""
74
+ else
75
+ return collect_default_values.first
76
+ end
77
+ else
78
+ value[:value]
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+
@@ -1,6 +1,5 @@
1
1
  require 'rails'
2
2
 
3
- # no configuration yet
4
3
  require 'dynamic_fieldsets/config'
5
4
 
6
5
  module DynamicFieldsets
@@ -8,6 +7,12 @@ module DynamicFieldsets
8
7
  initializer 'dynamic_fieldsets' do |app|
9
8
  require 'dynamic_fieldsets/dynamic_fieldsets_in_model'
10
9
  ActiveRecord::Base.send :include, DynamicFieldsets::DynamicFieldsetsInModel
10
+ require 'dynamic_fieldsets/field_with_field_options'
11
+ ActiveRecord::Base.send :include, DynamicFieldsets::FieldWithFieldOptions
12
+ require 'dynamic_fieldsets/field_with_multiple_answers'
13
+ ActiveRecord::Base.send :include, DynamicFieldsets::FieldWithMultipleAnswers
14
+ require 'dynamic_fieldsets/field_with_single_answer'
15
+ ActiveRecord::Base.send :include, DynamicFieldsets::FieldWithSingleAnswer
11
16
  end
12
17
  end
13
18
  end
@@ -15,7 +15,7 @@ module DynamicFieldsets
15
15
 
16
16
  desc <<DESC
17
17
  Description:
18
- Copies over migrations and config for the multipart form system.
18
+ Copies over migrations and config for the dynamic fieldsets system.
19
19
  DESC
20
20
 
21
21
  # Implement the required interface for Rails::Generators::Migration.
@@ -30,9 +30,9 @@ DESC
30
30
  end
31
31
 
32
32
  # Creates the config file
33
- # Commented out until the config actually has information
33
+ # Mostly commented out until the config actually has information
34
34
  def copy_config_file
35
- #copy_file "config.rb", "config/initializers/acts_as_multipart_form.rb"
35
+ copy_file "config.rb", "config/initializers/dynamic_fieldsets.rb"
36
36
  end
37
37
 
38
38
  # Creates the migration
@@ -0,0 +1,15 @@
1
+ DynamicFieldsets.configure do |config|
2
+ # If cache classes is off, this field needs to be set. Otherwise, rails issues
3
+ # can cause the single table inheritance to fail. This is due to the object
4
+ # space getting reset after every request. In production and test environemnts,
5
+ # this information will not be used because the object space will be complete.
6
+ # config.available_field_types = [ "DynamicFieldsets::CheckboxField", "DynamicFieldsets::"DateField", "DynamicFieldsets::"DatetimeField", "DynamicFieldsets::InstructionField", "DynamicFieldsets::MultipleSelectField", "DynamicFieldsets::RadioField", "DynamicFieldsets::SelectField", "DynamicFieldsets::TextField", "DynamicFieldsets::TextareaField" ]
7
+
8
+ # This should correspond to the beginning of the id for the fields for on the form
9
+ # For example: fsa-8
10
+ # config.form_fieldset_associator_prefix = "fsa-"
11
+
12
+ # This should correspond to the beginning of the field section of form inputs
13
+ # For example: fsa-8[field-7]
14
+ # config.form_field_prefix = "field-"
15
+ end
@@ -35,7 +35,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
35
35
  create_table :dynamic_fieldsets_fields do |t|
36
36
  t.string :name
37
37
  t.string :label, :required => true
38
- t.string :field_type, :required => true
38
+ t.string :type, :required => true
39
39
  t.boolean :required, :default => false
40
40
  t.boolean :enabled, :default => true
41
41
 
@@ -0,0 +1,15 @@
1
+ DynamicFieldsets.configure do |config|
2
+ # If cache classes is off, this field needs to be set. Otherwise, rails issues
3
+ # can cause the single table inheritance to fail. This is due to the object
4
+ # space getting reset after every request. In production and test environemnts,
5
+ # this information will not be used because the object space will be complete.
6
+ # config.available_field_types = [ "DynamicFieldsets::CheckboxField", "DynamicFieldsets::"DateField", "DynamicFieldsets::"DatetimeField", "DynamicFieldsets::InstructionField", "DynamicFieldsets::MultipleSelectField", "DynamicFieldsets::RadioField", "DynamicFieldsets::SelectField", "DynamicFieldsets::TextField", "DynamicFieldsets::TextareaField" ]
7
+
8
+ # This should correspond to the beginning of the id for the fields for on the form
9
+ # For example: fsa-8
10
+ # config.form_fieldset_associator_prefix = "fsa-"
11
+
12
+ # This should correspond to the beginning of the field section of form inputs
13
+ # For example: fsa-8[field-7]
14
+ # config.form_field_prefix = "field-"
15
+ end
@@ -35,7 +35,7 @@ class CreateDynamicFieldsetsTables < ActiveRecord::Migration
35
35
  create_table :dynamic_fieldsets_fields do |t|
36
36
  t.string :name
37
37
  t.string :label, :required => true
38
- t.string :field_type, :required => true
38
+ t.string :type, :required => true
39
39
  t.boolean :required, :default => false
40
40
  t.boolean :enabled, :default => true
41
41
 
@@ -84,7 +84,7 @@ ActiveRecord::Schema.define(:version => 20120213211033) do
84
84
  create_table "dynamic_fieldsets_fields", :force => true do |t|
85
85
  t.string "name"
86
86
  t.string "label"
87
- t.string "field_type"
87
+ t.string "type"
88
88
  t.boolean "required", :default => false
89
89
  t.boolean "enabled", :default => true
90
90
  t.datetime "created_at"
@@ -2,7 +2,7 @@ Given /^a field exists$/ do
2
2
  @field = DynamicFieldsets::Field.create(
3
3
  :name => "Test field",
4
4
  :label => "Test field",
5
- :field_type => "textfield",
5
+ :type => "textfield",
6
6
  :enabled => true,
7
7
  :required => true)
8
8
  end
@@ -26,14 +26,14 @@ end
26
26
  Then /^I should see that field listed$/ do
27
27
  @field = DynamicFieldsets::Field.last
28
28
  page.should have_content(@field.name)
29
- page.should have_content(@field.field_type)
29
+ page.should have_content(@field.type)
30
30
  end
31
31
 
32
32
  Then /^I should see the data for that field$/ do
33
33
  @field = DynamicFieldsets::Field.last
34
34
  page.should have_content(@field.name)
35
35
  page.should have_content(@field.label)
36
- page.should have_content(@field.field_type)
36
+ page.should have_content(@field.type)
37
37
  page.should have_content(@field.enabled)
38
38
  page.should have_content(@field.required)
39
39
 
@@ -63,5 +63,5 @@ end
63
63
 
64
64
  Then /^I should not see that field listed$/ do
65
65
  page.should_not have_content(@field.name)
66
- page.should_not have_content(@field.field_type)
66
+ page.should_not have_content(@field.type)
67
67
  end
@@ -19,7 +19,7 @@ def create_child_field(parent, order_num = 1)
19
19
  child_field = DynamicFieldsets::Field.create(
20
20
  :name => "Child Field",
21
21
  :label => "Child Field",
22
- :field_type => "textfield",
22
+ :type => "textfield",
23
23
  :enabled => true,
24
24
  :required => true)
25
25
  DynamicFieldsets::FieldsetChild.create(:fieldset => parent, :child => child_field, :order_num => order_num)
@@ -55,7 +55,7 @@ end
55
55
  Then /^I should see the child field information$/ do
56
56
  @child_field = DynamicFieldsets::Field.last
57
57
  page.should have_content(@child_field.name)
58
- page.should have_content(@child_field.field_type)
58
+ page.should have_content(@child_field.type)
59
59
  end
60
60
 
61
61
  Then /^I should see the child fieldset information$/ do
@@ -19,7 +19,7 @@ def create_textfield(parent, order_num = 1)
19
19
  child_field = DynamicFieldsets::Field.create(
20
20
  :name => "Child Field",
21
21
  :label => "Child Field",
22
- :field_type => "textfield",
22
+ :type => "textfield",
23
23
  :enabled => true,
24
24
  :required => true)
25
25
  DynamicFieldsets::FieldsetChild.create(:fieldset => parent, :child => child_field, :order_num => order_num)
@@ -30,7 +30,7 @@ def create_radio(parent, order_num = 1)
30
30
  child_field = DynamicFieldsets::Field.create(
31
31
  :name => "Child Field",
32
32
  :label => "Child Field",
33
- :field_type => "radio",
33
+ :type => "radio",
34
34
  :enabled => true,
35
35
  :required => true,
36
36
  :field_options => [DynamicFieldsets::FieldOption.create(
@@ -47,7 +47,7 @@ def create_textarea(parent, order_num = 1)
47
47
  child_field = DynamicFieldsets::Field.create(
48
48
  :name => "Child Field",
49
49
  :label => "Child Field",
50
- :field_type => "textarea",
50
+ :type => "textarea",
51
51
  :enable => true,
52
52
  :required => true)
53
53
  DynamicFieldsets::FieldsetChild.create(:fieldset => parent, :child => child_field, :order_num => order_num)
@@ -58,7 +58,7 @@ def create_checkbox(parent, order_num = 1)
58
58
  child_field = DynamicFieldsets::Field.create(
59
59
  :name => "Child Field",
60
60
  :label => "Child Field",
61
- :field_type => "checkbox",
61
+ :type => "checkbox",
62
62
  :enable => true,
63
63
  :required => true,
64
64
  :field_options => [DynamicFieldsets::FieldOption.create(
@@ -75,7 +75,7 @@ def create_select(parent, order_num = 1)
75
75
  child_field = DynamicFieldsets::Field.create(
76
76
  :name => "Child Field",
77
77
  :label => "Child Field",
78
- :field_type => "select",
78
+ :type => "select",
79
79
  :enable => true,
80
80
  :required => true,
81
81
  :field_options => [DynamicFieldsets::FieldOption.create(
@@ -92,7 +92,7 @@ def create_multi_select(parent, order_num = 1)
92
92
  child_field = DynamicFieldsets::Field.create(
93
93
  :name => "Child Field",
94
94
  :label => "Child Field",
95
- :field_type => "multiple_select",
95
+ :type => "multiple_select",
96
96
  :enable => true,
97
97
  :required => true,
98
98
  :field_options => [DynamicFieldsets::FieldOption.create(
@@ -111,7 +111,7 @@ def create_instruction(parent, order_num = 2)
111
111
  child_field = DynamicFieldsets::Field.create(
112
112
  :name => "Dependent Field",
113
113
  :label => "Dependent Field",
114
- :field_type => "instruction",
114
+ :type => "instruction",
115
115
  :enable => true,
116
116
  :required => true
117
117
  )