Commit 48019f1a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Update admin area with new group memberships

parent a0b6c964
...@@ -66,14 +66,12 @@ class Admin::GroupsController < Admin::ApplicationController ...@@ -66,14 +66,12 @@ class Admin::GroupsController < Admin::ApplicationController
end end
def project_teams_update 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.' redirect_to [:admin, @group], notice: 'Users were successfully added.'
end end
def destroy def destroy
@group.truncate_teams
@group.destroy @group.destroy
redirect_to admin_groups_path, notice: 'Group was successfully deleted.' redirect_to admin_groups_path, notice: 'Group was successfully deleted.'
......
...@@ -3,7 +3,7 @@ class UsersController < ApplicationController ...@@ -3,7 +3,7 @@ class UsersController < ApplicationController
def show def show
@user = User.find_by_username!(params[:username]) @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) @events = @user.recent_events.where(project_id: @projects.map(&:id)).limit(20)
@title = @user.name @title = @user.name
......
...@@ -49,10 +49,23 @@ ...@@ -49,10 +49,23 @@
%strong %strong
= @group.created_at.stamp("March 1, 1999") = @group.created_at.stamp("March 1, 1999")
.ui-box
%h5.title
Projects
%small
(#{@group.projects.count})
%ul.well-list
- @group.projects.sort_by(&:name).each do |project|
%li
%strong
= link_to project.name_with_namespace, [:admin, project]
%span.pull-right.light
%span.monospace= project.path_with_namespace + ".git"
.span6
.ui-box .ui-box
%h5.title %h5.title
Add user to Group projects: Add user to the group:
.ui-box-body.form-holder .ui-box-body.form-holder
%p.light %p.light
Read more about project permissions Read more about project permissions
...@@ -64,30 +77,18 @@ ...@@ -64,30 +77,18 @@
%div.prepend-top-10 %div.prepend-top-10
= select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"} = select_tag :project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span2"}
%hr %hr
= submit_tag 'Add user to projects in group', class: "btn btn-create" = submit_tag 'Add user to the group', class: "btn btn-create"
.ui-box .ui-box
%h5.title %h5.title
Users from Group projects Users from #{@group.name} Group
%small %small
(#{@group.users.count}) (#{@group.users_groups.count})
%ul.well-list %ul.well-list
- @group.users.sort_by(&:name).each do |user| - @group.users_groups.order('group_access DESC').each do |member|
- user = member.user
%li{class: dom_class(user)} %li{class: dom_class(user)}
%strong %strong
= link_to user.name, admin_user_path(user) = link_to user.name, admin_user_path(user)
%span.pull-right.light %span.pull-right.light
= pluralize user.authorized_projects.in_namespace(@group).count, 'project' = member.human_access
.span6
.ui-box
%h5.title
Projects
%small
(#{@group.projects.count})
%ul.well-list
- @group.projects.sort_by(&:name).each do |project|
%li
%strong
= link_to project.name_with_namespace, [:admin, project]
%span.pull-right.light
%span.monospace= project.path_with_namespace + ".git"
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