Module: Commontator::SharedHelper
- Included in:
- SubscriptionsMailer
- Defined in:
- lib/commontator/shared_helper.rb
Instance Method Summary collapse
- #commontator_email(user) ⇒ Object
- #commontator_gravatar_image(user, options = {}) ⇒ Object
- #commontator_gravatar_url(user, options = {}) ⇒ Object
- #commontator_name(user) ⇒ Object
- #commontator_thread(commontable) ⇒ Object
Instance Method Details
#commontator_email(user) ⇒ Object
15 16 17 |
# File 'lib/commontator/shared_helper.rb', line 15 def commontator_email(user) user.commontator_config.user_email_proc.call(user) end |
#commontator_gravatar_image(user, options = {}) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/commontator/shared_helper.rb', line 29 def commontator_gravatar_image(user, = {}) name = commontator_name(user) image_tag(commontator_gravatar_url(user, ), { :alt => name, :title => name, :border => 1 }) end |
#commontator_gravatar_url(user, options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/commontator/shared_helper.rb', line 19 def commontator_gravatar_url(user, = {}) [:secure] ||= request.ssl? [:size] ||= 50 hash = Digest::MD5.hexdigest(commontator_email(user)) base = [:secure] ? "s://secure" : "://www" "http#{base}.gravatar.com/avatar/#{hash}?s=#{[:size]}" end |
#commontator_name(user) ⇒ Object
11 12 13 |
# File 'lib/commontator/shared_helper.rb', line 11 def commontator_name(user) user.commontator_config.user_name_proc.call(user) 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 |