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.



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

def children
  @children
end

#depthObject

Returns the value of attribute depth.



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

def depth
  @depth
end

#indexObject

Returns the value of attribute index.



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

def index
  @index
end

#next_siblingObject

Returns the value of attribute next_sibling.



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

def next_sibling
  @next_sibling
end

#parentObject

Returns the value of attribute parent.



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

def parent
  @parent
end

#previous_siblingObject

Returns the value of attribute previous_sibling.



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

def previous_sibling
  @previous_sibling
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



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

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

Instance Method Details

#dom_idObject



55
56
57
# File 'app/models/katalyst/content/item.rb', line 55

def dom_id
  heading&.parameterize
end

#heading_style_classObject



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

def heading_style_class
  heading_style unless heading_default?
end

#item_typeObject



59
60
61
# File 'app/models/katalyst/content/item.rb', line 59

def item_type
  model_name.param_key
end

#layout?Boolean

Returns:

  • (Boolean)


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

def layout?
  is_a? Layout
end

#show_heading?Boolean

Returns:

  • (Boolean)


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

def show_heading?
  !heading_none?
end

#to_plain_textObject



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

def to_plain_text
  heading if show_heading? && visible?
end