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/presenters/project_clusterable_presenter.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/presenters/project_clusterable_presenter.rb')
-rw-r--r-- | app/presenters/project_clusterable_presenter.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/presenters/project_clusterable_presenter.rb b/app/presenters/project_clusterable_presenter.rb new file mode 100644 index 00000000000..f986b5584a3 --- /dev/null +++ b/app/presenters/project_clusterable_presenter.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ProjectClusterablePresenter < ClusterablePresenter + def index_path + project_clusters_path(clusterable) + end + + def new_path + new_project_cluster_path(clusterable) + end + + def clusterable_params + { project_id: clusterable.to_param, namespace_id: clusterable.namespace.to_param } + end +end |