diff --git a/app/controllers/tag_controller.rb b/app/controllers/tag_controller.rb index ea261051da..772951a2e3 100644 --- a/app/controllers/tag_controller.rb +++ b/app/controllers/tag_controller.rb @@ -525,6 +525,17 @@ def comments render 'show' end + def subtopics + # here, we look for this special tag marking a node as having a parent + # collect the "slugs" i.e. the unique part of the URL, which should correspond to a tagname + subtopic_names = Tag.find_by(name: "parent:#{params[:topic]}") + &.nodes + &.collect(&:slug) + @subtopics = Tag.find_by(name: subtopic_names) + render "tag/_subtopics", layout: false + end + + private def order_string @@ -569,13 +580,4 @@ def fetch_counts def topic_tree; end - def subtopics - # here, we look for this special tag marking a node as having a parent - # collect the "slugs" i.e. the unique part of the URL, which should correspond to a tagname - subtopic_names = Tag.find_by(name: "parent:#{params[:topic]}") - .nodes - .collect(&:slug) - @subtopics = Tag.find_by(name: subtopic_names) - render "tags/subtopics", layout: false - end end diff --git a/app/views/tag/_subtopics.html.erb b/app/views/tag/_subtopics.html.erb new file mode 100644 index 0000000000..c896a3adf6 --- /dev/null +++ b/app/views/tag/_subtopics.html.erb @@ -0,0 +1,3 @@ +<% @subtopics&.each do |subtopic| %> +