makes tag_cloud to accept taggable
fixes links in proposals' tag cloud
This commit is contained in:
14
app/helpers/tags_helper.rb
Normal file
14
app/helpers/tags_helper.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module TagsHelper
|
||||
|
||||
def taggable_path(taggable, tag_name)
|
||||
case taggable
|
||||
when 'debate'
|
||||
debates_path(tag: tag_name)
|
||||
when 'proposal'
|
||||
proposals_path(tag: tag_name)
|
||||
else
|
||||
'#'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="small-12 medium-3 column">
|
||||
<aside class="sidebar" role="complementary">
|
||||
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
|
||||
<%= render "shared/tag_cloud" %>
|
||||
<%= render "shared/tag_cloud", taggable: 'debate' %>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="small-12 medium-3 column">
|
||||
<aside class="sidebar" role="complementary">
|
||||
<%= link_to t("proposals.index.start_proposal"), new_proposal_path, class: 'button radius expand' %>
|
||||
<%= render "shared/tag_cloud" %>
|
||||
<%= render "shared/tag_cloud", taggable: 'proposal' %>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
<h3><%= t("shared.tags_cloud.tags") %></h3>
|
||||
<br>
|
||||
<% tag_cloud @tag_cloud, %w[s m l] do |tag, css_class| %>
|
||||
<%= link_to sanitize("#{tag.name} <span class='label round info'>#{tag.taggings_count}</span>"), debates_path(tag: tag.name), class: css_class %>
|
||||
<%= link_to sanitize("#{tag.name} <span class='label round info'>#{tag.taggings_count}</span>"), taggable_path(taggable, tag.name), class: css_class %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user