BigW Consortium Gitlab

Commit 224fb577 by Dmitriy Zaporozhets

Added ability to manage groups from admin

parent 010ac2b1
...@@ -52,6 +52,14 @@ class Admin::GroupsController < AdminController ...@@ -52,6 +52,14 @@ class Admin::GroupsController < AdminController
redirect_to :back, notice: 'Group was successfully updated.' redirect_to :back, notice: 'Group was successfully updated.'
end end
def remove_project
@project = Project.find(params[:project_id])
@project.group_id = nil
@project.save
redirect_to :back, notice: 'Group was successfully updated.'
end
def destroy def destroy
@group.destroy @group.destroy
......
...@@ -16,4 +16,4 @@ ...@@ -16,4 +16,4 @@
= f.text_field :code, placeholder: "example" = f.text_field :code, placeholder: "example"
.form-actions .form-actions
= f.submit 'Create group', class: "btn primary" = f.submit 'Save group', class: "btn save-btn"
%h3.page_title Edit Group
%br
= render 'form'
= render 'admin/shared/projects_head'
%h3.page_title %h3.page_title
Groups Groups
= link_to 'New Group', new_admin_group_path, class: "btn small right" = link_to 'New Group', new_admin_group_path, class: "btn small right"
......
= render 'admin/shared/projects_head'
%h3.page_title %h3.page_title
Group: #{@group.name} Group: #{@group.name}
= link_to edit_admin_group_path(@group), class: "btn right" do = link_to edit_admin_group_path(@group), class: "btn right" do
...@@ -38,6 +39,9 @@ ...@@ -38,6 +39,9 @@
%li.wll %li.wll
%strong %strong
= link_to project.name, [:admin, project] = link_to project.name, [:admin, project]
.right
= 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"
.clearfix
%br %br
%h3 Add new project %h3 Add new project
......
= render 'admin/shared/projects_head'
%h3.page_title %h3.page_title
Projects Projects
= link_to 'New Project', new_admin_project_path, class: "btn small right" = link_to 'New Project', new_admin_project_path, class: "btn small right"
......
= render 'admin/shared/projects_head'
%h3.page_title %h3.page_title
Project: #{@admin_project.name} Project: #{@admin_project.name}
= link_to edit_admin_project_path(@admin_project), class: "btn right" do = link_to edit_admin_project_path(@admin_project), class: "btn right" do
......
%ul.nav.nav-tabs
= nav_link(controller: :projects) do
= link_to 'Projects', admin_projects_path, class: "tab"
= nav_link(controller: :groups) do
= link_to 'Groups', admin_groups_path, class: "tab"
...@@ -3,11 +3,6 @@ ...@@ -3,11 +3,6 @@
Projects Projects
%small %small
(#{projects.count}) (#{projects.count})
- if current_user.can_create_project?
%span.right
= link_to new_project_path, class: "btn very_small info" do
%i.icon-plus
New Project
%ul.unstyled %ul.unstyled
- projects.each do |project| - projects.each do |project|
%li.wll %li.wll
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
%ul.main_menu %ul.main_menu
= nav_link(controller: :dashboard, html_options: {class: 'home'}) do = nav_link(controller: :dashboard, html_options: {class: 'home'}) do
= link_to "Stats", admin_root_path = link_to "Stats", admin_root_path
= nav_link(controller: :projects) do = nav_link(controller: [:projects, :groups]) do
= link_to "Projects", admin_projects_path = link_to "Projects", admin_projects_path
= nav_link(controller: :users) do = nav_link(controller: :users) do
= link_to "Users", admin_users_path = link_to "Users", admin_users_path
......
...@@ -46,6 +46,7 @@ Gitlab::Application.routes.draw do ...@@ -46,6 +46,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_update
delete :remove_project
end end
end end
resources :projects, constraints: { id: /[^\/]+/ } do resources :projects, constraints: { id: /[^\/]+/ } do
......
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