Permalink
Browse files

Add field host checkbox fields to about_you step

  • Loading branch information...
1 parent 53908c6 commit b2f20587396c3c7845cedb80f307981a09283f4a @lapluviosilla lapluviosilla committed Sep 30, 2013
View
@@ -4,7 +4,8 @@ class FieldHost < ActiveRecord::Base
salesforce "Contact", [:first_name, :last_name, :salutation, :preferred_phone, :phone_type]
attr_accessible :first_name, :middle_initial, :last_name, :salutation,
- :email, :role_title, :years_associated_with_organization, :preferred_phone, :phone_type
+ :email, :role_title, :years_associated_with_organization, :preferred_phone, :phone_type,
+ :experience_with_ywam, :heard_about_ipo, :overall_education, :role_title
serialize :properties, ActiveRecord::Coders::Hstore
@@ -14,6 +15,20 @@ class FieldHost < ActiveRecord::Base
enumerize :phone_type, in: %w(Work Household Mobile Other)
enumerize :salutation, in: %w(Mr. Ms. Dr. Prof. Rev.)
+ %w(overall_education).each do |f|
+ enumerize f, in: I18n.t("enumerize.field_host.#{f}")
+ end
+
+ %w(experience_with_ywam heard_about_ipo).each do |f|
+ enumerize f, in: I18n.t("enumerize.field_host.#{f}"), multiple: true
+
+ define_method "#{f}_with_deserialize" do
+ value = send("#{f}_without_deserialize")
+ value = JSON.parse(send("#{f}_without_deserialize")) if value && value.is_a?(String)
+ end
+ alias_method_chain f, :deserialize
+ end
+
belongs_to :organization
has_many :projects
View
@@ -31,7 +31,6 @@ class Project < ActiveRecord::Base
end
%w(required_languages related_student_passions related_fields_of_study student_educational_requirement).each do |f|
- # serialize f.to_sym, Array
enumerize f, in: I18n.t("enumerize.project." + f), multiple: true
define_method "#{f}_with_deserialize" do
@@ -39,5 +39,8 @@
= f.fields_for :field_host do |f_field_host|
= f_field_host.input :role_title
= f_field_host.input :years_associated_with_organization
+ = f_field_host.input :overall_education
+ = f_field_host.input :experience_with_ywam, as: :check_boxes
+ = f_field_host.input :heard_about_ipo, as: :check_boxes
= f.submit "Save & Continue to Step #2", class: "button button-orange"
@@ -2,9 +2,9 @@ en:
enumerize:
field_host:
experience_with_ywam:
- - YWAM DTS
- - Secondary YWAM/UofN Schools
- - YWAM Short Term Outreach (Only)
+ ywam_dts: YWAM DTS
+ secondary_ywam_schools: Secondary YWAM/UofN Schools
+ ywam_short_term_outreach: YWAM Short Term Outreach (Only)
heard_about_ipo:
- College Group
- YWAM Staff

0 comments on commit b2f2058

Please sign in to comment.