Last active
August 29, 2015 14:05
-
-
Save mettledrum/1fa7fe3d5404af37076f to your computer and use it in GitHub Desktop.
_partials for recursively displaying nested comments for a posting
This file contains hidden or 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
<% @comments.each do |comment_hash| %> | |
<%= render 'comment_tree', comment_hash: comment_hash %> | |
<% end %> |
This file contains hidden or 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
<div class="panel panel-default"> | |
<div class="panel-body"> | |
<%= comment_hash[:comment].content %> | |
<br></br> | |
<% if children = comment_hash[:children] %> | |
<% children.each do |child_hash| %> | |
<%= render 'comment_tree', comment_hash: child_hash %> | |
<% end %> | |
<% end %> | |
</div> | |
<div class="panel-footer"> | |
by <%= comment_hash[:comment].user.name %> | <%= comment_hash[:comment].created_at.strftime("%d %b. %Y") %> | |
<span class="pull-right"> | |
<%= link_to 'reply', new_user_posting_comment_path(@user, @posting, parent_id: comment_hash[:comment].id) %> | |
</span> | |
</div> | |
</div> |
This file contains hidden or 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
<div class="panel panel-warning"> | |
<div class="panel-heading"> | |
<%= @posting.title %> | |
<span class="pull-right"> | |
<%= link_to 'reply', new_user_posting_comment_path(@user, @posting, parent_id: nil) %> | |
</span> | |
</div> | |
<div class="panel-body"> | |
<%= @posting.content %> | |
<br></br> | |
<%= render 'comment_forest' %> | |
</div> | |
<div class="panel-footer"> | |
by <%= @posting.user.name %> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment