Commit 6ff0652e9e807b35d298b63699c71377014800ea

Authored by randx
1 parent f13bccc1

Admin area -> user form

app/views/admin/dashboard/index.html.haml
@@ -35,11 +35,13 @@ @@ -35,11 +35,13 @@
35 %h3 Latest projects 35 %h3 Latest projects
36 %hr 36 %hr
37 - @projects.each do |project| 37 - @projects.each do |project|
38 - %h5 38 + %p
39 = link_to project.name, [:admin, project] 39 = link_to project.name, [:admin, project]
40 .span6 40 .span6
41 %h3 Latest users 41 %h3 Latest users
42 %hr 42 %hr
43 - @users.each do |user| 43 - @users.each do |user|
44 - %h5  
45 - = link_to user.name, [:admin, user] 44 + %p
  45 + = link_to [:admin, user] do
  46 + = user.name
  47 + %small= user.email
app/views/admin/projects/index.html.haml
1 -%h3 1 +%h3.page_title
2 Projects 2 Projects
3 = link_to 'New Project', new_admin_project_path, class: "btn small right" 3 = link_to 'New Project', new_admin_project_path, class: "btn small right"
4 %br 4 %br
app/views/admin/users/_form.html.haml
@@ -2,68 +2,76 @@ @@ -2,68 +2,76 @@
2 = form_for [:admin, @admin_user] do |f| 2 = form_for [:admin, @admin_user] do |f|
3 -if @admin_user.errors.any? 3 -if @admin_user.errors.any?
4 #error_explanation 4 #error_explanation
5 - %ul 5 + %ul.unstyled.alert.alert-error
6 - @admin_user.errors.full_messages.each do |msg| 6 - @admin_user.errors.full_messages.each do |msg|
7 %li= msg 7 %li= msg
8 8
9 .row 9 .row
10 - .span6  
11 - .clearfix  
12 - = f.label :name  
13 - .input  
14 - = f.text_field :name  
15 - %span.help-inline * required  
16 - .clearfix  
17 - = f.label :email  
18 - .input  
19 - = f.text_field :email  
20 - %span.help-inline * required  
21 - %hr  
22 -  
23 - -if f.object.new_record?  
24 - .clearfix  
25 - = f.label :admin, class: "checkbox" do  
26 - = f.check_box :force_random_password, {}, true, nil  
27 - %span Generate random password  
28 -  
29 - %div.password-fields 10 + .span7
  11 + .ui-box
  12 + %br
30 .clearfix 13 .clearfix
31 - = f.label :password  
32 - .input= f.password_field :password, disabled: f.object.force_random_password 14 + = f.label :name
  15 + .input
  16 + = f.text_field :name
  17 + %span.help-inline * required
33 .clearfix 18 .clearfix
34 - = f.label :password_confirmation  
35 - .input= f.password_field :password_confirmation, disabled: f.object.force_random_password  
36 - %hr  
37 - .clearfix  
38 - = f.label :skype  
39 - .input= f.text_field :skype  
40 - .clearfix  
41 - = f.label :linkedin  
42 - .input= f.text_field :linkedin  
43 - .clearfix  
44 - = f.label :twitter  
45 - .input= f.text_field :twitter  
46 - .span6  
47 - .clearfix  
48 - = f.label :projects_limit  
49 - .input= f.text_field :projects_limit, class: "small_input" 19 + = f.label :email
  20 + .input
  21 + = f.text_field :email
  22 + %span.help-inline * required
  23 + %hr
  24 + -if f.object.new_record?
  25 + .clearfix
  26 + = f.label :force_random_password do
  27 + %span Generate random password
  28 + .input= f.check_box :force_random_password, {}, true, nil
  29 +
  30 + %div.password-fields
  31 + .clearfix
  32 + = f.label :password
  33 + .input= f.password_field :password, disabled: f.object.force_random_password
  34 + .clearfix
  35 + = f.label :password_confirmation
  36 + .input= f.password_field :password_confirmation, disabled: f.object.force_random_password
  37 + %hr
  38 + .clearfix
  39 + = f.label :skype
  40 + .input= f.text_field :skype
  41 + .clearfix
  42 + = f.label :linkedin
  43 + .input= f.text_field :linkedin
  44 + .clearfix
  45 + = f.label :twitter
  46 + .input= f.text_field :twitter
  47 + .span5
  48 + .ui-box
  49 + %br
  50 + .clearfix
  51 + = f.label :projects_limit
  52 + .input= f.number_field :projects_limit
50 53
51 - .alert  
52 .clearfix 54 .clearfix
53 - %p Make the user a GitLab administrator.  
54 - = f.label :admin, class: "checkbox" do  
55 - = f.check_box :admin  
56 - %span Administrator  
57 - - unless @admin_user.new_record?  
58 - .alert.alert-error  
59 - - if @admin_user.blocked  
60 - %span  
61 - = link_to 'Unblock', unblock_admin_user_path(@admin_user), method: :put, class: "btn small"  
62 - This user is blocked and is not able to login to GitLab  
63 - - else  
64 - %span  
65 - = link_to 'Block', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small danger"  
66 - Blocked users will be removed from all projects & will not be able to login to GitLab. 55 + = f.label :admin do
  56 + %strong.cred Administrator
  57 + .input= f.check_box :admin
  58 + - unless @admin_user.new_record?
  59 + %hr
  60 + .padded.cred
  61 + - if @admin_user.blocked
  62 + %span
  63 + This user is blocked and is not able to login to GitLab
  64 + .clearfix
  65 + = link_to 'Unblock User', unblock_admin_user_path(@admin_user), method: :put, class: "btn small right"
  66 + - else
  67 + %span
  68 + Blocked users will be removed from all projects & will not be able to login to GitLab.
  69 + .clearfix
  70 + = link_to 'Block User', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small right danger"
  71 +
  72 + .row
  73 + .span6
  74 + .span6
67 .actions 75 .actions
68 = f.submit 'Save', class: "btn primary" 76 = f.submit 'Save', class: "btn primary"
69 - if @admin_user.new_record? 77 - if @admin_user.new_record?
app/views/admin/users/edit.html.haml
1 -%h3= @admin_user.name 1 +%h3.page_title #{@admin_user.name} → Edit user
2 %hr 2 %hr
3 = render 'form' 3 = render 'form'
app/views/admin/users/index.html.haml
1 -%h3 1 +%h3.page_title
2 Users 2 Users
3 = link_to 'New User', new_admin_user_path, class: "btn small right" 3 = link_to 'New User', new_admin_user_path, class: "btn small right"
4 %br 4 %br
app/views/admin/users/new.html.haml
1 -%h2 New user  
2 -%hr 1 +%h3.page_title New user
  2 +%br
3 = render 'form' 3 = render 'form'