Class: Katalyst::Content::Item

Inherits:
ApplicationRecord
  • Object
show all
Includes:
HasStyle
Defined in:
app/models/katalyst/content/item.rb

Overview

STI base class for content items

Direct Known Subclasses

Content, Figure, Layout, Table

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



24
25
26
# File 'app/models/katalyst/content/item.rb', line 24

def children
  @children
end

#depthObject

Returns the value of attribute depth.



24
25
26
# File 'app/models/katalyst/content/item.rb', line 24

def depth
  @depth
end

#indexObject

Returns the value of attribute index.



24
25
26
# File 'app/models/katalyst/content/item.rb', line 24

def index
  @index
end

#parentObject

Returns the value of attribute parent.



24
25
26
# File 'app/models/katalyst/content/item.rb', line 24

def parent
  @parent
end

Class Method Details

.configObject



9
10
11
# File 'app/models/katalyst/content/item.rb', line 9

def self.config
  Katalyst::Content.config
end

.permitted_paramsObject



26
27
28
29
30
31
32
33
34
35
36
# File 'app/models/katalyst/content/item.rb', line 26

def self.permitted_params
  %i[
    container_type
    container_id
    type
    heading
    heading_style
    background
    visible
  ]
end

Instance Method Details

#heading_style_classObject



46
47
48
# File 'app/models/katalyst/content/item.rb', line 46

def heading_style_class
  heading_style unless heading_default?
end

#layout?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'app/models/katalyst/content/item.rb', line 50

def layout?
  is_a? Layout
end

#show_heading?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'app/models/katalyst/content/item.rb', line 42

def show_heading?
  !heading_none?
end

#to_plain_textObject



38
39
40
# File 'app/models/katalyst/content/item.rb', line 38

def to_plain_text
  heading if show_heading? && visible?
end