Skip to content

Instantly share code, notes, and snippets.

@rwilcox
Created September 23, 2011 03:10
Show Gist options
  • Select an option

  • Save rwilcox/1236660 to your computer and use it in GitHub Desktop.

Select an option

Save rwilcox/1236660 to your computer and use it in GitHub Desktop.
Revised Presenter pattern
def primary_comment
if self.visits.count > 1
output = s"<details class='primary_comment'>"
output << helpers.content_tag(:summary, {}, nil, false) {
s("<h3>", Present(self.comments.last).url_span, " (and #{self.comments.count - 1} others)</h3>")
}
output << helpers.content_tag(:ul) do
self.comment[0...-1].collect { |comment| s(Present(comment).comment_li) }.join("\n")
end
output << s"</details>"
else
s( Present(self.comments.last).url_span, h("<BADTAG>") )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment