Update admin area with new group memberships
This commit is contained in:
parent
a0b6c964c5
commit
48019f1a0f
3 changed files with 33 additions and 34 deletions
|
@ -66,14 +66,12 @@ class Admin::GroupsController < Admin::ApplicationController
|
|||
end
|
||||
|
||||
def project_teams_update
|
||||
@group.add_users_to_project_teams(params[:user_ids].split(','), params[:project_access])
|
||||
@group.add_users(params[:user_ids].split(','), params[:group_access])
|
||||
|
||||
redirect_to [:admin, @group], notice: 'Users were successfully added.'
|
||||
end
|
||||
|
||||
def destroy
|
||||
@group.truncate_teams
|
||||
|
||||
@group.destroy
|
||||
|
||||
redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
|
||||
|
|
|
@ -3,7 +3,7 @@ class UsersController < ApplicationController
|
|||
|
||||
def show
|
||||
@user = User.find_by_username!(params[:username])
|
||||
@projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id))
|
||||
@projects = @user.authorized_projects.where('projects.id in (?)', current_user.authorized_projects.map(&:id)).order('namespace_id DESC')
|
||||
@events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
|
||||
|
||||
@title = @user.name
|
||||
|
|
|
@ -49,36 +49,6 @@
|
|||
%strong
|
||||
= @group.created_at.stamp("March 1, 1999")
|
||||
|
||||
|
||||
.ui-box
|
||||
%h5.title
|
||||
Add user to Group projects:
|
||||
.ui-box-body.form-holder
|
||||
%p.light
|
||||
Read more about project permissions
|
||||
%strong= link_to "here", help_permissions_path, class: "vlink"
|
||||
|
||||
= form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do
|
||||
%div
|
||||
= users_select_tag(:user_ids, multiple: true)
|
||||
%div.prepend-top-10
|
||||
= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"}
|
||||
%hr
|
||||
= submit_tag 'Add user to projects in group', class: "btn btn-create"
|
||||
.ui-box
|
||||
%h5.title
|
||||
Users from Group projects
|
||||
%small
|
||||
(#{@group.users.count})
|
||||
%ul.well-list
|
||||
- @group.users.sort_by(&:name).each do |user|
|
||||
%li{class: dom_class(user)}
|
||||
%strong
|
||||
= link_to user.name, admin_user_path(user)
|
||||
%span.pull-right.light
|
||||
= pluralize user.authorized_projects.in_namespace(@group).count, 'project'
|
||||
|
||||
.span6
|
||||
.ui-box
|
||||
%h5.title
|
||||
Projects
|
||||
|
@ -91,3 +61,34 @@
|
|||
= link_to project.name_with_namespace, [:admin, project]
|
||||
%span.pull-right.light
|
||||
%span.monospace= project.path_with_namespace + ".git"
|
||||
|
||||
.span6
|
||||
.ui-box
|
||||
%h5.title
|
||||
Add user to the group:
|
||||
.ui-box-body.form-holder
|
||||
%p.light
|
||||
Read more about project permissions
|
||||
%strong= link_to "here", help_permissions_path, class: "vlink"
|
||||
|
||||
= form_tag project_teams_update_admin_group_path(@group), id: "new_team_member", class: "bulk_import", method: :put do
|
||||
%div
|
||||
= users_select_tag(:user_ids, multiple: true)
|
||||
%div.prepend-top-10
|
||||
= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"}
|
||||
%hr
|
||||
= submit_tag 'Add user to the group', class: "btn btn-create"
|
||||
.ui-box
|
||||
%h5.title
|
||||
Users from #{@group.name} Group
|
||||
%small
|
||||
(#{@group.users_groups.count})
|
||||
%ul.well-list
|
||||
- @group.users_groups.order('group_access DESC').each do |member|
|
||||
- user = member.user
|
||||
%li{class: dom_class(user)}
|
||||
%strong
|
||||
= link_to user.name, admin_user_path(user)
|
||||
%span.pull-right.light
|
||||
= member.human_access
|
||||
|
||||
|
|
Loading…
Reference in a new issue