From 6b105274af5fb0b683b08ec58833e3d416993bec Mon Sep 17 00:00:00 2001 From: Akash Agrawall Date: Mon, 9 Feb 2015 02:12:36 +0530 Subject: [PATCH] Technical limitation of how old one can be on D* 5373 --- app/helpers/profile_helper.rb | 15 +++++++++++++++ app/views/profiles/_edit.haml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 app/helpers/profile_helper.rb diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb new file mode 100644 index 000000000..20351d620 --- /dev/null +++ b/app/helpers/profile_helper.rb @@ -0,0 +1,15 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + +module ProfileHelper + def upper_limit_date_of_birth + minimum_year = AppConfig.settings.terms.minimum_age.get + minimum_year = minimum_year ? minimum_year.to_i : 13 + minimum_year.years.ago.year + end + + def lower_limit_date_of_birth + 125.years.ago.year + end +end diff --git a/app/views/profiles/_edit.haml b/app/views/profiles/_edit.haml index e8d71d505..6c1f63dce 100644 --- a/app/views/profiles/_edit.haml +++ b/app/views/profiles/_edit.haml @@ -35,7 +35,7 @@ = t('profiles.edit.your_birthday') .row-fluid - = select_date profile.birthday, { :prompt => true, :default => true, :order => t('date.order'), :start_year => 2000, :end_year => 1910, :prefix => 'profile[date]' }, { :class => 'span4' } + = select_date profile.birthday, { :prompt => true, :default => true, :order => t('date.order'), :start_year => upper_limit_date_of_birth, :end_year => lower_limit_date_of_birth, :prefix => 'profile[date]' }, { :class => 'span4' } .small-horizontal-spacer