Move recommended index partial to a component

Thanks to it, we can slightly simplify the debates view rendering it.
This commit is contained in:
Javi Martín
2024-10-23 01:15:53 +02:00
parent d34c9905a4
commit a548c497fc
7 changed files with 81 additions and 70 deletions

View File

@@ -0,0 +1,14 @@
class Shared::RecommendedIndexComponent < ApplicationComponent
attr_reader :recommended, :disable_recommendations_path, :namespace
use_helpers :recommended_path, :current_path_with_query_params
def initialize(recommended, disable_recommendations_path:, namespace:)
@recommended = recommended
@disable_recommendations_path = disable_recommendations_path
@namespace = namespace
end
def render?
feature?("user.recommendations") && recommended.present?
end
end