journalduhacker/app/views/stories/show.html.erb
2014-04-14 23:14:08 -05:00

44 lines
1.2 KiB
Plaintext

<ol class="stories">
<%= render :partial => "stories/listdetail",
:locals => { :story => @story, :single_story => true } %>
</ol>
<div class="story_content">
<% if @story.markeddown_description.present? %>
<div class="story_text">
<%= raw @story.markeddown_description %>
</div>
<% end %>
</div>
<% if !@story.previewing %>
<ol class="comments comments1">
<% if !@story.is_gone? && !@story.previewing %>
<li><%= render "comments/commentbox", :comment => @comment %></li>
<% end %>
<% comments_by_parent = @comments.group_by(&:parent_comment_id) %>
<% subtree = comments_by_parent[nil] %>
<% ancestors = [] %>
<% while subtree %>
<% if (comment = subtree.shift) %>
<li>
<%= render "comments/comment", :comment => comment,
:show_story => (comment.story_id != @story.id),
:was_merged => (comment.story_id != @story.id) %>
<% if (children = comments_by_parent[comment.id]) %>
<% ancestors << subtree %>
<% subtree = children %>
<ol class="comments">
<% else %>
<ol class="comments"></ol></li>
<% end %>
<% elsif (subtree = ancestors.pop) %>
</ol></li>
<% end %>
<% end %>
</ol>
<% end %>