Skip to content

Instantly share code, notes, and snippets.

@ctdk
Created June 12, 2009 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctdk/128360 to your computer and use it in GitHub Desktop.
Save ctdk/128360 to your computer and use it in GitHub Desktop.
# since you're curiuos....
# inside the story view
<div id="comments">
<ul class="cm i0">
<% @n = 0 %>
<% @od = 0 %>
<% while @n < @comments.length do %>
<%= render :partial => 'comment/comment', :locals => { :comments => @comments, :depth_tree => @depth_tree } %>
<% end %>
<% until @od == depth_tree[c.id]
@od -= 1 %>
</ul>
<% end %>
</ul>
</div>
# in the comment parial
<% c = comments[@n] %>
<%# c is this comment %>
<% if depth_tree[c.id] > @od
@od += 1 %>
<ul class="cm i1">
<% elsif depth_tree[c.id] < @od %>
<% until @od == depth_tree[c.id]
@od -= 1 %>
</ul>
<% end %>
<% end %>
<li id="c<%= c.cid %>">
<div class="cx">
<h3>D: <%= depth_tree[c.id] -%> <a class="de">&nbsp;</a><!-- new --><span class="cu"><%= c.subject %></span>
<span class="crd ntb">(<!-- rating_format -->)</span>
</h3>
<%# recommend_list %>
<div class="ct">
<%= c.comment_text %>
</div>
<div class="cf">
<%# c.sig %>
<p class="cb">by <a href="/user/uid:<%= c.user_id %>"><%= c.nickname %></a> on <a href="/comment/<%= c.story_id %>/<%= c.id %>#c<%= c.cid %>"><%= c.time %></a><!-- comment_ip --></p>
<p class="cl">|actions|</p>
</div>
</div>
<% @n += 1 %>
<%# if depth_tree[c.id] < @od %>
<%# until @od == depth_tree[c.id] %>
<%# @od -= 1 %>
<%# end %>
<%# end %>
<%# render :partial => 'comment/comment', :locals => { :comments => comments, :depth_tree => depth_tree, :old_depth => depth_tree[c.id] } %>
</li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment