diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-10-30 23:33:43 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-11-01 19:37:32 +1300 |
commit | 1163b235391668d53ae0cea80bc22d40b365e0a7 (patch) | |
tree | ce2cf692f41fba52eb42e767611e130399c85499 /app/controllers/clusters/base_controller.rb | |
parent | 88800abcd8741b07114c2850e00b74fbecfbf90e (diff) | |
download | gitlab-ce-1163b235391668d53ae0cea80bc22d40b365e0a7.tar.gz |
Move view and path concerns to presenters
- Move show path for cluster to ClusterPresenter
- Create ClusterablePresenter to encapsulate logic. Consolidates
scattered methods from BaseController and ClustersHelper into an object.
Diffstat (limited to 'app/controllers/clusters/base_controller.rb')
-rw-r--r-- | app/controllers/clusters/base_controller.rb | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/app/controllers/clusters/base_controller.rb b/app/controllers/clusters/base_controller.rb index 2e9997dfc08..8908b26b914 100644 --- a/app/controllers/clusters/base_controller.rb +++ b/app/controllers/clusters/base_controller.rb @@ -11,7 +11,7 @@ class Clusters::BaseController < ApplicationController layout :determine_layout - helper_method :clusters_page_path, :cluster_page_path, :new_cluster_page_path + helper_method :clusterable private @@ -43,27 +43,7 @@ class Clusters::BaseController < ApplicationController end def clusterable - if project_type? - project - end - end - - def cluster_page_path(cluster) - if project_type? - project_cluster_path(project, cluster) - end - end - - def clusters_page_path - if project_type? - project_clusters_path(project) - end - end - - def new_cluster_page_path - if project_type? - new_project_cluster_path(project) - end + @clusterable ||= ClusterablePresenter.fabricate(project, current_user: current_user) end def project_type? |