Sha256: 325394f5edcbc133c79fb4ee67d641bf9056a57bb3d8ae512f98b45dbd1f5667
Contents?: true
Size: 1.8 KB
Versions: 1
Compression:
Stored size: 1.8 KB
Contents
module Commontator module CommentsHelper def commontator_name(comment) commontator = comment.commontator return Commontator.commontator_missing_name if commontator.nil? config = commontator.commontator_config config.commontator_name_method.blank? ? config.commontator_missing_name : \ commontator.send(config.commontator_name_method end def deleter_name(comment) deleter = comment.deleter return Commontator.commontator_missing_name if deleter.nil? config = deleter.commontator_config config.commontator_name_method.blank? ? config.commontator_missing_name : \ deleter.send(config.commontator_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 gravatar_url(comment, options = {}) commontator = comment.commontator return '' if commontator.nil? config = commontator.commontator_config options[:secure] ||= request.ssl? options[:size] ||= 50 hash = Digest::MD5.hexdigest(commontator.send(config.commontator_email_method)) base = options[:secure] ? "s://secure" : "://www" "http#{base}.gravatar.com/avatar/#{hash}?s=#{options[:size]}" end def gravatar_image(comment, options = {}) commontator = comment.commontator return '' if commontator.nil? config = commontator.commontator_config name = commontator.send(config.commontator_name_method) image_tag(gravatar_url(comment, options), { :alt => name, :title => name, :border => 1 }) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commontator-0.4.1 | app/helpers/commontator/comments_helper.rb~ |