From f4d90c8450f0fa56d1b424b2eae7a8ebc534456a Mon Sep 17 00:00:00 2001 From: jywarren Date: Mon, 5 Sep 2022 17:44:53 +0000 Subject: [PATCH] small fixes --- app/controllers/tag_controller.rb | 19 +++++++++++-------- app/views/tag/_subtopics.html.erb | 3 +++ 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 app/views/tag/_subtopics.html.erb diff --git a/app/controllers/tag_controller.rb b/app/controllers/tag_controller.rb index 8ea11bc2e6..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,12 +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 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| %> +

<%= subtopic %>

+<% end %> \ No newline at end of file