Created
May 18, 2014 03:20
-
-
Save pencilcheck/e94d42ca16d0e409cbc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register User do | |
permit_params :email, :password, :password_confirmation, :name, :about, :location, :contract_length, :company_id, :fun_fact, :commitment_ids, :signed_in_at, :paypal_credit_card_id, :imported_from_linkedin_at, skills_attributes: [:id, :skill_level, :years_of_experience, :details, :specialty_id], accomplishments_attributes: [:id, :content], links_attributes: [:id, :meta, :url], education_attributes: [:id, :school, :degree, :year] | |
index do | |
selectable_column | |
id_column | |
column :email | |
column :password_digest | |
column :name | |
column :about | |
column :location | |
column :contract_length | |
column :company | |
column :commitments do |job_post| | |
job_post.commitments.map {|commitment| commitment.commitment_type.name} | |
end | |
column :skills do |user| | |
user.skills.map {|skill| 'level: ' + skill.skill_level.to_s + ', years: ' + skill.years_of_experience.to_s + ' specialty: ' + (skill.specialty.nil? ? 'nil' : skill.specialty.name)} | |
end | |
column :accomplishments do |user| # embeds don't need id | |
user.accomplishments.map {|accomplishment| accomplishment.content} | |
end | |
column :links do |user| # embeds don't need id | |
user.links.map {|link| link.meta + ' <> ' + link.url} | |
end | |
column :education do |user| # embeds don't need id | |
'Majoring in ' + user.education.degree + ', ' + user.education.school + ' ' + user.education.year.to_s | |
end | |
column :fun_fact | |
column :signed_in_at | |
column :paypal_credit_card_id | |
column :imported_from_linkedin_at | |
actions | |
end | |
show do |ad| | |
attributes_table do | |
row :email | |
row :password_digest | |
row :name | |
row :about | |
row :location | |
row :contract_length | |
row :company | |
row :commitments do | |
ad.commitments.map {|commitment| commitment.commitment_type.name} | |
end | |
row :skills do | |
ad.skills.map {|skill| 'level: ' + skill.skill_level.to_s + ', years: ' + skill.years_of_experience.to_s + ' specialty: ' + skill.specialty.name} | |
end | |
row :accomplishments do # embeds don't need id | |
ad.accomplishments.map {|accomplishment| accomplishment.content} | |
end | |
row :links do # embeds don't need id | |
ad.links.map {|link| link.meta + ' <> ' + link.url} | |
end | |
row :education do # embeds don't need id | |
'Majoring in ' + ad.education.degree + ', ' + ad.education.school + ' ' + ad.education.year.to_s | |
end | |
row :fun_fact | |
row :signed_in_at | |
row :paypal_credit_card_id | |
row :imported_from_linkedin_at | |
end | |
end | |
form do |f| | |
f.inputs "User Details" do | |
f.input :email | |
f.input :password | |
f.input :password_confirmation | |
f.input :name | |
f.input :about | |
f.input :location | |
f.input :contract_length | |
f.input :company | |
f.input :commitments, as: :check_boxes, collection: CommitmentType.all, member_value: Proc.new {|commitment_type| f.object.commitments.build({user: f.object, commitment_type: commitment_type}).id} | |
f.has_many :accomplishments do |ff| | |
ff.input :content | |
end | |
f.has_many :links do |ff| | |
ff.input :meta | |
ff.input :url | |
end | |
f.has_many :skills do |ff| | |
ff.input :skill_level | |
ff.input :years_of_experience | |
ff.input :details | |
ff.input :specialty | |
end | |
f.input :fun_fact | |
f.inputs name: "User Education", for: [:education, f.object.education || Education.new] do |ff| | |
ff.input :school | |
ff.input :degree | |
ff.input :year | |
end | |
end | |
f.actions | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment