_form.html.haml 3.55 KB
Newer Older
gitlabhq's avatar
gitlabhq committed
1
.user_new
2
  = form_for [:admin, @user], html: { class: 'form-horizontal fieldset-form' } do |f|
3
    -if @user.errors.any?
gitlabhq's avatar
gitlabhq committed
4
      #error_explanation
5
        .alert.alert-danger
6
          - @user.errors.full_messages.each do |msg|
7
            %p= msg
gitlabhq's avatar
gitlabhq committed
8

9 10
    %fieldset
      %legend Account
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
11
      .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
12
        = f.label :name, class: 'control-label'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
13
        .col-sm-10
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
14
          = f.text_field :name, required: true, autocomplete: "off", class: 'form-control'
15
          %span.help-inline * required
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
16
      .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
17
        = f.label :username, class: 'control-label'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
18
        .col-sm-10
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
19
          = f.text_field :username, required: true, autocomplete: "off", class: 'form-control'
20
          %span.help-inline * required
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
21
      .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
22
        = f.label :email, class: 'control-label'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
23
        .col-sm-10
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
24
          = f.text_field :email, required: true, autocomplete: "off", class: 'form-control'
25
          %span.help-inline * required
26

27
    - if @user.new_record?
28 29
      %fieldset
        %legend Password
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
30
        .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
31
          = f.label :password, class: 'control-label'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
32
          .col-sm-10
33
            %strong
34
              Reset link will be generated and sent to the user.
35
              %br
36
              User will be forced to set the password on first sign in.
37 38 39
    - else
      %fieldset
        %legend Password
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
40
        .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
41 42
          = f.label :password, class: 'control-label'
          .col-sm-10= f.password_field :password, disabled: f.object.force_random_password, class: 'form-control'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
43
        .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
44 45
          = f.label :password_confirmation, class: 'control-label'
          .col-sm-10= f.password_field :password_confirmation, disabled: f.object.force_random_password, class: 'form-control'
46 47 48

    %fieldset
      %legend Access
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
49 50 51
      .form-group
        = f.label :projects_limit, class: 'control-label'
        .col-sm-10= f.number_field :projects_limit, class: 'form-control'
52

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
53 54 55
      .form-group
        = f.label :can_create_group, class: 'control-label'
        .col-sm-10= f.check_box :can_create_group
56

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
57 58
      .form-group
        = f.label :admin, class: 'control-label'
59 60
        - if current_user == @user
          .col-sm-10= f.check_box :admin, disabled: true
61
          .col-sm-10 You cannot remove your own admin rights.
62 63
        - else
          .col-sm-10= f.check_box :admin
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
64 65 66 67

      .form-group
        = f.label :external, class: 'control-label'
        .col-sm-10= f.check_box :external
68
        .col-sm-10 External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects or groups.
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
69

70 71
    %fieldset
      %legend Profile
72 73 74 75 76
      .form-group
        = f.label :avatar, class: 'control-label'
        .col-sm-10
          = f.file_field :avatar

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
77
      .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
78 79
        = f.label :skype, class: 'control-label'
        .col-sm-10= f.text_field :skype, class: 'form-control'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
80
      .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
81 82
        = f.label :linkedin, class: 'control-label'
        .col-sm-10= f.text_field :linkedin, class: 'form-control'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
83
      .form-group
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
84 85
        = f.label :twitter, class: 'control-label'
        .col-sm-10= f.text_field :twitter, class: 'form-control'
Jerome Dalbert's avatar
Jerome Dalbert committed
86
      .form-group
87
        = f.label :website_url, 'Website', class: 'control-label'
Jerome Dalbert's avatar
Jerome Dalbert committed
88
        .col-sm-10= f.text_field :website_url, class: 'form-control'
randx's avatar
randx committed
89

90
    .form-actions
91
      - if @user.new_record?
92
        = f.submit 'Create user', class: "btn btn-create"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
93
        = link_to 'Cancel', admin_users_path, class: "btn btn-cancel"
Tiago Ribeiro's avatar
Tiago Ribeiro committed
94
      - else
95
        = f.submit 'Save changes', class: "btn btn-save"
96
        = link_to 'Cancel', admin_user_path(@user), class: "btn btn-cancel"