Module: Refinery::Blog::PostsHelper

Defined in:
app/helpers/refinery/blog/posts_helper.rb

Defined Under Namespace

Classes: ArchiveWidget

Instance Method Summary collapse

Instance Method Details

#avatar_url(email, options = {:size => 60}) ⇒ Object


31
32
33
34
# File 'app/helpers/refinery/blog/posts_helper.rb', line 31

def avatar_url(email, options = {:size => 60})
  require 'digest/md5'
  "http://gravatar.com/avatar/#{Digest::MD5.hexdigest(email.to_s.strip.downcase)}?s=#{options[:size]}.jpg"
end

#blog_archive_dates(cutoff = Time.now.beginning_of_month) ⇒ Object


27
28
29
# File 'app/helpers/refinery/blog/posts_helper.rb', line 27

def blog_archive_dates(cutoff=Time.now.beginning_of_month)
  Refinery::Blog::Post.published_dates_older_than(cutoff)
end

#blog_archive_widget(dates = blog_archive_dates) ⇒ Object


23
24
25
# File 'app/helpers/refinery/blog/posts_helper.rb', line 23

def blog_archive_widget(dates=blog_archive_dates)
  ArchiveWidget.new(dates, self).display
end

#blog_post_teaser(post) ⇒ Object


12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/refinery/blog/posts_helper.rb', line 12

def (post)
  if post.respond_to?(:custom_teaser) && post.custom_teaser.present?
   post.custom_teaser.html_safe
  else
   truncate(post.body, {
     :length => Refinery::Blog.,
     :preserve_html_tags => true
    }).html_safe
  end
end

#blog_post_teaser_enabled?Boolean

Returns:

  • (Boolean)

8
9
10
# File 'app/helpers/refinery/blog/posts_helper.rb', line 8

def 
  Refinery::Blog::Post.teasers_enabled?
end

#next_or_previous?(post) ⇒ Boolean

Returns:

  • (Boolean)

4
5
6
# File 'app/helpers/refinery/blog/posts_helper.rb', line 4

def next_or_previous?(post)
  post.next.present? or post.prev.present?
end