diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-15 17:25:37 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-15 17:25:37 +0400 |
commit | 0815098d3af16444645d161cde3ef5150b2fd75d (patch) | |
tree | 7f0b3b9f3ca650a7c1913b5c589da84b1eb25e23 /app | |
parent | dcea191314c778331305d0926d6852fe04477115 (diff) |
Admin can transfer project to any namespace
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/common.scss | 30 | ||||
-rw-r--r-- | app/assets/stylesheets/selects.scss | 19 | ||||
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 24 | ||||
-rw-r--r-- | app/models/namespace.rb | 4 | ||||
-rw-r--r-- | app/views/admin/projects/show.html.haml | 17 |
5 files changed, 72 insertions, 22 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 56dbd9ac433..935d24e58ff 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -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; + } +} diff --git a/app/assets/stylesheets/selects.scss b/app/assets/stylesheets/selects.scss index 3b61594e668..8a695d8b16d 100644 --- a/app/assets/stylesheets/selects.scss +++ b/app/assets/stylesheets/selects.scss @@ -1,22 +1,3 @@ -.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; diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 088174fd3b8..4de0a65b5fe 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -1,5 +1,7 @@ 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 @@ class Admin::ProjectsController < Admin::ApplicationController 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 @@ class Admin::ProjectsController < Admin::ApplicationController @project = Project.find_with_namespace(id) @project || render_404 end + + def group + @group ||= project.group + end + + def repository + @repository ||= project.repository + end end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index fde06649c78..8f837c72ff5 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -87,4 +87,8 @@ class Namespace < ActiveRecord::Base def send_update_instructions projects.each(&:send_move_instructions) end + + def kind + type == 'Group' ? 'group' : 'user' + end end diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index 65b9911dc46..c9c9c38d9f5 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -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 |