From 6ff0652e9e807b35d298b63699c71377014800ea Mon Sep 17 00:00:00 2001 From: randx Date: Sat, 25 Aug 2012 20:31:19 +0300 Subject: [PATCH] Admin area -> user form --- app/views/admin/dashboard/index.html.haml | 8 +- app/views/admin/projects/index.html.haml | 2 +- app/views/admin/users/_form.html.haml | 118 ++++++++++++---------- app/views/admin/users/edit.html.haml | 2 +- app/views/admin/users/index.html.haml | 2 +- app/views/admin/users/new.html.haml | 4 +- 6 files changed, 73 insertions(+), 63 deletions(-) diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml index 2e67abfc..3e26f566 100644 --- a/app/views/admin/dashboard/index.html.haml +++ b/app/views/admin/dashboard/index.html.haml @@ -35,11 +35,13 @@ %h3 Latest projects %hr - @projects.each do |project| - %h5 + %p = link_to project.name, [:admin, project] .span6 %h3 Latest users %hr - @users.each do |user| - %h5 - = link_to user.name, [:admin, user] + %p + = link_to [:admin, user] do + = user.name + %small= user.email diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index 882b2ab5..f7dd486d 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -1,4 +1,4 @@ -%h3 +%h3.page_title Projects = link_to 'New Project', new_admin_project_path, class: "btn small right" %br diff --git a/app/views/admin/users/_form.html.haml b/app/views/admin/users/_form.html.haml index 5e68a23f..20144723 100644 --- a/app/views/admin/users/_form.html.haml +++ b/app/views/admin/users/_form.html.haml @@ -2,68 +2,76 @@ = form_for [:admin, @admin_user] do |f| -if @admin_user.errors.any? #error_explanation - %ul + %ul.unstyled.alert.alert-error - @admin_user.errors.full_messages.each do |msg| %li= msg .row - .span6 - .clearfix - = f.label :name - .input - = f.text_field :name - %span.help-inline * required - .clearfix - = f.label :email - .input - = f.text_field :email - %span.help-inline * required - %hr + .span7 + .ui-box + %br + .clearfix + = f.label :name + .input + = f.text_field :name + %span.help-inline * required + .clearfix + = f.label :email + .input + = f.text_field :email + %span.help-inline * required + %hr + -if f.object.new_record? + .clearfix + = f.label :force_random_password do + %span Generate random password + .input= f.check_box :force_random_password, {}, true, nil + + %div.password-fields + .clearfix + = f.label :password + .input= f.password_field :password, disabled: f.object.force_random_password + .clearfix + = f.label :password_confirmation + .input= f.password_field :password_confirmation, disabled: f.object.force_random_password + %hr + .clearfix + = f.label :skype + .input= f.text_field :skype + .clearfix + = f.label :linkedin + .input= f.text_field :linkedin + .clearfix + = f.label :twitter + .input= f.text_field :twitter + .span5 + .ui-box + %br + .clearfix + = f.label :projects_limit + .input= f.number_field :projects_limit - -if f.object.new_record? - .clearfix - = f.label :admin, class: "checkbox" do - = f.check_box :force_random_password, {}, true, nil - %span Generate random password - - %div.password-fields .clearfix - = f.label :password - .input= f.password_field :password, disabled: f.object.force_random_password - .clearfix - = f.label :password_confirmation - .input= f.password_field :password_confirmation, disabled: f.object.force_random_password - %hr - .clearfix - = f.label :skype - .input= f.text_field :skype - .clearfix - = f.label :linkedin - .input= f.text_field :linkedin - .clearfix - = f.label :twitter - .input= f.text_field :twitter - .span6 - .clearfix - = f.label :projects_limit - .input= f.text_field :projects_limit, class: "small_input" + = f.label :admin do + %strong.cred Administrator + .input= f.check_box :admin + - unless @admin_user.new_record? + %hr + .padded.cred + - if @admin_user.blocked + %span + This user is blocked and is not able to login to GitLab + .clearfix + = link_to 'Unblock User', unblock_admin_user_path(@admin_user), method: :put, class: "btn small right" + - else + %span + Blocked users will be removed from all projects & will not be able to login to GitLab. + .clearfix + = 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" - .alert - .clearfix - %p Make the user a GitLab administrator. - = f.label :admin, class: "checkbox" do - = f.check_box :admin - %span Administrator - - unless @admin_user.new_record? - .alert.alert-error - - if @admin_user.blocked - %span - = link_to 'Unblock', unblock_admin_user_path(@admin_user), method: :put, class: "btn small" - This user is blocked and is not able to login to GitLab - - else - %span - = link_to 'Block', block_admin_user_path(@admin_user), confirm: 'USER WILL BE BLOCKED! Are you sure?', method: :put, class: "btn small danger" - Blocked users will be removed from all projects & will not be able to login to GitLab. + .row + .span6 + .span6 .actions = f.submit 'Save', class: "btn primary" - if @admin_user.new_record? diff --git a/app/views/admin/users/edit.html.haml b/app/views/admin/users/edit.html.haml index 0e94be9e..032e3cfa 100644 --- a/app/views/admin/users/edit.html.haml +++ b/app/views/admin/users/edit.html.haml @@ -1,3 +1,3 @@ -%h3= @admin_user.name +%h3.page_title #{@admin_user.name} → Edit user %hr = render 'form' diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 3d027217..f21baabf 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -1,4 +1,4 @@ -%h3 +%h3.page_title Users = link_to 'New User', new_admin_user_path, class: "btn small right" %br diff --git a/app/views/admin/users/new.html.haml b/app/views/admin/users/new.html.haml index 87d6b0f2..70ead0d3 100644 --- a/app/views/admin/users/new.html.haml +++ b/app/views/admin/users/new.html.haml @@ -1,3 +1,3 @@ -%h2 New user -%hr +%h3.page_title New user +%br = render 'form'