Unverified Commit 0815098d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Admin can transfer project to any namespace


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 49f6a49399e8
......@@ -358,3 +358,33 @@ table {
background: #555;
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-container {
min-width: 100px;
......
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
owner_id = params[:owner_id]
......@@ -14,8 +16,16 @@ def index
end
def show
@repository = @project.repository
@group = @project.group
end
def transfer
result = ::Projects::TransferContext.new(@project, current_user, project: params).execute(:admin)
if result
redirect_to [:admin, @project]
else
render :show
end
end
protected
......@@ -26,4 +36,12 @@ def project
@project = Project.find_with_namespace(id)
@project || render_404
end
def group
@group ||= project.group
end
def repository
@repository ||= project.repository
end
end
......@@ -87,4 +87,8 @@ def move_dir
def send_update_instructions
projects.each(&:send_move_instructions)
end
def kind
type == 'Group' ? 'group' : 'user'
end
end
......@@ -74,6 +74,23 @@
%span.cgreen
%i.icon-lock
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
- if @group
.ui-box
......
......@@ -89,7 +89,13 @@
resources :broadcast_messages, only: [:index, :create, :destroy]
resource :logs, 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"
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