Module: DmCms::PostsHelper
- Includes:
- DmCore::LiquidHelper
- Defined in:
- app/helpers/dm_cms/posts_helper.rb
Instance Method Summary collapse
-
#display_post_content(post) ⇒ Object
——————————————————————————.
-
#display_post_summary(post, options = {}) ⇒ Object
Display the blog summary.
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, = {}) .reverse_merge!(words: 50, email: false) if !post.summary.blank? [:email] ? markdown(post.summary, safe: false) : liquidize_markdown(post.summary) else post.content.blank? ? '' : ([:email] ? markdown(post.content.smart_truncate([:words]), safe: false) : liquidize_markdown(post.content.smart_truncate([:words]))) end end |