Files
nairobi/app/components/shared/recommended_index_component.rb
Javi Martín 054fbf585e Simplify recommended index component parameters
We can get the path if we know the namespace, so we don't need to pass
both of them.
2025-08-22 13:42:41 +02:00

24 lines
563 B
Ruby

class Shared::RecommendedIndexComponent < ApplicationComponent
attr_reader :recommendations, :namespace
use_helpers :current_path_with_query_params
def initialize(recommendations, namespace:)
@recommendations = recommendations
@namespace = namespace
end
def render?
feature?("user.recommendations") && recommendations.present?
end
private
def disable_recommendations_path
if namespace == "debates"
recommendations_disable_debates_path
else
recommendations_disable_proposals_path
end
end
end