Sha256: c6bbc52ff368287e4a396b74a3e7115dc178efa02b7e99d577f721a06bfe0c02

Contents?: true

Size: 1.1 KB

Versions: 16

Compression:

Stored size: 1.1 KB

Contents

module DmCms::PostsHelper
  include DmCore::LiquidHelper
  
  
  # Display the blog summary.  Support liquid tags and markdown in the summary
  # field.  If the there is no summary, grab the first :words from the content
  # Note: can't support liquid in emails right now.  The path to the assets is not
  # generated correctly, and the styles mostly likely don't match.  For now,
  # strip out liquid for emails
  #------------------------------------------------------------------------------
  def display_post_summary(post, options = {})
    options.reverse_merge!(words: 50, email: false)
    
    if !post.summary.blank?
      options[:email] ? markdown(post.summary, safe: false) : liquidize_markdown(post.summary)
    else
      post.content.blank? ? '' : (options[:email] ? markdown(post.content.smart_truncate(options[:words]), safe: false) : liquidize_markdown(post.content.smart_truncate(options[:words])))
    end
  end
  
  #------------------------------------------------------------------------------
  def display_post_content(post)
    post.content.blank? ? '' : liquidize_markdown(post.content)
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
dm_cms-4.2.3.10 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.9 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.8 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.7 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.6 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.5 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.4 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.3 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.2 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3.1 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.3 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.2.3 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.2.2 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.2.1 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.2 app/helpers/dm_cms/posts_helper.rb
dm_cms-4.2.1.5 app/helpers/dm_cms/posts_helper.rb