Commit 224fb5770ce71061861f5c2bddb01924d668a841
1 parent
010ac2b1
Exists in
master
and in
4 other branches
Added ability to manage groups from admin
Showing
11 changed files
with
26 additions
and
7 deletions
Show diff stats
app/controllers/admin/groups_controller.rb
| @@ -52,6 +52,14 @@ class Admin::GroupsController < AdminController | @@ -52,6 +52,14 @@ class Admin::GroupsController < AdminController | ||
| 52 | redirect_to :back, notice: 'Group was successfully updated.' | 52 | redirect_to :back, notice: 'Group was successfully updated.' |
| 53 | end | 53 | end |
| 54 | 54 | ||
| 55 | + def remove_project | ||
| 56 | + @project = Project.find(params[:project_id]) | ||
| 57 | + @project.group_id = nil | ||
| 58 | + @project.save | ||
| 59 | + | ||
| 60 | + redirect_to :back, notice: 'Group was successfully updated.' | ||
| 61 | + end | ||
| 62 | + | ||
| 55 | def destroy | 63 | def destroy |
| 56 | @group.destroy | 64 | @group.destroy |
| 57 | 65 |
app/views/admin/groups/_form.html.haml
app/views/admin/groups/index.html.haml
app/views/admin/groups/show.html.haml
| 1 | += render 'admin/shared/projects_head' | ||
| 1 | %h3.page_title | 2 | %h3.page_title |
| 2 | Group: #{@group.name} | 3 | Group: #{@group.name} |
| 3 | = link_to edit_admin_group_path(@group), class: "btn right" do | 4 | = link_to edit_admin_group_path(@group), class: "btn right" do |
| @@ -38,6 +39,9 @@ | @@ -38,6 +39,9 @@ | ||
| 38 | %li.wll | 39 | %li.wll |
| 39 | %strong | 40 | %strong |
| 40 | = link_to project.name, [:admin, project] | 41 | = link_to project.name, [:admin, project] |
| 42 | + .right | ||
| 43 | + = link_to 'Remove from group', remove_project_admin_group_path(@group, project_id: project.id), confirm: 'Are you sure?', method: :delete, class: "btn danger small" | ||
| 44 | + .clearfix | ||
| 41 | 45 | ||
| 42 | %br | 46 | %br |
| 43 | %h3 Add new project | 47 | %h3 Add new project |
app/views/admin/projects/index.html.haml
app/views/admin/projects/show.html.haml
app/views/groups/_projects.html.haml
| @@ -3,11 +3,6 @@ | @@ -3,11 +3,6 @@ | ||
| 3 | Projects | 3 | Projects |
| 4 | %small | 4 | %small |
| 5 | (#{projects.count}) | 5 | (#{projects.count}) |
| 6 | - - if current_user.can_create_project? | ||
| 7 | - %span.right | ||
| 8 | - = link_to new_project_path, class: "btn very_small info" do | ||
| 9 | - %i.icon-plus | ||
| 10 | - New Project | ||
| 11 | %ul.unstyled | 6 | %ul.unstyled |
| 12 | - projects.each do |project| | 7 | - projects.each do |project| |
| 13 | %li.wll | 8 | %li.wll |
app/views/layouts/admin.html.haml
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | %ul.main_menu | 8 | %ul.main_menu |
| 9 | = nav_link(controller: :dashboard, html_options: {class: 'home'}) do | 9 | = nav_link(controller: :dashboard, html_options: {class: 'home'}) do |
| 10 | = link_to "Stats", admin_root_path | 10 | = link_to "Stats", admin_root_path |
| 11 | - = nav_link(controller: :projects) do | 11 | + = nav_link(controller: [:projects, :groups]) do |
| 12 | = link_to "Projects", admin_projects_path | 12 | = link_to "Projects", admin_projects_path |
| 13 | = nav_link(controller: :users) do | 13 | = nav_link(controller: :users) do |
| 14 | = link_to "Users", admin_users_path | 14 | = link_to "Users", admin_users_path |
config/routes.rb
| @@ -46,6 +46,7 @@ Gitlab::Application.routes.draw do | @@ -46,6 +46,7 @@ Gitlab::Application.routes.draw do | ||
| 46 | resources :groups, constraints: { id: /[^\/]+/ } do | 46 | resources :groups, constraints: { id: /[^\/]+/ } do |
| 47 | member do | 47 | member do |
| 48 | put :project_update | 48 | put :project_update |
| 49 | + delete :remove_project | ||
| 49 | end | 50 | end |
| 50 | end | 51 | end |
| 51 | resources :projects, constraints: { id: /[^\/]+/ } do | 52 | resources :projects, constraints: { id: /[^\/]+/ } do |