Module ProfilesHelper
In: app/helpers/profiles_helper.rb

Methods

Public Instance methods

[Source]

    # File app/helpers/profiles_helper.rb, line 18
18:   def abroad
19:     format_question('abroad', ['none', 'little', 'medium', 'large'])
20:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 31
31:   def country_from_code(code)
32:     found = COUNTRIES.find { |el| el.last == code }
33:     found && found.first
34:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 46
46:   def country_select_with_guess(sel_options)
47:     options = unset_select?(sel_options) ? sel_options.merge(:selected => @controller.current_visit.ip_country_code) : sel_options
48:     country_select(:profile, :country, Constants::Countries::PRIORITY, options)
49:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 51
51:   def date_select_with_guess(sel_options)
52:     options = unset_select?(sel_options) ? sel_options.merge(:selected => Time.now.year - 19) : sel_options
53:     date_select(:profile, :date_of_birth, {
54:         :discard_day => true,
55:         :discard_month => true,
56:         :start_year => Time.now.year,
57:         :end_year => 1900,
58:         :order => [:year],
59:       }.merge(options)
60:     )
61:   end

[Source]

   # File app/helpers/profiles_helper.rb, line 2
2:   def education
3:     format_question('edu', ['none', 'middle', 'high', 'college', 'grad'])
4:   end

[Source]

   # File app/helpers/profiles_helper.rb, line 6
6:   def gender
7:     format_question('gen', ['man', 'woman', 'other'])
8:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 10
10:   def language
11:     format_question('lan', ['chinese_s', 'chinese_t', 'chinese_sh', 'chinese_ct', 'japanese', 'english', 'other'])
12:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 14
14:   def location
15:     format_question('loc', ['work', 'home', 'school', 'other'])
16:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 36
36:   def profile_questions(sel_options)
37:     ['gender', 'language', 'education'].map do |el|
38:       sel_options[:selected] = profile_value(@profile, el)
39:       [el, select(:profile_question, el.to_sym, send(el), sel_options)]
40:     end + [
41:       # ['add_languages', "<p>#{text_area(:profile_question, :add_lang, :size => '40x2', :value => profile_value(@profile, 'add_lang'))}</p>"],
42:       # ['profession', text_field(:profile_question, :profession, :value => profile_value(@profile, 'profession'))],
43:       ['birth_country', country_select(:profile_question, :birth_country, Constants::Countries::PRIORITY, sel_options.merge(:selected => profile_value(@profile, 'birth_country')))]]
44:   end

[Source]

    # File app/helpers/profiles_helper.rb, line 22
22:   def profile_value(profile, name)
23:     if profile && !profile.new_record?
24:       q = profile.profile_questions.find_by_name(name)
25:       q && q.value
26:     elsif name == 'language'
27:       Constants::Locales::ALL.invert.fetch(I18n.locale)
28:     end
29:   end

[Validate]