you can now unset the year of your birthday"

This commit is contained in:
maxwell 2010-12-17 18:05:13 -08:00
parent 96b907122b
commit b3c63a3cc0
4 changed files with 13 additions and 5 deletions

View file

@ -19,4 +19,12 @@ module PeopleHelper
I18n.t "people.helper.people_on_pod_are_aware_of"
end
end
def birthday_format(bday)
if bday.year == 1000
bday.strftime("%B %d")
else
bday.strftime("%B %d %Y")
end
end
end

View file

@ -88,10 +88,11 @@ class Profile
end
def date= params
if ['year', 'month', 'day'].all? { |key| params[key].present? }
params['year'] = '1000' if params['year'].blank?
if ['month', 'day'].all? { |key| params[key].present? }
date = Date.new(params['year'].to_i, params['month'].to_i, params['day'].to_i)
self.birthday = date
elsif ['year', 'month', 'day'].all? { |key| params[key] == '' }
elsif ['month', 'day'].all? { |key| params[key].blank? }
self.birthday = nil
end
end

View file

@ -54,5 +54,4 @@
- unless person.profile.birthday.blank?
%h3
=t('.born')
= t('ago', :time => time_ago_in_words(person.profile.birthday)) if @person.profile.birthday
= birthday_format(person.profile.birthday)

View file

@ -366,7 +366,7 @@ en:
edit_my_profile: "Edit my profile"
bio: "bio"
gender: "gender"
born: "born"
born: "birthday"
in_aspects: "in aspects"
cannot_remove: "Cannot remove %{name} from last aspect. (If you want to disconnect from this person you must remove contact.)"
remove_from: "Remove %{name} from %{aspect}?"