From bb9a6e47a4af4bf7fa50f48cd7a868fd28e1ad81 Mon Sep 17 00:00:00 2001 From: danielvincent Date: Thu, 28 Oct 2010 11:01:16 -0700 Subject: [PATCH] added birthday and gender to Profile. fixed a view issue on getting_started#2 --- app/controllers/people_controller.rb | 6 ++++++ app/models/profile.rb | 4 ++++ app/views/people/edit.html.haml | 7 ++++++- app/views/users/getting_started/_step_1.html.haml | 7 ++++++- app/views/users/getting_started/_step_2.html.haml | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 512f47ed2..f76f1c6e6 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -41,6 +41,12 @@ class PeopleController < ApplicationController end 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]) if current_user.update_profile params[:person][:profile] diff --git a/app/models/profile.rb b/app/models/profile.rb index 7258c4bfd..8848cd823 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -12,11 +12,15 @@ class Profile xml_reader :first_name xml_reader :last_name xml_reader :image_url + xml_reader :birthday + xml_reader :gender xml_reader :bio key :first_name, String key :last_name, String key :image_url, String + key :birthday, Date + key :gender, String key :bio, String after_validation :strip_names diff --git a/app/views/people/edit.html.haml b/app/views/people/edit.html.haml index 11a3986f5..29e10d757 100644 --- a/app/views/people/edit.html.haml +++ b/app/views/people/edit.html.haml @@ -26,10 +26,15 @@ = profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First 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 Your birthday %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 Your bio diff --git a/app/views/users/getting_started/_step_1.html.haml b/app/views/users/getting_started/_step_1.html.haml index d57d0b119..7778a39f8 100644 --- a/app/views/users/getting_started/_step_1.html.haml +++ b/app/views/users/getting_started/_step_1.html.haml @@ -17,10 +17,15 @@ = profile.text_field :first_name, :value => @profile.first_name, :placeholder => "First 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 Your birthday %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 Your bio diff --git a/app/views/users/getting_started/_step_2.html.haml b/app/views/users/getting_started/_step_2.html.haml index 3935cd760..bed14bd33 100644 --- a/app/views/users/getting_started/_step_2.html.haml +++ b/app/views/users/getting_started/_step_2.html.haml @@ -19,7 +19,7 @@ %li{:style=>"position:relative;"} = aspect .friend_pictures.horizontal - - for friend in aspect.people + - for friend in aspect.person_objects = person_image_link(friend) = link_to (image_tag('add_friend_button.png', :title => "add to #{aspect}")), "#add_request_pane", :class => 'add_request_button'