Module: Katalyst::Content::FrontendHelper

Includes:
TableHelper
Defined in:
app/helpers/katalyst/content/frontend_helper.rb

Instance Method Summary collapse

Methods included from TableHelper

#normalize_content_table, #sanitize_content_table

Instance Method Details

#content_item_tag(item) ⇒ Object



30
31
32
# File 'app/helpers/katalyst/content/frontend_helper.rb', line 30

def content_item_tag(item, ...)
  FrontendBuilder.new(self, item).render(...)
end

#render_content(version) ⇒ ActiveSupport::SafeBuffer, ...

Render all items from a content version as HTML Example usage:

<%= render_content(version) %>

Parameters:

Returns:

  • (ActiveSupport::SafeBuffer, String, nil)

    Content as HTML



13
14
15
16
17
18
19
20
21
# File 'app/helpers/katalyst/content/frontend_helper.rb', line 13

def render_content(version)
  capture do
    cache version do
      without_partial_path_prefix do
        concat render partial: version.tree.select(&:visible?)
      end
    end
  end
end

#render_content_items(items) ⇒ Object



23
24
25
26
27
28
# File 'app/helpers/katalyst/content/frontend_helper.rb', line 23

def render_content_items(items)
  items = items.select(&:visible?)
  without_partial_path_prefix do
    render partial: items if items.any?
  end
end