debian-mirror-gitlab/app/views/shared/access_tokens/_form.html.haml

57 lines
2.8 KiB
Text
Raw Normal View History

2020-05-24 23:13:21 +05:30
- title = local_assigns.fetch(:title, _('Add a %{type}') % { type: type })
- prefix = local_assigns.fetch(:prefix, :personal_access_token)
2021-09-30 23:02:18 +05:30
- help_path = local_assigns.fetch(:help_path)
2022-03-02 08:16:31 +05:30
- resource = local_assigns.fetch(:resource, false)
2021-09-30 23:02:18 +05:30
- access_levels = local_assigns.fetch(:access_levels, false)
- default_access_level = local_assigns.fetch(:default_access_level, false)
2020-05-24 23:13:21 +05:30
2020-06-23 00:09:42 +05:30
%h5.gl-mt-0
2020-05-24 23:13:21 +05:30
= title
%p.profile-settings-content
= _("Enter the name of your application, and we'll return a unique %{type}.") % { type: type }
= form_for token, as: prefix, url: path, method: :post, html: { class: 'js-requires-input' } do |f|
= form_errors(token)
.row
2021-09-30 23:02:18 +05:30
.form-group.col
.row
= f.label :name, _('Token name'), class: 'label-bold col-md-12'
.col-md-6
= f.text_field :name, class: 'form-control gl-form-input', required: true, data: { qa_selector: 'access_token_name_field' }, :'aria-describedby' => 'access_token_help_text'
%span.form-text.text-muted.col-md-12#access_token_help_text= _('For example, the application using the token or the purpose of the token.')
2020-05-24 23:13:21 +05:30
.row
.form-group.col-md-6
2021-09-30 23:02:18 +05:30
= f.label :expires_at, _('Expiration date'), class: 'label-bold'
2020-05-24 23:13:21 +05:30
.input-icon-wrapper
= render_if_exists 'personal_access_tokens/callout_max_personal_access_token_lifetime'
.js-access-tokens-expires-at
2021-04-29 21:17:54 +05:30
= f.text_field :expires_at, class: 'datepicker gl-datepicker-input form-control gl-form-input', placeholder: 'YYYY-MM-DD', autocomplete: 'off', data: { js_name: 'expiresAt' }
2020-05-24 23:13:21 +05:30
2022-03-02 08:16:31 +05:30
- if resource
2021-09-30 23:02:18 +05:30
.row
.form-group.col-md-6
= label_tag :access_level, _("Select a role"), class: "label-bold"
.select-wrapper
2022-03-02 08:16:31 +05:30
= select_tag :"#{prefix}[access_level]", options_for_select(access_levels, default_access_level), class: "form-control select-control", data: { qa_selector: 'access_token_access_level' }
2021-09-30 23:02:18 +05:30
= sprite_icon('chevron-down', css_class: "gl-icon gl-absolute gl-top-3 gl-right-3 gl-text-gray-200")
2020-05-24 23:13:21 +05:30
.form-group
2021-09-30 23:02:18 +05:30
%b{ :'aria-describedby' => 'select_scope_help_text' }
= s_('Tokens|Select scopes')
%p.text-secondary#select_scope_help_text
= s_('Tokens|Scopes set the permission levels granted to the token.')
2022-03-02 08:16:31 +05:30
= link_to _("Learn more."), help_path, target: '_blank', rel: 'noopener noreferrer'
2020-05-24 23:13:21 +05:30
= render 'shared/tokens/scopes_form', prefix: prefix, token: token, scopes: scopes
2021-04-17 20:07:23 +05:30
- if prefix == :personal_access_token && Feature.enabled?(:personal_access_tokens_scoped_to_projects, current_user)
.js-access-tokens-projects
2021-04-29 21:17:54 +05:30
%input{ type: 'hidden', name: 'personal_access_token[projects]', id: 'personal_access_token_projects', data: { js_name: 'projects' } }
2021-04-17 20:07:23 +05:30
2020-07-28 23:09:34 +05:30
.gl-mt-3
2021-04-17 20:07:23 +05:30
= f.submit _('Create %{type}') % { type: type }, class: 'gl-button btn btn-confirm', data: { qa_selector: 'create_token_button' }