Module: Commontator::SharedHelper

Defined in:
lib/commontator/shared_helper.rb

Instance Method Summary collapse

Instance Method Details

#commontator_gravatar_image_tag(user, border = 1, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/commontator/shared_helper.rb', line 11

def commontator_gravatar_image_tag(user, border = 1, options = {})
  email = Commontator.commontator_email(user) || ''
  name = Commontator.commontator_name(user) || ''

  base = request.ssl? ? "s://secure" : "://www"
  hash = Digest::MD5.hexdigest(email)
  url = "http#{base}.gravatar.com/avatar/#{hash}?#{options.to_query}"
  
  image_tag(url, { :alt => name,
                   :title => name,
                   :border => border })
end

#commontator_thread(commontable) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/commontator/shared_helper.rb', line 3

def commontator_thread(commontable)
  user = Commontator.current_user_proc.call(self)
  
  render(:partial => 'commontator/shared/thread',
         :locals => {:thread => commontable.thread,
                     :user => user}).html_safe
end