Module: DmCms::PostsHelper

Includes:
DmCore::LiquidHelper
Defined in:
app/helpers/dm_cms/posts_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_post_content(post) ⇒ Object




22
23
24
# File 'app/helpers/dm_cms/posts_helper.rb', line 22

def display_post_content(post)
  post.content.blank? ? '' : liquidize_markdown(post.content)
end

#display_post_summary(post, options = {}) ⇒ Object

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




11
12
13
14
15
16
17
18
19
# File 'app/helpers/dm_cms/posts_helper.rb', line 11

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