Commit fc43c4e7fad0b958f4ba36a48ccecee82343ec2a
1 parent
87e0fe6f
Exists in
spb-stable
and in
2 other branches
Restyle admin/user page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
4 changed files
with
175 additions
and
121 deletions
Show diff stats
app/controllers/admin/users_controller.rb
app/views/admin/users/show.html.haml
| 1 | 1 | %h3.page-title |
| 2 | - %span.cgray User: | |
| 2 | + User: | |
| 3 | 3 | = @user.name |
| 4 | 4 | - if @user.blocked? |
| 5 | 5 | %span.cred (Blocked) |
| ... | ... | @@ -11,112 +11,144 @@ |
| 11 | 11 | %i.icon-edit |
| 12 | 12 | Edit |
| 13 | 13 | %hr |
| 14 | +%ul.nav.nav-tabs | |
| 15 | + %li.active | |
| 16 | + %a{"data-toggle" => "tab", href: "#account"} Account | |
| 17 | + %li | |
| 18 | + %a{"data-toggle" => "tab", href: "#profile"} Profile | |
| 19 | + %li | |
| 20 | + %a{"data-toggle" => "tab", href: "#groups"} Groups | |
| 21 | + %li | |
| 22 | + %a{"data-toggle" => "tab", href: "#projects"} Projects | |
| 14 | 23 | |
| 15 | -.row | |
| 16 | - .col-md-6 | |
| 17 | - .panel.panel-default | |
| 18 | - .panel-heading | |
| 19 | - Account: | |
| 20 | - .pull-right | |
| 21 | - = image_tag avatar_icon(@user.email, 32), class: "avatar s32" | |
| 22 | - %ul.well-list | |
| 23 | - %li | |
| 24 | - %span.light Name: | |
| 25 | - %strong= @user.name | |
| 26 | - %li | |
| 27 | - %span.light Username: | |
| 28 | - %strong | |
| 29 | - = @user.username | |
| 30 | - %li | |
| 31 | - %span.light Email: | |
| 32 | - %strong | |
| 33 | - = mail_to @user.email | |
| 34 | - %li | |
| 35 | - %span.light Can create groups: | |
| 36 | - %strong | |
| 37 | - = @user.can_create_group ? "Yes" : "No" | |
| 38 | - %li | |
| 39 | - %span.light Personal projects limit: | |
| 40 | - %strong | |
| 41 | - = @user.projects_limit | |
| 42 | - %li | |
| 43 | - %span.light Member since: | |
| 44 | - %strong | |
| 45 | - = @user.created_at.stamp("Nov 12, 2031") | |
| 46 | - - if @user.confirmed_at | |
| 47 | - %li | |
| 48 | - %span.light Confirmed at: | |
| 49 | - %strong | |
| 50 | - = @user.confirmed_at.stamp("Nov 12, 2031") | |
| 51 | - - else | |
| 52 | - %li | |
| 53 | - %span.light Confirmed: | |
| 54 | - %strong.cred | |
| 55 | - No | |
| 24 | +.tab-content | |
| 25 | + #account.tab-pane.active | |
| 26 | + .row | |
| 27 | + .col-md-6 | |
| 28 | + .panel.panel-default | |
| 29 | + .panel-heading | |
| 30 | + Account: | |
| 31 | + %ul.well-list | |
| 32 | + %li | |
| 33 | + %span.light Name: | |
| 34 | + %strong= @user.name | |
| 35 | + %li | |
| 36 | + %span.light Username: | |
| 37 | + %strong | |
| 38 | + = @user.username | |
| 39 | + %li | |
| 40 | + %span.light Email: | |
| 41 | + %strong | |
| 42 | + = mail_to @user.email | |
| 43 | + - @user.emails.each do |email| | |
| 44 | + %li | |
| 45 | + %span.light Secondary email: | |
| 46 | + %strong= email.email | |
| 56 | 47 | |
| 57 | - %li | |
| 58 | - %span.light Last sign-in at: | |
| 59 | - %strong | |
| 60 | - - if @user.last_sign_in_at | |
| 61 | - = @user.last_sign_in_at.stamp("Nov 12, 2031") | |
| 48 | + %li | |
| 49 | + %span.light Can create groups: | |
| 50 | + %strong | |
| 51 | + = @user.can_create_group ? "Yes" : "No" | |
| 52 | + %li | |
| 53 | + %span.light Personal projects limit: | |
| 54 | + %strong | |
| 55 | + = @user.projects_limit | |
| 56 | + %li | |
| 57 | + %span.light Member since: | |
| 58 | + %strong | |
| 59 | + = @user.created_at.stamp("Nov 12, 2031") | |
| 60 | + - if @user.confirmed_at | |
| 61 | + %li | |
| 62 | + %span.light Confirmed at: | |
| 63 | + %strong | |
| 64 | + = @user.confirmed_at.stamp("Nov 12, 2031") | |
| 62 | 65 | - else |
| 63 | - never | |
| 66 | + %li | |
| 67 | + %span.light Confirmed: | |
| 68 | + %strong.cred | |
| 69 | + No | |
| 70 | + | |
| 71 | + %li | |
| 72 | + %span.light Last sign-in at: | |
| 73 | + %strong | |
| 74 | + - if @user.last_sign_in_at | |
| 75 | + = @user.last_sign_in_at.stamp("Nov 12, 2031") | |
| 76 | + - else | |
| 77 | + never | |
| 64 | 78 | |
| 65 | - - if @user.ldap_user? | |
| 66 | - %li | |
| 67 | - %span.light LDAP uid: | |
| 68 | - %strong | |
| 69 | - = @user.extern_uid | |
| 79 | + - if @user.ldap_user? | |
| 80 | + %li | |
| 81 | + %span.light LDAP uid: | |
| 82 | + %strong | |
| 83 | + = @user.extern_uid | |
| 70 | 84 | |
| 71 | - - if @user.created_by | |
| 72 | - %li | |
| 73 | - %span.light Created by: | |
| 74 | - %strong | |
| 75 | - = link_to @user.created_by.name, [:admin, @user.created_by] | |
| 85 | + - if @user.created_by | |
| 86 | + %li | |
| 87 | + %span.light Created by: | |
| 88 | + %strong | |
| 89 | + = link_to @user.created_by.name, [:admin, @user.created_by] | |
| 76 | 90 | |
| 77 | - - unless @user == current_user | |
| 78 | - - if @user.blocked? | |
| 79 | - .alert.alert-info | |
| 80 | - %h4 This user is blocked | |
| 81 | - %p Blocking user has the following effects: | |
| 82 | - %ul | |
| 83 | - %li User will not be able to login | |
| 84 | - %li User will not be able to access git repositories | |
| 85 | - %li User will be removed from joined projects and groups | |
| 86 | - %li Personal projects will be left | |
| 87 | - %li Owned groups will be left | |
| 88 | - %br | |
| 89 | - = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' } | |
| 90 | - - else | |
| 91 | - .alert.alert-warning | |
| 92 | - %h4 Block this user | |
| 93 | - %p Blocking user has the following effects: | |
| 94 | - %ul | |
| 95 | - %li User will not be able to login | |
| 96 | - %li User will not be able to access git repositories | |
| 97 | - %li User will be removed from joined projects and groups | |
| 98 | - %li Personal projects will be left | |
| 99 | - %li Owned groups will be left | |
| 100 | - %br | |
| 101 | - = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove" | |
| 91 | + .col-md-6 | |
| 92 | + - unless @user == current_user | |
| 93 | + - if @user.blocked? | |
| 94 | + .alert.alert-info | |
| 95 | + %h4 This user is blocked | |
| 96 | + %p Blocking user has the following effects: | |
| 97 | + %ul | |
| 98 | + %li User will not be able to login | |
| 99 | + %li User will not be able to access git repositories | |
| 100 | + %li User will be removed from joined projects and groups | |
| 101 | + %li Personal projects will be left | |
| 102 | + %li Owned groups will be left | |
| 103 | + %br | |
| 104 | + = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-new", data: { confirm: 'Are you sure?' } | |
| 105 | + - else | |
| 106 | + .alert.alert-warning | |
| 107 | + %h4 Block this user | |
| 108 | + %p Blocking user has the following effects: | |
| 109 | + %ul | |
| 110 | + %li User will not be able to login | |
| 111 | + %li User will not be able to access git repositories | |
| 112 | + %li User will be removed from joined projects and groups | |
| 113 | + %li Personal projects will be left | |
| 114 | + %li Owned groups will be left | |
| 115 | + %br | |
| 116 | + = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-remove" | |
| 102 | 117 | |
| 103 | - .alert.alert-danger | |
| 104 | - %h4 | |
| 105 | - Remove user | |
| 106 | - %p Deleting a user has the following effects: | |
| 107 | - %ul | |
| 108 | - %li All user content like authored issues, snippets, comments will be removed | |
| 109 | - - rp = @user.personal_projects.count | |
| 110 | - - unless rp.zero? | |
| 111 | - %li #{pluralize rp, 'personal project'} will be removed and cannot be restored | |
| 112 | - - if @user.solo_owned_groups.present? | |
| 118 | + .alert.alert-danger | |
| 119 | + %h4 | |
| 120 | + Remove user | |
| 121 | + %p Deleting a user has the following effects: | |
| 122 | + %ul | |
| 123 | + %li All user content like authored issues, snippets, comments will be removed | |
| 124 | + - rp = @user.personal_projects.count | |
| 125 | + - unless rp.zero? | |
| 126 | + %li #{pluralize rp, 'personal project'} will be removed and cannot be restored | |
| 127 | + - if @user.solo_owned_groups.present? | |
| 128 | + %li | |
| 129 | + Next groups with all content will be removed: | |
| 130 | + %strong #{@user.solo_owned_groups.map(&:name).join(', ')} | |
| 131 | + %br | |
| 132 | + = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove" | |
| 133 | + | |
| 134 | + #profile.tab-pane | |
| 135 | + .row | |
| 136 | + .col-md-6 | |
| 137 | + .panel.panel-default | |
| 138 | + .panel-heading | |
| 139 | + = @user.name | |
| 140 | + %ul.well-list | |
| 141 | + %li | |
| 142 | + = image_tag avatar_icon(@user.email, 60), class: "avatar s60" | |
| 113 | 143 | %li |
| 114 | - Next groups with all content will be removed: | |
| 115 | - %strong #{@user.solo_owned_groups.map(&:name).join(', ')} | |
| 116 | - %br | |
| 117 | - = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove" | |
| 144 | + %span.light Profile page: | |
| 145 | + %strong | |
| 146 | + = link_to user_path(@user) do | |
| 147 | + = @user.username | |
| 148 | + .col-md-6 | |
| 149 | + = render 'users/profile', user: @user | |
| 118 | 150 | |
| 119 | - .col-md-6 | |
| 151 | + #groups.tab-pane | |
| 120 | 152 | - if @user.users_groups.present? |
| 121 | 153 | .panel.panel-default |
| 122 | 154 | .panel-heading Groups: |
| ... | ... | @@ -131,23 +163,42 @@ |
| 131 | 163 | - unless user_group.owner? |
| 132 | 164 | = link_to group_users_group_path(group, user_group), data: { confirm: remove_user_from_group_message(group, @user) }, method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do |
| 133 | 165 | %i.icon-remove.icon-white |
| 166 | + - else | |
| 167 | + .nothing-here-block This user has no groups. | |
| 134 | 168 | |
| 135 | - .panel.panel-default | |
| 136 | - .panel-heading Projects (#{@projects.count}) | |
| 137 | - %ul.well-list | |
| 138 | - - @projects.sort_by(&:name_with_namespace).each do |project| | |
| 139 | - - tm = project.team.find_tm(@user.id) | |
| 140 | - %li.users_project | |
| 141 | - = link_to admin_project_path(project), class: dom_class(project) do | |
| 142 | - = project.name_with_namespace | |
| 169 | + #projects.tab-pane | |
| 170 | + - if @user.groups.any? | |
| 171 | + .panel.panel-default | |
| 172 | + .panel-heading Group projects | |
| 173 | + %ul.well-list | |
| 174 | + - @user.groups.each do |group| | |
| 175 | + %li | |
| 176 | + %strong= group.name | |
| 177 | + – access to | |
| 178 | + #{pluralize(group.projects.count, 'project')} | |
| 143 | 179 | |
| 144 | - - if tm | |
| 145 | - .pull-right | |
| 146 | - - if tm.owner? | |
| 147 | - %span.light Owner | |
| 148 | - - else | |
| 149 | - %span.light= tm.human_access | |
| 180 | + .row | |
| 181 | + .col-md-6 | |
| 182 | + = render 'users/projects', projects: @personal_projects | |
| 183 | + | |
| 184 | + .col-md-6 | |
| 185 | + .panel.panel-default | |
| 186 | + .panel-heading Joined projects (#{@joined_projects.count}) | |
| 187 | + %ul.well-list | |
| 188 | + - @joined_projects.sort_by(&:name_with_namespace).each do |project| | |
| 189 | + - tm = project.team.find_tm(@user.id) | |
| 190 | + %li.users_project | |
| 191 | + .list-item-name | |
| 192 | + = link_to admin_project_path(project), class: dom_class(project) do | |
| 193 | + = project.name_with_namespace | |
| 194 | + | |
| 195 | + - if tm | |
| 196 | + .pull-right | |
| 197 | + - if tm.owner? | |
| 198 | + %span.light Owner | |
| 199 | + - else | |
| 200 | + %span.light= tm.human_access | |
| 150 | 201 | |
| 151 | - - if tm.respond_to? :project | |
| 152 | - = link_to project_team_member_path(project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do | |
| 153 | - %i.icon-remove | |
| 202 | + - if tm.respond_to? :project | |
| 203 | + = link_to project_team_member_path(project, @user), data: { confirm: remove_from_project_team_message(project, @user) }, remote: true, method: :delete, class: "btn-tiny btn btn-remove", title: 'Remove user from project' do | |
| 204 | + %i.icon-remove | ... | ... |
app/views/users/_projects.html.haml
app/views/users/show.html.haml
| ... | ... | @@ -13,12 +13,14 @@ |
| 13 | 13 | %br |
| 14 | 14 | %small member since #{@user.created_at.stamp("Nov 12, 2031")} |
| 15 | 15 | .clearfix |
| 16 | - %h4 Groups: | |
| 17 | - = render 'groups', groups: @groups | |
| 18 | - %hr | |
| 16 | + | |
| 17 | + - if @groups.any? | |
| 18 | + %h4 Groups: | |
| 19 | + = render 'groups', groups: @groups | |
| 20 | + %hr | |
| 19 | 21 | %h4 User Activity: |
| 20 | 22 | = render @events |
| 21 | 23 | .col-md-4 |
| 22 | 24 | = render 'profile', user: @user |
| 23 | 25 | - if @projects.present? |
| 24 | - = render 'projects' | |
| 26 | + = render 'projects', projects: @projects | ... | ... |