Class: ActiveadminSelleoCms::Layout::Section

Inherits:
Object
  • Object
show all
Defined in:
app/models/activeadmin_selleo_cms/layout.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Section

Returns a new instance of Section.



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 42

def initialize(node)
  @name                 = node.attributes["name"].content
  @type                 = node.attributes["data-type"] ? node.attributes["data-type"].content : 'ckeditor'
  @attachments          = node.attributes["data-attachments"].present?
  @attachment           = node.attributes["data-attachment"].present?
  @related              = node.attributes["data-related"].present?
  @toolbar              = node.attributes["data-toolbar"] ? node.attributes["data-toolbar"].content : 'Minimal'
  @width                = node.attributes["data-width"] ? node.attributes["data-width"].content : 640
  @height               = node.attributes["data-height"] ? node.attributes["data-height"].content : 480
  @resize_method        = node.attributes["data-resize-method"] ? node.attributes["data-resize-method"].content : "#"
  @cover_width          = node.attributes["data-cover-width"] ? node.attributes["data-cover-width"].content : 140
  @cover_height         = node.attributes["data-cover-height"] ? node.attributes["data-cover-height"].content : 199
  @cover_resize_method  = node.attributes["data-cover-resize-method"] ? node.attributes["data-cover-resize-method"].content : ">"
end

Instance Attribute Details

#cover_heightObject

Returns the value of attribute cover_height.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def cover_height
  @cover_height
end

#cover_resize_methodObject

Returns the value of attribute cover_resize_method.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def cover_resize_method
  @cover_resize_method
end

#cover_widthObject

Returns the value of attribute cover_width.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def cover_width
  @cover_width
end

#heightObject

Returns the value of attribute height.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def height
  @height
end

#nameObject

Returns the value of attribute name.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def name
  @name
end

#resize_methodObject

Returns the value of attribute resize_method.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def resize_method
  @resize_method
end

#toolbarObject

Returns the value of attribute toolbar.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def toolbar
  @toolbar
end

#typeObject

Returns the value of attribute type.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def type
  @type
end

#widthObject

Returns the value of attribute width.



40
41
42
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 40

def width
  @width
end

Instance Method Details

#attachment?Boolean

Returns:

  • (Boolean)


73
74
75
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 73

def attachment?
  ['file'].include?(@type.downcase) or @attachment
end

#attachments?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 69

def attachments?
  ['files'].include?(@type.downcase) or @attachments
end

#image?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 61

def image?
  ['image'].include? @type.downcase
end

#images?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 65

def images?
  ['images'].include? @type.downcase
end

#related?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 77

def related?
  ['related'].include?(@type.downcase) or @related
end

#text?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'app/models/activeadmin_selleo_cms/layout.rb', line 57

def text?
  ['ckeditor', 'text', 'string'].include? @type.downcase
end