Use a different parameter name in recommendex index
The problem with "recommended" is that it had identical singular and plural, which means it wasn't clear whether we were using it to refer to an item of a collection or to refer to the collection itself.
This commit is contained in:
@@ -16,10 +16,10 @@
|
|||||||
<span class="show-for-sr"><%= t("shared.recommended_index.hide") %></span>
|
<span class="show-for-sr"><%= t("shared.recommended_index.hide") %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% recommended.each do |recommended| %>
|
<% recommendations.each do |recommendation| %>
|
||||||
<div class="small-12 medium-6 large-4 column end">
|
<div class="small-12 medium-6 large-4 column end">
|
||||||
<div class="recommendation" data-equalizer-watch>
|
<div class="recommendation" data-equalizer-watch>
|
||||||
<h3><%= link_to recommended.title, polymorphic_path(recommended) %></h3>
|
<h3><%= link_to recommendation.title, polymorphic_path(recommendation) %></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
class Shared::RecommendedIndexComponent < ApplicationComponent
|
class Shared::RecommendedIndexComponent < ApplicationComponent
|
||||||
attr_reader :recommended, :disable_recommendations_path, :namespace
|
attr_reader :recommendations, :disable_recommendations_path, :namespace
|
||||||
use_helpers :current_path_with_query_params
|
use_helpers :current_path_with_query_params
|
||||||
|
|
||||||
def initialize(recommended, disable_recommendations_path:, namespace:)
|
def initialize(recommendations, disable_recommendations_path:, namespace:)
|
||||||
@recommended = recommended
|
@recommendations = recommendations
|
||||||
@disable_recommendations_path = disable_recommendations_path
|
@disable_recommendations_path = disable_recommendations_path
|
||||||
@namespace = namespace
|
@namespace = namespace
|
||||||
end
|
end
|
||||||
|
|
||||||
def render?
|
def render?
|
||||||
feature?("user.recommendations") && recommended.present?
|
feature?("user.recommendations") && recommendations.present?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user