added birthday and gender to Profile. fixed a view issue on getting_started#2

This commit is contained in:
danielvincent 2010-10-28 11:01:16 -07:00
parent 06654b13b2
commit bb9a6e47a4
5 changed files with 23 additions and 3 deletions

View file

@ -41,6 +41,12 @@ class PeopleController < ApplicationController
end end
def update def update
# convert date selector into proper timestamp
birthday = params[:date]
if birthday
params[:person][:profile][:birthday] ||= Date.parse("#{birthday[:year]}-#{birthday[:month]}-#{birthday[:day]}")
end
prep_image_url(params[:person]) prep_image_url(params[:person])
if current_user.update_profile params[:person][:profile] if current_user.update_profile params[:person][:profile]

View file

@ -12,11 +12,15 @@ class Profile
xml_reader :first_name xml_reader :first_name
xml_reader :last_name xml_reader :last_name
xml_reader :image_url xml_reader :image_url
xml_reader :birthday
xml_reader :gender
xml_reader :bio xml_reader :bio
key :first_name, String key :first_name, String
key :last_name, String key :last_name, String
key :image_url, String key :image_url, String
key :birthday, Date
key :gender, String
key :bio, String key :bio, String
after_validation :strip_names after_validation :strip_names

View file

@ -26,10 +26,15 @@
= profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name" = profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name"
= profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name" = profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name"
%h4
Your gender
%br
= select_tag 'person[profile][gender]', options_for_select(["","Female","Male"], @person.profile.gender)
%h4 %h4
Your birthday Your birthday
%br %br
= date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year = select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000
%h4 %h4
Your bio Your bio

View file

@ -17,10 +17,15 @@
= profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name" = profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First name"
= profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name" = profile.text_field :last_name, :value => @profile.last_name, :placeholder => "Last name"
%h4
Your gender
%br
= select_tag 'person[profile][gender]', options_for_select(["","Female","Male"], @person.profile.gender)
%h4 %h4
Your birthday Your birthday
%br %br
= date_select person, :birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => Time.now.year = select_date @person.profile.birthday, :order => [:month, :day, :year], :start_year => 1930, :end_year => 2000
%h4 %h4
Your bio Your bio

View file

@ -19,7 +19,7 @@
%li{:style=>"position:relative;"} %li{:style=>"position:relative;"}
= aspect = aspect
.friend_pictures.horizontal .friend_pictures.horizontal
- for friend in aspect.people - for friend in aspect.person_objects
= person_image_link(friend) = person_image_link(friend)
= link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button' = link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button'