BigW Consortium Gitlab

Commit c2173a14 by Sean McGivern

Merge branch 'feature/admin-merge-groups-and-projects' into 'master'

Merged the 'groups' and 'projects' tabs when viewing user profiles Closes #24752 See merge request !8323
parents 535fa7d8 b2102468
......@@ -26,6 +26,7 @@
.append-bottom-default { margin-bottom: $gl-padding; }
.inline { display: inline-block; }
.center { text-align: center; }
.vertical-align-middle { vertical-align: middle; }
.underlined-link { text-decoration: underline; }
.hint { font-style: italic; color: $hint-color; }
......
......@@ -16,9 +16,6 @@ class Admin::UsersController < Admin::ApplicationController
@joined_projects = user.projects.joined(@user)
end
def groups
end
def keys
@keys = user.keys
end
......
......@@ -15,10 +15,8 @@
%ul.nav-links
= nav_link(path: 'users#show') do
= 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
= link_to "Projects", projects_admin_user_path(@user)
= link_to "Groups and projects", projects_admin_user_path(@user)
= nav_link(path: 'users#keys') do
= link_to "SSH keys", keys_admin_user_path(@user)
= 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'
- if @user.groups.any?
.panel.panel-default
.panel-heading Group projects
%ul.well-list
- @user.groups.each do |group|
%li
- @user.group_members.includes(:source).each do |group_member|
- group = group_member.group
%li.group_member
%strong= link_to group.name, admin_group_path(group)
&ndash; access to
#{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
.col-md-6
......@@ -35,8 +41,8 @@
- if member.owner?
%span.light Owner
- else
%span.light= member.human_access
%span.light.vertical-align-middle= member.human_access
- 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
---
title: Merged the 'Groups' and 'Projects' tabs when viewing user profiles
merge_request: 8323
author: James Gregory
......@@ -6,7 +6,6 @@ namespace :admin do
member do
get :projects
get :keys
get :groups
put :block
put :unblock
put :unlock
......
require 'spec_helper'
describe "Admin::Users", feature: true do
include WaitForAjax
before { login_as :admin }
describe "GET /admin/users" do
......@@ -252,5 +254,20 @@ describe "Admin::Users", feature: true do
end
expect(page).to have_content @project.name
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
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