summaryrefslogtreecommitdiff
path: root/app/views/shared/_personal_access_tokens_form.html.haml
blob: e8062848fc3cc26dac7510fcde28864612f295b6 (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
- type = impersonation ? "impersonation" : "personal access"

%h5.prepend-top-0
  Add a #{type} Token
%p.profile-settings-content
  Pick a name for the application, and we'll give you a unique #{type} Token.

= form_for token, url: path, method: :post, html: { class: 'js-requires-input' } do |f|

  = form_errors(token)

  .form-group
    = f.label :name, class: 'label-light'
    = f.text_field :name, class: "form-control", required: true

  .form-group
    = f.label :expires_at, class: 'label-light'
    = f.text_field :expires_at, class: "datepicker form-control"

  .form-group
    = f.label :scopes, class: 'label-light'
    = render 'shared/tokens/scopes_form', prefix: 'personal_access_token', token: token, scopes: scopes

  .prepend-top-default
    = f.submit "Create #{type} token", class: "btn btn-create"

:javascript
  var $dateField = $('.datepicker');
  var date = $dateField.val();

  new Pikaday({
    field: $dateField.get(0),
    theme: 'gitlab-theme',
    format: 'yyyy-mm-dd',
    minDate: new Date(),
    onSelect: function(dateText) {
      $dateField.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
    }
  });