Commit b2102468 authored by James Gregory's avatar James Gregory

Merged the 'groups' and 'projects' tabs when viewing user profiles

parent f9a49d09
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
.append-bottom-default { margin-bottom: $gl-padding; } .append-bottom-default { margin-bottom: $gl-padding; }
.inline { display: inline-block; } .inline { display: inline-block; }
.center { text-align: center; } .center { text-align: center; }
.vertical-align-middle { vertical-align: middle; }
.underlined-link { text-decoration: underline; } .underlined-link { text-decoration: underline; }
.hint { font-style: italic; color: $hint-color; } .hint { font-style: italic; color: $hint-color; }
......
...@@ -16,9 +16,6 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -16,9 +16,6 @@ class Admin::UsersController < Admin::ApplicationController
@joined_projects = user.projects.joined(@user) @joined_projects = user.projects.joined(@user)
end end
def groups
end
def keys def keys
@keys = user.keys @keys = user.keys
end end
......
...@@ -15,10 +15,8 @@ ...@@ -15,10 +15,8 @@
%ul.nav-links %ul.nav-links
= nav_link(path: 'users#show') do = nav_link(path: 'users#show') do
= link_to "Account", admin_user_path(@user) = link_to "Account", admin_user_path(@user)
= nav_link(path: 'users#groups') do
= link_to "Groups", groups_admin_user_path(@user)
= nav_link(path: 'users#projects') do = nav_link(path: 'users#projects') do
= link_to "Projects", projects_admin_user_path(@user) = link_to "Groups and projects", projects_admin_user_path(@user)
= nav_link(path: 'users#keys') do = nav_link(path: 'users#keys') do
= link_to "SSH keys", keys_admin_user_path(@user) = link_to "SSH keys", keys_admin_user_path(@user)
= nav_link(controller: :identities) do = nav_link(controller: :identities) do
......
- page_title "Groups", @user.name, "Users"
= render 'admin/users/head'
- group_members = @user.group_members.includes(:source)
- if group_members.any?
.panel.panel-default
.panel-heading Groups:
%ul.well-list
- group_members.each do |group_member|
- group = group_member.group
%li.group_member
%span{class: ("list-item-name" unless group_member.owner?)}
%strong= link_to group.name, admin_group_path(group)
.pull-right
%span.light= group_member.human_access
- unless group_member.owner?
= link_to group_group_member_path(group, group_member), data: { confirm: remove_member_message(group_member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove", title: 'Remove user from group' do
%i.fa.fa-times.fa-inverse
- else
.nothing-here-block This user has no groups.
- page_title "Projects", @user.name, "Users" - page_title "Groups and projects", @user.name, "Users"
= render 'admin/users/head' = render 'admin/users/head'
- if @user.groups.any? - if @user.groups.any?
.panel.panel-default .panel.panel-default
.panel-heading Group projects .panel-heading Group projects
%ul.well-list %ul.well-list
- @user.groups.each do |group| - @user.group_members.includes(:source).each do |group_member|
%li - group = group_member.group
%li.group_member
%strong= link_to group.name, admin_group_path(group) %strong= link_to group.name, admin_group_path(group)
&ndash; access to &ndash; access to
#{pluralize(group.projects.count, 'project')} #{pluralize(group.projects.count, 'project')}
.pull-right
%span.light.vertical-align-middle= group_member.human_access
- unless group_member.owner?
= link_to group_group_member_path(group, group_member), data: { confirm: remove_member_message(group_member) }, method: :delete, remote: true, class: "btn-xs btn btn-remove prepend-left-10", title: 'Remove user from group' do
%i.fa.fa-times.fa-inverse
.row .row
.col-md-6 .col-md-6
...@@ -35,8 +41,8 @@ ...@@ -35,8 +41,8 @@
- if member.owner? - if member.owner?
%span.light Owner %span.light Owner
- else - else
%span.light= member.human_access %span.light.vertical-align-middle= member.human_access
- if member.respond_to? :project - if member.respond_to? :project
= link_to namespace_project_project_member_path(project.namespace, project, member), data: { confirm: remove_member_message(member) }, remote: true, method: :delete, class: "btn-xs btn btn-remove", title: 'Remove user from project' do = link_to namespace_project_project_member_path(project.namespace, project, member), data: { confirm: remove_member_message(member) }, remote: true, method: :delete, class: "btn-xs btn btn-remove prepend-left-10", title: 'Remove user from project' do
%i.fa.fa-times %i.fa.fa-times
---
title: Merged the 'Groups' and 'Projects' tabs when viewing user profiles
merge_request: 8323
author: James Gregory
...@@ -6,7 +6,6 @@ namespace :admin do ...@@ -6,7 +6,6 @@ namespace :admin do
member do member do
get :projects get :projects
get :keys get :keys
get :groups
put :block put :block
put :unblock put :unblock
put :unlock put :unlock
......
require 'spec_helper' require 'spec_helper'
describe "Admin::Users", feature: true do describe "Admin::Users", feature: true do
include WaitForAjax
before { login_as :admin } before { login_as :admin }
describe "GET /admin/users" do describe "GET /admin/users" do
...@@ -252,5 +254,20 @@ describe "Admin::Users", feature: true do ...@@ -252,5 +254,20 @@ describe "Admin::Users", feature: true do
end end
expect(page).to have_content @project.name expect(page).to have_content @project.name
end end
it 'shows the group access level' do
within(:css, '.append-bottom-default + .panel') do
expect(page).to have_content 'Developer'
end
end
it 'allows group membership to be revoked', js: true do
page.within(first('.group_member')) do
find('.btn-remove').click
end
wait_for_ajax
expect(page).not_to have_selector('.group_member')
end
end end
end end
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