Method: ApplicationHelper#post_links

Defined in:
app/helpers/application_helper.rb

#post_links(post) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'app/helpers/application_helper.rb', line 70

def post_links(post)
  if post.allows_comment?
    disp = ''
  else
    disp = 'style="display: none;"'
  end

  str = '<ul class="postlinks">'
  str << "<li #{disp} id=\"replylink_#{post.id}\">" + link_to('Reply', {:controller => 'post', :action => 'reply', :user => post.user.username, :slug => post.slug}, 'onclick' => "return showReply('#{post.id}')", 'id' => "post_reply_#{post.id}") + "</li>"
  str << '<li>' + link_to('Add Tags', {:controller => 'post', :action => 'tag', :user => post.user.username, :slug => post.slug}, 'onclick' => "return showTagger('#{post.id}')", 'id' => "post_tagger_#{post.id}") + '</li>'
  str << '<li>' + link_to("View / Permalink", {:controller => 'post', :action => 'view', :user => post.user.username, :slug => post.slug}, {'class' => 'middle' }) + '</li>'
  str << "<li #{disp} id=\"comment_count_#{post.id}\"> " + link_to("Comments (#{post.comments.length})", :controller => 'post', :action => 'view', :user => post.user.username, :slug => post.slug, :anchor => 'comments') + "</li>"    
  str << "<li>" + link_to("Trackbacks (#{post.pings.length})", :controller => 'post', :action => 'view', :user => post.user.username, :slug => post.slug, :anchor => 'trackbacks') + "</li>"
  str << '</ul>'
end