Module: ActiveBlog::BlogPostsHelper
- Defined in:
- app/helpers/active_blog/blog_posts_helper.rb
Instance Method Summary collapse
- #blog_post_path(blog_post) ⇒ Object
- #make_markdown(opts) ⇒ Object
- #markdown(text) ⇒ Object
- #markdown_for_schema(text) ⇒ Object
- #schema_date(date) ⇒ Object
- #schema_span_for(name, content) ⇒ Object
Instance Method Details
#blog_post_path(blog_post) ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/helpers/active_blog/blog_posts_helper.rb', line 25 def blog_post_path(blog_post) if blog_post.new_record? admin_blog_posts_path(blog_post) else admin_blog_post_path(blog_post) end end |
#make_markdown(opts) ⇒ Object
12 13 14 15 |
# File 'app/helpers/active_blog/blog_posts_helper.rb', line 12 def make_markdown(opts) markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, opts) markdown end |
#markdown(text) ⇒ Object
3 4 5 6 |
# File 'app/helpers/active_blog/blog_posts_helper.rb', line 3 def markdown(text) regular = { :hard_wrap => true, :autolink => true, :space_after_headers => true } make_markdown(regular).render(text).html_safe end |
#markdown_for_schema(text) ⇒ Object
8 9 10 |
# File 'app/helpers/active_blog/blog_posts_helper.rb', line 8 def markdown_for_schema(text) truncate((markdown(text)).strip.gsub(/\n/, ' '), :length => 250) end |
#schema_date(date) ⇒ Object
17 18 19 |
# File 'app/helpers/active_blog/blog_posts_helper.rb', line 17 def schema_date(date) date.strftime("%Y-%m-%d") end |
#schema_span_for(name, content) ⇒ Object
21 22 23 |
# File 'app/helpers/active_blog/blog_posts_helper.rb', line 21 def schema_span_for(name, content) content_tag(:span, "", :itemprop => name, :content => content) end |