Skip to content

Commit

Permalink
resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
jywarren committed Sep 5, 2022
2 parents e76687d + f4d90c8 commit e220ca5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/controllers/tag_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
3 changes: 3 additions & 0 deletions app/views/tag/_subtopics.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<% @subtopics&.each do |subtopic| %>
<h1><%= subtopic %></h1>
<% end %>

0 comments on commit e220ca5

Please sign in to comment.