Module: UsersHelper
- Defined in:
- app/helpers/users_helper.rb
Instance Method Summary collapse
- #attitudes_for_select ⇒ Object
- #editorial_user_link(user) ⇒ Object
- #marital_status_for_user(user) ⇒ Object
- #marital_status_name(gender_key, key) ⇒ Object
- #marital_statuses_for_select(gender_key) ⇒ Object
Instance Method Details
#attitudes_for_select ⇒ Object
2 3 4 5 |
# File 'app/helpers/users_helper.rb', line 2 def attitudes_for_select = [[t(:not_selected), '']] + (-2..1).map { |o| [t("attitudes.#{o}"), o]} end |
#editorial_user_link(user) ⇒ Object
32 33 34 35 36 |
# File 'app/helpers/users_helper.rb', line 32 def editorial_user_link(user) return t(:anonymous) if user.nil? text = user.profile_name link_to text, editorial_user_path(id: user.id), class: 'profile' end |
#marital_status_for_user(user) ⇒ Object
27 28 29 |
# File 'app/helpers/users_helper.rb', line 27 def marital_status_for_user(user) marital_status_name(user.data.dig('profile', 'gender'), user.data.dig('profile', 'marital_status')) end |
#marital_status_name(gender_key, key) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/users_helper.rb', line 15 def marital_status_name(gender_key, key) gender = UserProfileHandler::GENDERS[gender_key] prefix = 'activerecord.attributes.user_profile.marital_statuses.' prefix << (gender.blank? ? 'default' : gender) if UserProfileHandler::MARITAL.key?(key) t("#{prefix}.#{UserProfileHandler::MARITAL[key]}") else t(:not_selected) end end |
#marital_statuses_for_select(gender_key) ⇒ Object
8 9 10 11 |
# File 'app/helpers/users_helper.rb', line 8 def marital_statuses_for_select(gender_key) = [[t(:not_selected), '']] + UserProfileHandler::MARITAL.keys.map { |o| [marital_status_name(gender_key, o), o] } end |