-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show subtopics inside a topic page
- Loading branch information
Showing
6 changed files
with
46 additions
and
18 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
app/components/six/explorer/child_topics_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="topicexplorer"> | ||
<%= render Six::Base::WrapperComponent.new(classes: 'topicexplorer__wrap') do %> | ||
<h2 class="topicexplorer__title">Subcategorías de este tema</h2> | ||
<div class="topicexplorer__topics"> | ||
<% @topic.child_topics.each do |topic| %> | ||
<div class="topicexplorer__topic"> | ||
<%= render Six::Explorer::TopicThumbnailComponent.new(topic: topic, name: topic.title) %> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
module Six | ||
module Explorer | ||
class ChildTopicsComponent < ViewComponent::Base | ||
include ViewComponent::Translatable | ||
|
||
with_collection_parameter :topic | ||
|
||
def render? | ||
@topic.child_topics.present? | ||
end | ||
|
||
def initialize(topic:) | ||
super | ||
@topic = topic | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters