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 ...@@ -44,16 +44,6 @@ class Admin::GroupsController < Admin::ApplicationController
end end
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 def project_teams_update
@group.add_users(params[:user_ids].split(','), params[:group_access]) @group.add_users(params[:user_ids].split(','), params[:group_access])
......
class Admin::Projects::MembersController < Admin::Projects::ApplicationController 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 def destroy
team_member_relation.destroy team_member_relation.destroy
...@@ -28,5 +14,4 @@ class Admin::Projects::MembersController < Admin::Projects::ApplicationControlle ...@@ -28,5 +14,4 @@ class Admin::Projects::MembersController < Admin::Projects::ApplicationControlle
def team_member_relation def team_member_relation
team_member.users_projects.find_by_project_id(project) team_member.users_projects.find_by_project_id(project)
end end
end end
...@@ -12,17 +12,6 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -12,17 +12,6 @@ class Admin::UsersController < Admin::ApplicationController
@projects = admin_user.authorized_projects @projects = admin_user.authorized_projects
end 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 def new
@admin_user = User.new.with_defaults @admin_user = User.new.with_defaults
end end
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
.span6 .span6
.ui-box .ui-box
%h5.title %h5.title
Add user(s): Add user(s) 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
...@@ -80,7 +80,8 @@ ...@@ -80,7 +80,8 @@
= submit_tag 'Add users into group', class: "btn btn-create" = submit_tag 'Add users into group', class: "btn btn-create"
.ui-box .ui-box
%h5.title %h5.title
Users from #{@group.name} Group %strong #{@group.name}
Group Members
%small %small
(#{@group.users_groups.count}) (#{@group.users_groups.count})
%ul.well-list.group-users-list %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 @@ ...@@ -91,12 +91,16 @@
Team Team
%small %small
(#{@project.users.count}) (#{@project.users.count})
= link_to project_team_index_path(@project), class: "btn btn-tiny" do .pull-right
%i.icon-edit = link_to project_team_index_path(@project), class: "btn btn-tiny" do
Edit Team %i.icon-edit
Manage Access
%ul.well-list.team_members %ul.well-list.team_members
- @project.users.each do |tm| - @project.users.each do |user|
%li %li
%strong %strong
= link_to tm.name, admin_user_path(tm) = link_to user.name, admin_user_path(user)
%span.pull-right.light= @project.project_access_human(tm) .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 @@ ...@@ -63,15 +63,16 @@
%strong %strong
= link_to @admin_user.created_by.name, [:admin, @admin_user.created_by] = 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 .ui-box
%h5.title Owned groups: %h5.title Groups:
%ul.well-list %ul.well-list
- @admin_user.groups.each do |group| - @admin_user.users_groups.each do |user_group|
- group = user_group.group
%li %li
%strong= link_to group.name, admin_group_path(group) %strong= link_to group.name, admin_group_path(group)
.pull-right
%span.light= user_group.human_access
.span6 .span6
.ui-box .ui-box
...@@ -87,16 +88,8 @@ ...@@ -87,16 +88,8 @@
%strong.well-title %strong.well-title
= truncate(project.name, length: 45) = truncate(project.name, length: 45)
- if project.owner == @admin_user
%span.label.label-info owner
- if tm - if tm
.pull-right .pull-right
= link_to edit_admin_project_member_path(project, tm.user), class: "btn grouped btn-small" do %span.light= tm.human_access
%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 btn-small btn-remove" do
= 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
%i.icon-remove %i.icon-remove
.pull-right.light
= tm.project_access_human
&nbsp;
...@@ -76,16 +76,7 @@ Gitlab::Application.routes.draw do ...@@ -76,16 +76,7 @@ Gitlab::Application.routes.draw do
resources :groups, constraints: { id: /[^\/]+/ } do resources :groups, constraints: { id: /[^\/]+/ } do
member do member do
put :project_update
put :project_teams_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
end end
...@@ -98,7 +89,7 @@ Gitlab::Application.routes.draw do ...@@ -98,7 +89,7 @@ Gitlab::Application.routes.draw do
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] 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 scope module: :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
resources :members, only: [:edit, :update, :destroy] resources :members, only: [:destroy]
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