diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb new file mode 100644 index 000000000..b8476ac0a --- /dev/null +++ b/app/helpers/tags_helper.rb @@ -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 diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index b910a0c0c..256fe3755 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -51,7 +51,7 @@
diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index 788e1ce95..df6dd2352 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -51,7 +51,7 @@
diff --git a/app/views/shared/_tag_cloud.html.erb b/app/views/shared/_tag_cloud.html.erb index 737fc3a94..171b85b3c 100644 --- a/app/views/shared/_tag_cloud.html.erb +++ b/app/views/shared/_tag_cloud.html.erb @@ -3,6 +3,6 @@

<%= t("shared.tags_cloud.tags") %>


<% tag_cloud @tag_cloud, %w[s m l] do |tag, css_class| %> - <%= link_to sanitize("#{tag.name} #{tag.taggings_count}"), debates_path(tag: tag.name), class: css_class %> + <%= link_to sanitize("#{tag.name} #{tag.taggings_count}"), taggable_path(taggable, tag.name), class: css_class %> <% end %>