From 1163b235391668d53ae0cea80bc22d40b365e0a7 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Tue, 30 Oct 2018 23:33:43 +1300 Subject: 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. --- app/presenters/clusters/cluster_presenter.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/presenters/clusters/cluster_presenter.rb') diff --git a/app/presenters/clusters/cluster_presenter.rb b/app/presenters/clusters/cluster_presenter.rb index dfdd8e82f97..78d632eb77c 100644 --- a/app/presenters/clusters/cluster_presenter.rb +++ b/app/presenters/clusters/cluster_presenter.rb @@ -11,5 +11,13 @@ module Clusters def can_toggle_cluster? can?(current_user, :update_cluster, cluster) && created? end + + def show_path + if cluster.project_type? + project_cluster_path(project, cluster) + else + raise NotImplementedError + end + end end end -- cgit v1.2.1