Module: ComponentHelper
- Defined in:
- app/helpers/component_helper.rb
Instance Method Summary collapse
- #add_option(option, output = nil) ⇒ Object
- #markdown(text) ⇒ Object
- #markdown_help_url ⇒ Object
- #render_children(children) ⇒ Object
Instance Method Details
#add_option(option, output = nil) ⇒ Object
2 3 4 5 6 |
# File 'app/helpers/component_helper.rb', line 2 def add_option(option, output = nil) return unless option return output if output option end |
#markdown(text) ⇒ Object
8 9 10 11 |
# File 'app/helpers/component_helper.rb', line 8 def markdown(text) return unless text Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(text).html_safe end |
#markdown_help_url ⇒ Object
13 14 15 |
# File 'app/helpers/component_helper.rb', line 13 def markdown_help_url "http://nestacms.com/docs/creating-content/markdown-cheat-sheet" end |
#render_children(children) ⇒ Object
17 18 19 20 |
# File 'app/helpers/component_helper.rb', line 17 def render_children(children) return children unless children.present? && children.is_a?(Array) children.map(&:render).reduce(:+) end |