Remove helper that returned a polymorphic path
This is similar to what we did in commits1a902a967andfa3781059.
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
<% recommended.each do |recommended| %>
|
<% recommended.each do |recommended| %>
|
||||||
<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, recommended_path(recommended) %></h3>
|
<h3><%= link_to recommended.title, polymorphic_path(recommended) %></h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Shared::RecommendedIndexComponent < ApplicationComponent
|
class Shared::RecommendedIndexComponent < ApplicationComponent
|
||||||
attr_reader :recommended, :disable_recommendations_path, :namespace
|
attr_reader :recommended, :disable_recommendations_path, :namespace
|
||||||
use_helpers :recommended_path, :current_path_with_query_params
|
use_helpers :current_path_with_query_params
|
||||||
|
|
||||||
def initialize(recommended, disable_recommendations_path:, namespace:)
|
def initialize(recommended, disable_recommendations_path:, namespace:)
|
||||||
@recommended = recommended
|
@recommended = recommended
|
||||||
|
|||||||
@@ -7,17 +7,6 @@ module WelcomeHelper
|
|||||||
"display: none;" if index.positive?
|
"display: none;" if index.positive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def recommended_path(recommended)
|
|
||||||
case recommended.class.name
|
|
||||||
when "Debate"
|
|
||||||
debate_path(recommended)
|
|
||||||
when "Proposal"
|
|
||||||
proposal_path(recommended)
|
|
||||||
else
|
|
||||||
"#"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def render_recommendation_image(recommended)
|
def render_recommendation_image(recommended)
|
||||||
image_path = calculate_image_path(recommended)
|
image_path = calculate_image_path(recommended)
|
||||||
image_tag(image_path) if image_path.present?
|
image_tag(image_path) if image_path.present?
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<div class="card">
|
<div class="card">
|
||||||
<%= render_recommendation_image(recommended) %>
|
<%= render_recommendation_image(recommended) %>
|
||||||
<div class="card-section">
|
<div class="card-section">
|
||||||
<%= link_to recommended_path(recommended) do %>
|
<%= link_to polymorphic_path(recommended) do %>
|
||||||
<h4 class="truncate-horizontal-text"><%= recommended.title %></h4>
|
<h4 class="truncate-horizontal-text"><%= recommended.title %></h4>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= wysiwyg(recommended.description) %>
|
<%= wysiwyg(recommended.description) %>
|
||||||
|
|||||||
Reference in New Issue
Block a user