Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-11-01 03:39:01 +0300
committerThong Kuah <tkuah@gitlab.com>2018-11-01 09:37:33 +0300
commit1a1fdf8efe1923ba781e978e858c009264020e72 (patch)
treedf98af221d7a722e4c67db450b78a5488bff6a3c /app/controllers/projects/clusters_controller.rb
parent28dabc67f4db8271ac20c0db458ae2c86a906eee (diff)
Resolve controller sharing concern
Use ClustersController as base while having Projects::ClustersController to inform what `clusterable` is. Thanks @ayufan for the great suggestion ! - View changes to work with new approach - Fix javascript for new approach - Fix feature specs for new approach - Fix QA
Diffstat (limited to 'app/controllers/projects/clusters_controller.rb')
-rw-r--r--app/controllers/projects/clusters_controller.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/controllers/projects/clusters_controller.rb b/app/controllers/projects/clusters_controller.rb
new file mode 100644
index 00000000000..feda6deeaa6
--- /dev/null
+++ b/app/controllers/projects/clusters_controller.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class Projects::ClustersController < Clusters::ClustersController
+ include ProjectUnauthorized
+
+ prepend_before_action :project
+ before_action :repository
+
+ layout 'project'
+
+ private
+
+ def clusterable
+ @clusterable ||= ClusterablePresenter.fabricate(project, current_user: current_user)
+ end
+
+ def project
+ @project ||= find_routable!(Project, File.join(params[:namespace_id], params[:project_id]), not_found_or_authorized_proc: project_unauthorized_proc)
+ end
+
+ def repository
+ @repository ||= project.repository
+ end
+end