Module: Blogr::PostsHelper

Defined in:
app/helpers/blogr/posts_helper.rb

Defined Under Namespace

Classes: HTMLwithPygments

Instance Method Summary collapse

Instance Method Details

#check_category(post_object, category_object) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/helpers/blogr/posts_helper.rb', line 7

def check_category post_object, category_object
  attr = {}
  if post_object.categories.pluck(:id).include?(category_object.id)
    attr[:checked] = 'checked'
  end

  return attr
end

#markdown(text) ⇒ Object



16
17
18
19
# File 'app/helpers/blogr/posts_helper.rb', line 16

def markdown(text)
  redcarpet = Redcarpet::Markdown.new(HTMLwithPygments, :fenced_code_blocks => true, :autolink => true, :space_after_headers => true, :underline => true, :highlight => true)
  redcarpet.render(text)
end