summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2014-11-18 10:44:15 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2014-11-18 10:44:15 +0000
commita4e98f0ec985c91631f41c56317926f29365d95a (patch)
treeb9f47db5ffcb682281a52f281069e2bd8a852bad /app/controllers
parentd803f210aa5e87a441fca562910122f2cfde9fa6 (diff)
parent2388fdd7c6274dad8c10f5bc517f0a8b1aa28aa3 (diff)
downloadgitlab-ce-a4e98f0ec985c91631f41c56317926f29365d95a.tar.gz
Merge branch 'fork-to-group' into 'master'
Fork to group Fixes #1592 * project can be forked into group * fork link always lead to fork page where you select namespace where to fork See merge request !1253
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/forks_controller.rb22
-rw-r--r--app/controllers/projects_controller.rb16
2 files changed, 22 insertions, 16 deletions
diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb
new file mode 100644
index 00000000000..a0481d11582
--- /dev/null
+++ b/app/controllers/projects/forks_controller.rb
@@ -0,0 +1,22 @@
+class Projects::ForksController < Projects::ApplicationController
+ # Authorize
+ before_filter :authorize_download_code!
+ before_filter :require_non_empty_project
+
+ def new
+ @namespaces = current_user.manageable_namespaces
+ @namespaces.delete(@project.namespace)
+ end
+
+ def create
+ namespace = Namespace.find(params[:namespace_id])
+ @forked_project = ::Projects::ForkService.new(project, current_user, namespace: namespace).execute
+
+ if @forked_project.saved? && @forked_project.forked?
+ redirect_to(@forked_project, notice: 'Project was successfully forked.')
+ else
+ @title = 'Fork project'
+ render :error
+ end
+ end
+end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index b5910c902e4..b3181fa310e 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -111,22 +111,6 @@ class ProjectsController < ApplicationController
end
end
- def fork
- @forked_project = ::Projects::ForkService.new(project, current_user).execute
-
- respond_to do |format|
- format.html do
- if @forked_project.saved? && @forked_project.forked?
- redirect_to(@forked_project, notice: 'Project was successfully forked.')
- else
- @title = 'Fork project'
- render "fork"
- end
- end
- format.js
- end
- end
-
def autocomplete_sources
note_type = params['type']
note_id = params['type_id']