Closed nadeemja closed 9 years ago
I currently use a local variable in my views, which boils down to this:
- @comments.each do |c|
= render partial: 'comments/comment', locals: { c: c, depth: 1 }
And in comment/_comment.html.slim
p[class="comment comment-#{depth}"]= c.body
- c.children.each do |ch|
= render partial: 'comments/comment', locals: { c: ch, depth: depth+1 }
After which you can style the indentation based on .comment-n
, alternatively you could give each .comment a left margin except for the root comments.
Hi @fletcher91
Thanks for your reply. I too tried that. But, since AACWT is based on ANS, you can add field depth to your model and everything works automagically :)
Hi @nadeemja
That's really nice actually, thanks for the tip!
~tvk
Hi,
I'm trying indent comments based on how nested they are. How can I know?
I'm calling Model.comment_threads.
Regards,
Nadeem J. Qureshi