Module: Contentable::Helpers

Defined in:
lib/contentable.rb

Overview

Gets auto included in your ApplicationHelper when you include the Model module in the model class

Instance Method Summary collapse

Instance Method Details

#display_content(content_item, edit = false) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/contentable.rb', line 29

def display_content(content_item, edit = false)
  html = display_textile(content_item.text)
  if edit
    edit_path = content_item.missing ? new_content_item_path(:title => content_item.missing) : edit_content_item_path(content_item)
    html += "<p>#{link_to("Edit Content", edit_path)}</p> " 
  end
  return html
end

#display_textile(text) ⇒ Object



26
27
28
# File 'lib/contentable.rb', line 26

def display_textile(text)
  RedCloth.new(text).to_html.html_safe
end