class Tumblargh::Renderer::Blocks::PostNotes

Rendered on permalink pages if this post has notes.

Public Instance Methods

note_count() click to toggle source
# File lib/tumblargh/renderer/blocks/notes.rb, line 11
def note_count
  context_post.note_count || 0
end
post_notes() click to toggle source
# File lib/tumblargh/renderer/blocks/notes.rb, line 15
        def post_notes
          buf = ['<ol class="notes">']

          # TODO: Support notes with_commentary
          buf << context_post.notes.map do |note|
            classes = "note without_commentary #{note.type}"
            action = case note.type
            when 'like'
              'liked this'
            when 'reblog'
              'reblogged this from somewhere?'
            end

            <<-eos
            <li class='#{classes}'>
              <a href="#{note.blog_url}" title="" rel="nofollow">
                <img src="http://assets.tumblr.com/images/default_avatar_16.gif" class="avatar" alt="">
              </a>
              
              <span class="action">
                <a href="#{note.blog_url}" title="" rel="nofollow">#{note.blog_name}</a> 
                #{action}
              </span>

              <div class="clear"></div>
            </li>
            eos
          end.join("\n")

          buf << '</ol>'

          buf.join ''
        end
should_render?() click to toggle source
# File lib/tumblargh/renderer/blocks/notes.rb, line 7
def should_render?
  context.permalink? && note_count > 0
end