Module: ProfilesHelper
- Defined in:
- app/helpers/profiles_helper.rb
Instance Method Summary collapse
- #attribute_provider_label(attribute) ⇒ Object
- #availability_values ⇒ Object
- #commit_email_select_options(user) ⇒ Object
- #middle_dot_divider_classes(stacking, breakpoint) ⇒ Object
-
#prevent_delete_account? ⇒ Boolean
Overridden in EE::ProfilesHelper#prevent_delete_account?.
-
#ssh_key_expiration_policy_enabled? ⇒ Boolean
Overridden in EE::ProfilesHelper#ssh_key_expiration_policy_enabled?.
-
#ssh_key_expiration_tooltip(key) ⇒ Object
Overridden in EE::ProfilesHelper#ssh_key_expiration_tooltip.
-
#ssh_key_expires_field_description ⇒ Object
Overridden in EE::ProfilesHelper#ssh_key_expires_field_description.
- #ssh_key_usage_types ⇒ Object
- #user_profile? ⇒ Boolean
- #user_profile_data(user) ⇒ Object
Instance Method Details
#attribute_provider_label(attribute) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/profiles_helper.rb', line 15 def attribute_provider_label(attribute) = current_user. if &.synced?(attribute) if .provider Gitlab::Auth::OAuth::Provider.label_for(.provider) else 'LDAP' end end end |
#availability_values ⇒ Object
30 31 32 |
# File 'app/helpers/profiles_helper.rb', line 30 def availability_values Types::AvailabilityEnum.enum end |
#commit_email_select_options(user) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/profiles_helper.rb', line 4 def (user) private_email = user.private_commit_email verified_emails = user.verified_emails - [private_email] [ [s_('Use primary email (%{email})') % { email: user.email }, ''], [s_("Profiles|Use a private email - %{email}").html_safe % { email: private_email }, Gitlab::PrivateCommitEmail::TOKEN], *verified_emails ] end |
#middle_dot_divider_classes(stacking, breakpoint) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/helpers/profiles_helper.rb', line 34 def middle_dot_divider_classes(stacking, breakpoint) ['gl-mb-3'].tap do |classes| if stacking classes.concat(%w[middle-dot-divider-sm gl-display-block gl-sm-display-inline-block]) else classes << 'gl-display-inline-block' classes << if breakpoint.nil? 'middle-dot-divider' else "middle-dot-divider-#{breakpoint}" end end end end |
#prevent_delete_account? ⇒ Boolean
Overridden in EE::ProfilesHelper#prevent_delete_account?
73 74 75 |
# File 'app/helpers/profiles_helper.rb', line 73 def prevent_delete_account? false end |
#ssh_key_expiration_policy_enabled? ⇒ Boolean
Overridden in EE::ProfilesHelper#ssh_key_expiration_policy_enabled?
68 69 70 |
# File 'app/helpers/profiles_helper.rb', line 68 def ssh_key_expiration_policy_enabled? false end |
#ssh_key_expiration_tooltip(key) ⇒ Object
Overridden in EE::ProfilesHelper#ssh_key_expiration_tooltip
58 59 60 |
# File 'app/helpers/profiles_helper.rb', line 58 def ssh_key_expiration_tooltip(key) return key.errors..join(', ') if key.errors..any? end |
#ssh_key_expires_field_description ⇒ Object
Overridden in EE::ProfilesHelper#ssh_key_expires_field_description
63 64 65 |
# File 'app/helpers/profiles_helper.rb', line 63 def ssh_key_expires_field_description s_('Profiles|Optional but recommended. If set, key becomes invalid on the specified date.') end |
#ssh_key_usage_types ⇒ Object
49 50 51 52 53 54 55 |
# File 'app/helpers/profiles_helper.rb', line 49 def ssh_key_usage_types { s_('SSHKey|Authentication & Signing') => 'auth_and_signing', s_('SSHKey|Authentication') => 'auth', s_('SSHKey|Signing') => 'signing' } end |
#user_profile? ⇒ Boolean
26 27 28 |
# File 'app/helpers/profiles_helper.rb', line 26 def user_profile? params[:controller] == 'users' end |
#user_profile_data(user) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'app/helpers/profiles_helper.rb', line 77 def user_profile_data(user) { profile_path: profile_path, profile_avatar_path: profile_avatar_path, avatar_url: avatar_icon_for_user(user, current_user: current_user), has_avatar: user.avatar?.to_s, gravatar_enabled: gravatar_enabled?.to_s, gravatar_link: { hostname: Gitlab.config.gravatar.host, url: "https://#{Gitlab.config.gravatar.host}" }.to_json, brand_profile_image_guidelines: current_appearance&.profile_image_guidelines? ? brand_profile_image_guidelines : '', cropper_css_path: ActionController::Base.helpers.stylesheet_path('lazy_bundles/cropper.css'), user_path: user_path(current_user), **user_status_properties(user) } end |