Commit ee13297a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Cleanup: removed unused routing/methods. Improved admin area usability

parent 59f75e6c
......@@ -44,16 +44,6 @@ class Admin::GroupsController < Admin::ApplicationController
end
end
def project_update
project_ids = params[:project_ids]
Project.where(id: project_ids).each do |project|
project.transfer(@group)
end
redirect_to :back, notice: 'Group was successfully updated.'
end
def project_teams_update
@group.add_users(params[:user_ids].split(','), params[:group_access])
......
class Admin::Projects::MembersController < Admin::Projects::ApplicationController
def edit
@member = team_member
@project = project
@team_member_relation = team_member_relation
end
def update
if team_member_relation.update_attributes(params[:team_member])
redirect_to [:admin, project], notice: 'Project Access was successfully updated.'
else
render action: "edit"
end
end
def destroy
team_member_relation.destroy
......@@ -28,5 +14,4 @@ class Admin::Projects::MembersController < Admin::Projects::ApplicationControlle
def team_member_relation
team_member.users_projects.find_by_project_id(project)
end
end
......@@ -12,17 +12,6 @@ class Admin::UsersController < Admin::ApplicationController
@projects = admin_user.authorized_projects
end
def team_update
UsersProject.add_users_into_projects(
params[:project_ids],
[admin_user.id],
params[:project_access]
)
redirect_to [:admin, admin_user], notice: 'Teams were successfully updated.'
end
def new
@admin_user = User.new.with_defaults
end
......
......@@ -65,7 +65,7 @@
.span6
.ui-box
%h5.title
Add user(s):
Add user(s) to the group:
.ui-box-body.form-holder
%p.light
Read more about project permissions
......@@ -80,7 +80,8 @@
= submit_tag 'Add users into group', class: "btn btn-create"
.ui-box
%h5.title
Users from #{@group.name} Group
%strong #{@group.name}
Group Members
%small
(#{@group.users_groups.count})
%ul.well-list.group-users-list
......
= form_for @team_member_relation, as: :team_member, url: admin_project_member_path(@project, @member) do |f|
-if @team_member_relation.errors.any?
.alert.alert-error
%ul
- @team_member_relation.errors.full_messages.each do |msg|
%li= msg
.clearfix
%label Project Access:
.input
= f.select :project_access, options_for_select(Project.access_options, @team_member_relation.project_access), {}, class: "project-access-select chosen span3"
%br
.actions
= f.submit 'Save', class: "btn btn-primary"
= link_to 'Cancel', :back, class: "btn"
%p.slead
Edit access for
= link_to @member.name, admin_user_path(@member)
in
= link_to @project.name_with_namespace, admin_project_path(@project)
%hr
= render 'form'
......@@ -91,12 +91,16 @@
Team
%small
(#{@project.users.count})
= link_to project_team_index_path(@project), class: "btn btn-tiny" do
%i.icon-edit
Edit Team
.pull-right
= link_to project_team_index_path(@project), class: "btn btn-tiny" do
%i.icon-edit
Manage Access
%ul.well-list.team_members
- @project.users.each do |tm|
- @project.users.each do |user|
%li
%strong
= link_to tm.name, admin_user_path(tm)
%span.pull-right.light= @project.project_access_human(tm)
= link_to user.name, admin_user_path(user)
.pull-right
%span.light= @project.project_access_human(user)
= link_to admin_project_member_path(@project, user), confirm: remove_from_project_team_message(@project, user), method: :delete, class: "btn btn-small btn-remove" do
%i.icon-remove
......@@ -63,15 +63,16 @@
%strong
= link_to @admin_user.created_by.name, [:admin, @admin_user.created_by]
- if @admin_user.owned_groups.present?
- if @admin_user.users_groups.present?
.ui-box
%h5.title Owned groups:
%h5.title Groups:
%ul.well-list
- @admin_user.groups.each do |group|
- @admin_user.users_groups.each do |user_group|
- group = user_group.group
%li
%strong= link_to group.name, admin_group_path(group)
.pull-right
%span.light= user_group.human_access
.span6
.ui-box
......@@ -87,16 +88,8 @@
%strong.well-title
= truncate(project.name, length: 45)
- if project.owner == @admin_user
%span.label.label-info owner
- if tm
.pull-right
= link_to edit_admin_project_member_path(project, tm.user), class: "btn grouped btn-small" do
%i.icon-edit
= link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @admin_user), method: :delete, class: "btn grouped btn-small btn-remove" do
%span.light= tm.human_access
= link_to admin_project_member_path(project, tm.user), confirm: remove_from_project_team_message(project, @admin_user), method: :delete, class: "btn btn-small btn-remove" do
%i.icon-remove
.pull-right.light
= tm.project_access_human
&nbsp;
......@@ -76,16 +76,7 @@ Gitlab::Application.routes.draw do
resources :groups, constraints: { id: /[^\/]+/ } do
member do
put :project_update
put :project_teams_update
delete :remove_project
end
end
resources :teams, constraints: { id: /[^\/]+/ } do
scope module: :teams do
resources :members, only: [:edit, :update, :destroy, :new, :create]
resources :projects, only: [:edit, :update, :destroy, :new, :create], constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }
end
end
......@@ -98,7 +89,7 @@ Gitlab::Application.routes.draw do
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do
scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
resources :members, only: [:edit, :update, :destroy]
resources :members, only: [:destroy]
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