File: _form.html.haml

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (38 lines) | stat: -rw-r--r-- 2,607 bytes parent folder | download
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
- max_date = ::Gitlab::CurrentSettings.max_ssh_key_lifetime_from_now.to_date if ssh_key_expiration_policy_enabled?
%div
  = gitlab_ui_form_for [:user_settings_ssh, @key] do |f|
    = form_errors(@key)

    .form-group
      = f.label :key, s_('Profiles|Key'), class: 'label-bold'
      = f.text_area :key, class: "form-control gl-form-input js-add-ssh-key-validation-input", rows: 8, required: true, data: { supported_algorithms: Gitlab::SSHPublicKey.supported_algorithms, testid: 'key-public-key-field' }
      %p.form-text.gl-text-subtle= s_('Profiles|Begins with %{ssh_key_algorithms}.') % { ssh_key_algorithms: ssh_key_allowed_algorithms }
    .form-row
      .col.form-group
        = f.label :title, s_('Profiles|Title'), class: 'label-bold'
        = f.text_field :title, class: "form-control gl-form-input input-lg", required: true, placeholder: s_('Profiles|Example: MacBook key'), data: { testid: 'key-title-field' }
        %p.form-text.gl-text-subtle= s_('Profiles|Key titles are publicly visible.')
    .form-row
      .col.form-group
        = f.label :usage_type, s_('Profiles|Usage type')
        .gl-md-form-input-lg
          = f.select :usage_type, options_for_select(ssh_key_usage_types, :auth_and_signing), {}, { class: 'gl-form-select custom-select' }
    .form-row
      .col.form-group
        .js-access-tokens-expires-at{ data: {min_date: Date.tomorrow, max_date: max_date, default_date_offset: 365, description: ssh_key_expires_field_description } }
          = f.label :expires_at, s_('Profiles|Expiration date'), class: 'label-bold'
          = f.text_field :expires_at, class: "form-control gl-form-input", placeholder: 'YYYY-MM-DD', min: Date.tomorrow, max: max_date, data: { js_name: 'expiresAt' }
          %p.form-text.gl-text-subtle= ssh_key_expires_field_description

    .js-add-ssh-key-validation-warning.hide
      = render Pajamas::AlertComponent.new(title: _('Are you sure?'), variant: :warning, dismissible: false) do |c|
        - c.with_body do
          = s_("Profiles|Publicly visible private SSH keys can compromise your system.")
        - c.with_actions do
          = render Pajamas::ButtonComponent.new(variant: :confirm,
            button_options: { class: 'js-add-ssh-key-validation-confirm-submit' }) do
            = _("Yes, add it")

    = f.submit s_('Profiles|Add key'), class: "js-add-ssh-key-validation-original-submit", pajamas_button: true, data: { testid: 'add-key-button' }
    = render Pajamas::ButtonComponent.new(button_options: { type: 'reset', class: 'js-add-ssh-key-validation-cancel gl-ml-2 js-toggle-button' }) do
      = _('Cancel')