Sha256: 10d7efa36d7c72fbdce43d5f2787f39219dd18ca5ef845c60fb8295412a1e035

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

class CreateDefaultDynamicModelsAndForms
  
  def self.up
    #insert data here
    DynamicFormModel.create(:model_name => 'DynamicFormDocument')

    fields = []

    fields << DynamicFormField.textfield({:fieldLabel => 'First Name', :name => 'first_name', :width => 250, :allowBlank => false })
    fields << DynamicFormField.textfield({:fieldLabel => 'Last Name', :name => 'last_name', :width => 250, :allowBlank => false })
    fields << DynamicFormField.email({:fieldLabel => 'Email', :name => 'email', :width => 250, :allowBlank => false })
    fields << DynamicFormField.textarea({:fieldLabel => 'Message', :name => 'message', :width => 400, :height => 200, :allowBlank => false })    

    d = DynamicForm.new
    d.description = 'Contact Form'
    d.definition = fields.to_json
    d.model_name = 'WebsiteInquiry'
    d.internal_identifier = 'contact_us'
    d.default = true
    d.dynamic_form_model = DynamicFormModel.create(:model_name => 'WebsiteInquiry')
    d.comment = "This is the default form used by Knitkit's Contact Us Widget for Website Inquiries. NOTE: The Contact Us Widget uses Knitkit's website configuration options for email behavior & not the Dynamic Forms Widget Action setting."
    d.msg_target = 'qtip'
    d.save
  end
  
  def self.down
    #remove data here
    DynamicFormModel.delete_all
    DynamicForm.delete_all
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
erp_forms-3.1.2 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb
erp_forms-3.1.1 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb
erp_forms-3.1.0 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb
erp_forms-3.0.2 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb
erp_forms-3.0.1 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb
erp_forms-3.0.0 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb
erp_forms-2.1.0 db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.rb