Commit 5a51a798 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'admin-user-block' into 'master'

Improve user block/unblock UI in admin area

Fixes #2111

See merge request !1658
parents e89ffd54 dd24c3d4
...@@ -24,7 +24,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -24,7 +24,7 @@ class Admin::UsersController < Admin::ApplicationController
def block def block
if user.block if user.block
redirect_to :back, alert: "Successfully blocked" redirect_to :back, notice: "Successfully blocked"
else else
redirect_to :back, alert: "Error occurred. User was not blocked" redirect_to :back, alert: "Error occurred. User was not blocked"
end end
...@@ -32,7 +32,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -32,7 +32,7 @@ class Admin::UsersController < Admin::ApplicationController
def unblock def unblock
if user.activate if user.activate
redirect_to :back, alert: "Successfully unblocked" redirect_to :back, notice: "Successfully unblocked"
else else
redirect_to :back, alert: "Error occurred. User was not unblocked" redirect_to :back, alert: "Error occurred. User was not unblocked"
end end
......
...@@ -108,45 +108,50 @@ ...@@ -108,45 +108,50 @@
.col-md-6 .col-md-6
- unless @user == current_user - unless @user == current_user
- if @user.blocked? - if @user.blocked?
.alert.alert-info .panel.panel-info
%h4 This user is blocked .panel-heading
%p Blocking user has the following effects: This user is blocked
%ul .panel-body
%li User will not be able to login %p Blocking user has the following effects:
%li User will not be able to access git repositories %ul
%li User will be removed from joined projects and groups %li User will not be able to login
%li Personal projects will be left %li User will not be able to access git repositories
%li Owned groups will be left %li User will be removed from joined projects and groups
%br %li Personal projects will be left
= link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' } %li Owned groups will be left
%br
= link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' }
- else - else
.alert.alert-warning .panel.panel-warning
%h4 Block this user .panel-heading
%p Blocking user has the following effects: Block this user
.panel-body
%p Blocking user has the following effects:
%ul
%li User will not be able to login
%li User will not be able to access git repositories
%li User will be removed from joined projects and groups
%li Personal projects will be left
%li Owned groups will be left
%br
= link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-warning"
.panel.panel-danger
.panel-heading
Remove user
.panel-body
%p Deleting a user has the following effects:
%ul %ul
%li User will not be able to login %li All user content like authored issues, snippets, comments will be removed
%li User will not be able to access git repositories - rp = @user.personal_projects.count
%li User will be removed from joined projects and groups - unless rp.zero?
%li Personal projects will be left %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
%li Owned groups will be left - if @user.solo_owned_groups.present?
%li
Next groups with all content will be removed:
%strong #{@user.solo_owned_groups.map(&:name).join(', ')}
%br %br
= link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove" = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove"
.alert.alert-danger
%h4
Remove user
%p Deleting a user has the following effects:
%ul
%li All user content like authored issues, snippets, comments will be removed
- rp = @user.personal_projects.count
- unless rp.zero?
%li #{pluralize rp, 'personal project'} will be removed and cannot be restored
- if @user.solo_owned_groups.present?
%li
Next groups with all content will be removed:
%strong #{@user.solo_owned_groups.map(&:name).join(', ')}
%br
= link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove"
#profile.tab-pane #profile.tab-pane
.row .row
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment