Sha256: bea906ab8ab581c6b66593a91cbe48459df58ee8b539c817c7d6780efe6044e6
Contents?: true
Size: 1.31 KB
Versions: 12
Compression:
Stored size: 1.31 KB
Contents
module Commontator module CommentsHelper def commontator_name(user) return Commontator.user_missing_name if user.nil? config = user.commontator_config config.user_name_method.blank? ? config.user_missing_name : \ user.send(config.user_name_method) end def comment_timestamp(comment) config = comment.thread.config (comment.is_modified? ? 'Last modified on ' : \ config.comment_create_verb_past.capitalize + \ ' on ') + comment.updated_at.strftime(config.timestamp_format) end def commontator_gravatar_url(user, options = {}) return '' if user.nil? config = user.commontator_config options[:secure] ||= request.ssl? options[:size] ||= 50 hash = Digest::MD5.hexdigest(user.send(config.user_email_method)) base = options[:secure] ? "s://secure" : "://www" "http#{base}.gravatar.com/avatar/#{hash}?s=#{options[:size]}" end def commontator_gravatar_image(comment, options = {}) user = comment.creator return '' if user.nil? config = user.commontator_config name = user.send(config.user_name_method) image_tag(gravatar_url(comment, options), { :alt => name, :title => name, :border => 1 }) end end end
Version data entries
12 entries across 12 versions & 1 rubygems