Class: Panda::CMS::CodeComponent

Inherits:
Panda::Core::Base
  • Object
show all
Defined in:
app/components/panda/cms/code_component.rb

Overview

Code component for editable HTML/code content

Defined Under Namespace

Classes: BlockError

Constant Summary collapse

KIND =
"code"

Instance Method Summary collapse

Instance Method Details

#before_templateObject

Raises:



28
29
30
31
# File 'app/components/panda/cms/code_component.rb', line 28

def before_template
  raise BlockError, "Key 'code' is not allowed for CodeComponent" if @key == :code
  prepare_content
end

#view_templateObject



16
17
18
19
20
21
22
23
24
25
26
# File 'app/components/panda/cms/code_component.rb', line 16

def view_template
  # Russian doll caching: Cache component output at block_content level
  # Only cache in non-editable mode (public-facing pages)
  if should_cache?
    raw cache_component_output
  else
    render_content
  end
rescue => e
  handle_error(e)
end