Commit 0815098d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Admin can transfer project to any namespace

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent dcea1913
...@@ -358,3 +358,33 @@ table { ...@@ -358,3 +358,33 @@ table {
background: #555; background: #555;
color: #BBB; color: #BBB;
} }
.ajax-users-select {
width: 400px;
&.input-large {
width: 210px;
}
}
.user-result {
.user-image {
float: left;
}
.user-name {
}
.user-username {
color: #999;
}
}
.namespace-result {
.namespace-kind {
color: #AAA;
font-weight: normal;
}
.namespace-path {
margin-left: 10px;
font-weight: bolder;
}
}
.ajax-users-select {
width: 400px;
&.input-large {
width: 210px;
}
}
.user-result {
.user-image {
float: left;
}
.user-name {
}
.user-username {
color: #999;
}
}
/** Chosen.js selectbox style override **/ /** Chosen.js selectbox style override **/
.chosen-container { .chosen-container {
min-width: 100px; min-width: 100px;
......
class Admin::ProjectsController < Admin::ApplicationController class Admin::ProjectsController < Admin::ApplicationController
before_filter :project, only: [:edit, :show, :update, :destroy, :team_update] before_filter :project, only: [:show, :transfer]
before_filter :group, only: [:show, :transfer]
before_filter :repository, only: [:show, :transfer]
def index def index
owner_id = params[:owner_id] owner_id = params[:owner_id]
...@@ -14,8 +16,16 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -14,8 +16,16 @@ class Admin::ProjectsController < Admin::ApplicationController
end end
def show def show
@repository = @project.repository end
@group = @project.group
def transfer
result = ::Projects::TransferContext.new(@project, current_user, project: params).execute(:admin)
if result
redirect_to [:admin, @project]
else
render :show
end
end end
protected protected
...@@ -26,4 +36,12 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -26,4 +36,12 @@ class Admin::ProjectsController < Admin::ApplicationController
@project = Project.find_with_namespace(id) @project = Project.find_with_namespace(id)
@project || render_404 @project || render_404
end end
def group
@group ||= project.group
end
def repository
@repository ||= project.repository
end
end end
...@@ -87,4 +87,8 @@ class Namespace < ActiveRecord::Base ...@@ -87,4 +87,8 @@ class Namespace < ActiveRecord::Base
def send_update_instructions def send_update_instructions
projects.each(&:send_move_instructions) projects.each(&:send_move_instructions)
end end
def kind
type == 'Group' ? 'group' : 'user'
end
end end
...@@ -74,6 +74,23 @@ ...@@ -74,6 +74,23 @@
%span.cgreen %span.cgreen
%i.icon-lock %i.icon-lock
Private Private
.ui-box
.title
Transfer project
.ui-box-body
= form_for @project, url: transfer_admin_project_path(@project), method: :put do |f|
.control-group
= f.label :namespace_id, "Namespace"
.controls
= namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large'
.control-group
.controls
= f.submit 'Transfer', class: 'btn btn-primary'
.span6 .span6
- if @group - if @group
.ui-box .ui-box
......
...@@ -89,7 +89,13 @@ Gitlab::Application.routes.draw do ...@@ -89,7 +89,13 @@ Gitlab::Application.routes.draw do
resources :broadcast_messages, only: [:index, :create, :destroy] resources :broadcast_messages, only: [:index, :create, :destroy]
resource :logs, only: [:show] resource :logs, only: [:show]
resource :background_jobs, controller: 'background_jobs', only: [:show] resource :background_jobs, controller: 'background_jobs', only: [:show]
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show]
resources :projects, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ }, only: [:index, :show] do
member do
put :transfer
end
end
root to: "dashboard#index" root to: "dashboard#index"
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