summaryrefslogtreecommitdiff
path: root/app/views/profiles/show.html.haml
blob: 6b27db23315e271ace792360189aba2f1bbd6fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
- breadcrumb_title s_("Profiles|Edit Profile")
- @content_class = "limit-container-width" unless fluid_layout
- gravatar_link = link_to Gitlab.config.gravatar.host, 'https://' + Gitlab.config.gravatar.host

= bootstrap_form_for @user, url: profile_path, method: :put, html: { multipart: true, class: 'edit-user prepend-top-default js-quick-submit gl-show-field-errors' }, authenticity_token: true do |f|
  = form_errors(@user)

  .row
    .col-lg-4.profile-settings-sidebar
      %h4.prepend-top-0
        = s_("Profiles|Public Avatar")
      %p
        - if @user.avatar?
          - if gravatar_enabled?
            = s_("Profiles|You can change your avatar here or remove the current avatar to revert to %{gravatar_link}").html_safe % { gravatar_link: gravatar_link }
          - else
            = s_("Profiles|You can change your avatar here")
        - else
          - if gravatar_enabled?
            = s_("Profiles|You can upload your avatar here or change it at %{gravatar_link}").html_safe % { gravatar_link: gravatar_link }
          - else
            = s_("Profiles|You can upload your avatar here")
    .col-lg-8
      .clearfix.avatar-image.append-bottom-default
        = link_to avatar_icon_for_user(@user, 400), target: '_blank', rel: 'noopener noreferrer' do
          = image_tag avatar_icon_for_user(@user, 160), alt: '', class: 'avatar s160'
      %h5.prepend-top-0= s_("Profiles|Upload new avatar")
      .prepend-top-5.append-bottom-10
        %button.btn.js-choose-user-avatar-button{ type: 'button' }= s_("Profiles|Choose file...")
        %span.avatar-file-name.prepend-left-default.js-avatar-filename= s_("Profiles|No file chosen")
        = f.file_field_without_bootstrap :avatar, class: 'js-user-avatar-input hidden', accept: 'image/*'
      .form-text.text-muted= s_("Profiles|The maximum file size allowed is 200KB.")
      - if @user.avatar?
        %hr
        = link_to s_("Profiles|Remove avatar"), profile_avatar_path, data: { confirm: s_("Profiles|Avatar will be removed. Are you sure?") }, method: :delete, class: 'btn btn-danger btn-inverted'

  %hr
  .row
    .col-lg-4.profile-settings-sidebar
      %h4.prepend-top-0= s_("Profiles|Current status")
      %p= s_("Profiles|This emoji and message will appear on your profile and throughout the interface.")
    .col-lg-8
      = f.fields_for :status, @user.status do |status_form|
        - emoji_button = button_tag type: :button,
          class: 'js-toggle-emoji-menu emoji-menu-toggle-button btn has-tooltip',
          title: s_("Profiles|Add status emoji") do
          - if @user.status
            = emoji_icon @user.status.emoji
          %span#js-no-emoji-placeholder.no-emoji-placeholder{ class: ('hidden' if @user.status) }
            = sprite_icon('slight-smile', css_class: 'award-control-icon-neutral')
            = sprite_icon('smiley', css_class: 'award-control-icon-positive')
            = sprite_icon('smile', css_class: 'award-control-icon-super-positive')
        - reset_message_button = button_tag type: :button,
          id: 'js-clear-user-status-button',
          class: 'clear-user-status btn has-tooltip',
          title: s_("Profiles|Clear status") do
          = sprite_icon("close")

        = status_form.hidden_field :emoji, id: 'js-status-emoji-field'
        = status_form.text_field :message,
          id: 'js-status-message-field',
          class: 'form-control input-lg',
          label: s_("Profiles|Your status"),
          prepend: emoji_button,
          append: reset_message_button,
          placeholder: s_("Profiles|What's your status?")
  - if Feature.enabled?(:user_time_settings)
    %hr
    .row.user-time-preferences
      .col-lg-4.profile-settings-sidebar
        %h4.prepend-top-0= s_("Profiles|Time settings")
        %p= s_("Profiles|You can set your current timezone here")
      .col-lg-8
        -# TODO: might need an entry in user/profile.md to describe some of these settings
        -# https://gitlab.com/gitlab-org/gitlab-foss/issues/60070
        %h5= ("Time zone")
        = dropdown_tag(_("Select a timezone"), options: { toggle_class: 'btn js-timezone-dropdown input-lg', title: _("Select a timezone"), filter: true, placeholder: s_("OfSearchInADropdown|Filter"), data: { data: timezone_data } } )
        %input.hidden{ :type => 'hidden', :id => 'user_timezone', :name => 'user[timezone]', value: @user.timezone }

  %hr
  .row
    .col-lg-4.profile-settings-sidebar
      %h4.prepend-top-0
        = s_("Profiles|Main settings")
      %p
        = s_("Profiles|This information will appear on your profile")
        - if current_user.ldap_user?
          = s_("Profiles|Some options are unavailable for LDAP accounts")
    .col-lg-8
      .row
        - if @user.read_only_attribute?(:name)
          = f.text_field :name, required: true, readonly: true, wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' },
          help: s_("Profiles|Your name was automatically set based on your %{provider_label} account, so people you know can recognize you") % { provider_label: attribute_provider_label(:name) }
        - else
          = f.text_field :name, label: s_('Profiles|Full name'), required: true, title: s_("Profiles|Using emojis in names seems fun, but please try to set a status message instead"), wrapper: { class: 'col-md-9 qa-full-name rspec-full-name' }, help: s_("Profiles|Enter your name, so people you know can recognize you")
        = f.text_field :id, readonly: true, label: s_('Profiles|User ID'), wrapper: { class: 'col-md-3' }
      - if experiment_enabled?(:signup_flow)
        = f.select :role, ::User.roles.keys.map { |role| [role.titleize, role] }, { prompt: _('Select your role') }, class: 'input-md'

      = render_if_exists 'profiles/email_settings', form: f
      = f.text_field :skype, class: 'input-md', placeholder: s_("Profiles|username")
      = f.text_field :linkedin, class: 'input-md', help: s_("Profiles|Your LinkedIn profile name from linkedin.com/in/profilename")
      = f.text_field :twitter, class: 'input-md', placeholder: s_("Profiles|@username")
      = f.text_field :website_url, class: 'input-lg', placeholder: s_("Profiles|website.com")
      - if @user.read_only_attribute?(:location)
        = f.text_field :location, readonly: true, help: s_("Profiles|Your location was automatically set based on your %{provider_label} account") % { provider_label: attribute_provider_label(:location) }
      - else
        = f.text_field :location, label: s_('Profiles|Location'), class: 'input-lg', placeholder: s_("Profiles|City, country")
      = f.text_field :organization, label: s_('Profiles|Organization'), class: 'input-md', help: s_("Profiles|Who you represent or work for")
      = f.text_area :bio, label: s_('Profiles|Bio'), rows: 4, maxlength: 250, help: s_("Profiles|Tell us about yourself in fewer than 250 characters")
      %hr
      %h5= s_("Private profile")
      .checkbox-icon-inline-wrapper
        - private_profile_label = capture do
          = s_("Profiles|Don't display activity-related personal information on your profiles")
        = f.check_box :private_profile, label: private_profile_label, inline: true, wrapper_class: 'mr-0'
        = link_to icon('question-circle'), help_page_path('user/profile/index.md', anchor: 'private-profile')
      %h5= s_("Profiles|Private contributions")
      = f.check_box :include_private_contributions, label: s_('Profiles|Include private contributions on my profile'), wrapper_class: 'mb-2', inline: true
      .help-block
        = s_("Profiles|Choose to show contributions of private projects on your public profile without any project, repository or organization information")
      .prepend-top-default.append-bottom-default
        = f.submit s_("Profiles|Update profile settings"), class: 'btn btn-success'
        = link_to _("Cancel"), user_path(current_user), class: 'btn btn-cancel'

.modal.modal-profile-crop
  .modal-dialog
    .modal-content
      .modal-header
        %h4.modal-title
          = s_("Profiles|Position and size your new avatar")
        %button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _("Close") }
          %span{ "aria-hidden": true } ×
      .modal-body
        .profile-crop-image-container
          %img.modal-profile-crop-image{ alt: s_("Profiles|Avatar cropper") }
        .crop-controls
          .btn-group
            %button.btn.btn-primary{ data: { method: 'zoom', option: '0.1' } }
              %span.fa.fa-search-plus
            %button.btn.btn-primary{ data: { method: 'zoom', option: '-0.1' } }
              %span.fa.fa-search-minus
      .modal-footer
        %button.btn.btn-primary.js-upload-user-avatar{ type: 'button' }
          = s_("Profiles|Set new profile picture")